8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
Is there a way to fallback the missing translations to the primary_locale?
Let's say I've the following primary locale:
foo: example: "Baz"
When I create a new locale file dynamically, let's say:
bar: {}
I'd like to fallback example from foo locale when it's called in the context of bar
example
foo
bar
<%= t('.bar.example') %> # I want this to return "Baz"
Does anybody know if this is possible?
Thanks in advance
The text was updated successfully, but these errors were encountered:
Using a custom exception handler
module I18n class CustomExceptionHandler < ExceptionHandler def call(exception, locale, key, options) if exception.is_a?(MissingTranslation) && key.to_s != 'i18n.plural.rule' if I18n.default_locale.to_s == locale.to_s raise exception.to_exception else I18n.t(key, locale: I18n.default_locale) end else super end end end end I18n.exception_handler = I18n::CustomExceptionHandler.new
OR using built in fallbacks functionality
https://github.com/ruby-i18n/i18n/wiki/Fallbacks
Sorry, something went wrong.
No branches or pull requests
Hi,
Is there a way to fallback the missing translations to the primary_locale?
Let's say I've the following primary locale:
When I create a new locale file dynamically, let's say:
I'd like to fallback
example
fromfoo
locale when it's called in the context ofbar
Does anybody know if this is possible?
Thanks in advance
The text was updated successfully, but these errors were encountered: