-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the underscore locale is included in i18n fallbacks
When a site has an underscore locale (e.g. "fr_BE") set as the default, it is not included in the I18n fallbacks for non-default locales. I18n.fallbacks # => { :fr_BE => [:fr_BE, :"fr-BE", :fr], # :nl_BE => [:nl_BE, :"fr-BE", :fr] } AlaveteliLocalization.with_locale(:fr_BE) { Globalize.fallbacks } # => [:fr_BE, :"fr-BE", :fr] AlaveteliLocalization.with_locale(:nl_BE) { Globalize.fallbacks } # => [:nl_BE, :"fr-BE", :fr] In the example above, this means that a missing model translation when using the "nl_BE" locale will **not** correctly fall back to the translation for the default locale ("fr_BE"). This commit ensures that the default locale is always available in the fallbacks for non-default locales. We try to add it before the non-underscore version so that the regional translation is preferred, with the non-regional fallback available as a last-ditch attempt to find a useful translation. Globalize model attributes fallbacks specs contributed by @gbp. Fixes #5382 Fixes #5895
- Loading branch information
1 parent
17d1443
commit bdf8423
Showing
8 changed files
with
154 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters