rails-i18n icon indicating copy to clipboard operation
rails-i18n copied to clipboard

feature: Translations for Rails::Generators

Open jpgeek opened this issue 3 years ago • 8 comments

Translations for Rails generators and scaffolding would seem to fit in the scope of rails-i18n, but seem to be only partially included. For example in the

controller template:

notice: <%= %("#{human_name} was successfully created.") %>

or in new

<%%= link_to "Back to <%= human_name.pluralize.downcase %>", <%= index_helper(type: :path) %> %>

Oddly, it looks like there are currently translations for errors within the templates at errors.template.header for some template strings, but not success, back, or destroy. How about adding a section for template.errors.* and template.messages.* to handle these cases?

This is similar to issue #784 but generalizes it.

jpgeek avatar Jul 31 '22 21:07 jpgeek

@jpgeek thank you - this ticket is a lot clearer than #784

digitalfrost avatar Aug 18 '22 09:08 digitalfrost

@digitalfrost thank you for the update cleanup on the issues. If this is something that you and the other maintainers feel is in-scope, I would be happy to suggest a scope, put in a PR and provide translations for en and ja. If it is out of scope I will extract the scaffold translations into another gem and we can close this feature.

jpgeek avatar Aug 18 '22 13:08 jpgeek

@kuroda and @pama - Could you please give feedback. To me this seems like a good idea.

digitalfrost avatar Aug 23 '22 13:08 digitalfrost

I have some concerns.

First, it should be optional to avoid breaking existing code/workflow, and #1019 could be a starting point to accomplish that.

Second, it concerns me that by introducing this change, we will also need to maintain the scaffold code, which seems somehow out of scope.

pama avatar Aug 23 '22 14:08 pama

Thanks @pama. So using #1019 we could put the scaffold translations under rails/scaffold. That makes sense.

As to your second point, wouldn't the scaffold code still be the responsibility of the scaffold (railties) team, just like it is for say ActiveRecord? For example with Active Record, the I18n scope is determined in the Rails code: here If we can get the scaffold (railties) team to come up with the namespace (or we suggest one) would that work?

jpgeek avatar Nov 17 '22 08:11 jpgeek

I would prefer to view the scaffold code in the Ruby on Rails source, allowing us to provide translations through rails-i18n.

I am not inclined to maintain a separate scaffold branch in this gem. I recommend initiating a discussion on https://discuss.rubyonrails.org/c/rubyonrails-core/5.

pama avatar May 12 '23 23:05 pama

Thank you @pama . I opened a discussion there last year: here No replies yet. Does not look like it will happen there either.

jpgeek avatar Jun 12 '23 23:06 jpgeek