Raise on missing translations (unify controllers and views)

186 views
Skip to first unread message

Kevin Sjöberg

unread,
May 23, 2016, 6:59:01 PM5/23/16
to Ruby on Rails: Core
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.

Rafael Mendonça França

unread,
May 23, 2016, 7:13:48 PM5/23/16
to rubyonra...@googlegroups.com
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?

On Mon, May 23, 2016 at 7:59 PM Kevin Sjöberg <kev.s...@gmail.com> wrote:
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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-co...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Brian Salomaki

unread,
Dec 10, 2017, 1:53:08 AM12/10/17
to Ruby on Rails: Core
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.

-brian

F D

unread,
Dec 27, 2017, 6:10:43 AM12/27/17
to Ruby on Rails: Core
Reply all
Reply to author
Forward
0 new messages