Exception: I18n::Disabled

Inherits:
ArgumentError show all
Defined in:
lib/i18n/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(method) ⇒ Disabled

Returns a new instance of Disabled.



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/i18n/exceptions.rb', line 19

def initialize(method)
  super(<<~MESSAGE)
    I18n.#{method} is currently disabled, likely because your application is still in its loading phase.

    This method is meant to display text in the user locale, so calling it before the user locale has
    been set is likely to display text from the wrong locale to some users.

    If you have a legitimate reason to access i18n data outside of the user flow, you can do so by passing
    the desired locale explicitly with the `locale` argument, e.g. `I18n.#{method}(..., locale: :en)`
  MESSAGE
end