Home > other >  How to set raise_on_missing_translations for I18n
How to set raise_on_missing_translations for I18n

Time:08-19

In rails 6.1.6.1 I have the following deprecation warning

DEPRECATION WARNING: action_view.raise_on_missing_translations is deprecated and will be removed in Rails 7.0. Set i18n.raise_on_missing_translations instead. Note that this new setting also affects how missing translations are handled in controllers.

I have tried

I18n.config.raise_on_missing_translations = true

but this raises an exception

NoMethodError: undefined method `raise_on_missing_translations=' for #<I18n::Config:0x00007fb6b1b1ae08>

so how do I set it, and where do I set it (e.g. in an initializer).

CodePudding user response:

Set config like this in application.rb or in specific environments:

config.i18n.raise_on_missing_translations = true
  • Related