[Proposal] I18n translations for scaffold templates

Problem description Scaffold generators currently create code that is not internationalized. Examples include flash messages from the controller and button names and links in the erb templates. This is also an issue because the namespace for these translations is also undefined, so it is difficult to add the translations to the rails-i18n project. Other components such as ActiveRecord currently do define the scoping for I18n messages, so it seems reasonable to add the same for the railties/generators scaffold code.

Proposal Define a scope for these translations (i.e. “scaffold/controller”, “scaffold/erb”). Create a PR for adding the translation code to the templates Add the keys for en to the locale file in railties Follow up with rails-18n team to include a module for scaffold translations.

Thoughts?

4 Likes

I keep seeing this topic come up but no definitive answers on it.
For example:

Rails discussions

Rails issues

RailsI18n feature requests

The last has been blocking on this proposal for several years. Should it be definitively rejected? Pushed into a gem?

Any help or comments greatly appreciated! I am more than happy to write the PR.

Hey! You can create your own scaffold template - controller and views as described here - Rails scaffold templates | I'm Mary Poppins, y'all!

Thank you for your reply Alexey.
Sorry for not making it clearer, but this proposal is to modify the Rails templates to be i18n compliant like the rest of rails. As you mention, it is possible to create custom templates for an individual Rails project which are i18n compliant, this has to be done again for every new project and doesn’t help anyone else running Rails. Thanks again!

1 Like