Raise on missing translations (unify controllers and views)

I’m on a mission to unify the logic for raise_on_missing_translation between controllers and views. Currently this is scoped to ActionView. I’m proposing that we move the config option to the I18n scope, giving us config.i18n.raise_on_missing_translations and thus deprecating config.action_view.raise_on_missing_translations. We then update AbstractController#translate and TranslationHelper#translate to use the new config option and raise errors accordingly.

Since I’m not usually contributing to Rails I might overlook some technical or architectural aspects of the problem. Would love some feedback on the approach I’m taking. If all sounds good, I will begin working on a pull request.

I’m positive to adding such generic option.

I18n already have the transalate! method to raise an error if the translation is missing maybe we should use it in the Rails wrappers?

I just found this issue after noticing that raise_on_missing_translations wasn’t working for a call to translate within app/mailers.

Kevin, did you make any progress on the pull request? I didn’t find anything in Github.


PR for this feature Unify raise_on_missing_translations for views and controllers by fatkodima · Pull Request #31571 · rails/rails · GitHub