New issue

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

update I18n fallbacks configuration to be compatible with i18n 1.1.0 #33574

Merged
merged 1 commit into from Sep 6, 2018

Conversation

Projects
None yet
6 participants
@lsylvester
Contributor

lsylvester commented Aug 10, 2018

In I18n 1.1.0, there was a change to no longer include the default locale as a default fallback.

As a result, this broke the tests for Rails, and in #33566 we avoided using it in order to get the tests to pass again.

This PR attempt to provide a permanent solution for compatibility with I18n 1.1.0.

When config.i18n.fallbacks = true Rails would set the fallback defaults to [] relying on I18n to add the default locale into the fallbacks. As I18n no longer does this, Rails will now explicitly set the fallback defaults to the current locale.

Where config.i18n.fallbacks is a Hash or config.i18n.fallbacks.map is set, I18n would also be setting the default to the current locale, but that was not documented as part of Rails, and may have been unexpected behaviour. I have maintained this behaviour by explicitly adding in the current locale to the defaults, and added a depreciation message so that it can be removed in the future.

In the case were no fallbacks were configured Rails would not include the Fallbacks module in the backend, so it appears to behave correctly across both versions of i18n.

@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Aug 10, 2018

r? @kamipo

(@rails-bot has picked a reviewer for you, use r? to override)

rails-bot commented Aug 10, 2018

r? @kamipo

(@rails-bot has picked a reviewer for you, use r? to override)

Show outdated Hide outdated activesupport/lib/active_support/i18n_railtie.rb Outdated

mejackreed added a commit to projectblacklight/spotlight that referenced this pull request Aug 14, 2018

camillevilla added a commit to projectblacklight/spotlight that referenced this pull request Aug 14, 2018

additional fixes to resolve build errors (#2091)
* auto gen rubocop todo for latest updates

* Disable specify inverse_of rule for now, until further investigation

* pin i18n until Rails and i18n can sort out compatibility rails/rails#33574

cbeer added a commit to projectblacklight/spotlight that referenced this pull request Aug 15, 2018

additional fixes to resolve build errors (#2091)
* auto gen rubocop todo for latest updates

* Disable specify inverse_of rule for now, until further investigation

* pin i18n until Rails and i18n can sort out compatibility rails/rails#33574

@rafaelfranca rafaelfranca merged commit 62a0c30 into rails:master Sep 6, 2018

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

rafaelfranca added a commit that referenced this pull request Sep 6, 2018

Merge pull request #33574 from lsylvester/change-i18n-defaults-behavi…
…our-to-match-i18n-1.1.0

update I18n fallbacks configuration to be compatible with i18n 1.1.0

rafaelfranca added a commit that referenced this pull request Sep 6, 2018

Merge pull request #33574 from lsylvester/change-i18n-defaults-behavi…
…our-to-match-i18n-1.1.0

update I18n fallbacks configuration to be compatible with i18n 1.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment