-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing replacements #17
Comments
Okay, so there are reasons why these lines are not considered for internationalization. Let's see if they are good ones :) First, i15r will only change strings in views, more precisely anything ending in .erb or .haml. So that's why nothing was changed in the controller examples. It would be possible to do controllers, but I want to keep the code simple and I think this would introduce complexity for gaining too little (strings to be internationalized in controller and model code are few, and other issues, like generating the message key prefix from the file name, would crop up). In the case of the index view, it is not changed because only one string is replaced in each line and if a line already has That said, I'd love to hear your opinion on all this. |
While I understand your design decisions I think i15r should at least attempt to cover every possible string occurrence in views as otherwise the user might be confused or miss some translatable string altogether. |
Hmm, good point. What you're saying is that i15r should follow the principle of least surprise and replace all occurrences of plain strings in views. I think it (replacing several strings on the same line) can be done. The bad news is that it probably makes necessary a major overhaul of the current design. Let me dwell on this a bit more. Thank you for your feedback. |
Lines like the following ones (taken from scaffolded Rails artefacts) aren't properly replaced when running 'i15r .' from a Rails app root directory:
Controller 'create' action:
format.html { redirect_to @Company, notice: 'Company was successfully created.' }
Controller 'update' action:
format.html { redirect_to @Company, notice: 'Company was successfully updated.' }
index.html.erb view:
<%= link_to I18n.t("companies.index.destroy"), company, method: :delete, data: { confirm: 'Are you sure?' } %>
The text was updated successfully, but these errors were encountered: