-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
update I18n fallbacks configuration to be compatible with i18n 1.1.0 #33574
Conversation
r? @kamipo (@rails-bot has picked a reviewer for you, use r? to override) |
if args.empty? || args.first.is_a?(Hash) | ||
ActiveSupport::Deprecation.warn(<<-MSG.squish) | ||
Using I18n fallbacks with an empty `defaults` sets the defaults to | ||
include the `defalt_locale`. This behaviour will change in Rails 6.1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change behaviour
to behavior
per our documentation requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small typo in the defalt_locale
-> default_locale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eileencodes @Edouard-chin I have made the suggested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lsylvester I think you forgot to push.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelfranca Thanks for letting me know. Sorry about that. Should be fixed now.
7f47abd
to
21f4c13
Compare
* 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
* 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
21f4c13
to
66614f6
Compare
…our-to-match-i18n-1.1.0 update I18n fallbacks configuration to be compatible with i18n 1.1.0
…our-to-match-i18n-1.1.0 update I18n fallbacks configuration to be compatible with i18n 1.1.0
…our-to-match-i18n-1.1.0 update I18n fallbacks configuration to be compatible with i18n 1.1.0
Is there a way to silence this deprecation message if you want to opt-in to the new behaviour? |
Not really, but we should have. Can you take a look? Maybe we can add another config to disable that deprecation. |
@rafaelfranca See here: #35052 |
rails/rails#33574 update I18n fallbacks configuration to be compatible with i18n 1.1.0
update I18n fallbacks configuration to be compatible with i18n 1.1.0 rails/rails#33574 Describe how to silence the deprecation warning about empty I18n fallbacks rails/rails#35052
update I18n fallbacks configuration to be compatible with i18n 1.1.0 rails/rails#33574 Describe how to silence the deprecation warning about empty I18n fallbacks rails/rails#35052
* spotlight version updated to v2.2.0 * make several changes to fix the build, including updating our Rubocop todo, and requiring i18n < 1.1 as i18n introduced a backwards incompatible change with Rails (rails/rails#33574) * Updates our CI to build with Rails 5.2.1 * adds new locale files for Chinese and Italian languages * Update the PaperTrails versions table to be larger to accommodate large Spotlight::Page * Uses textarea for free form text input
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 orconfig.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.