-
Notifications
You must be signed in to change notification settings - Fork 357
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
Fix I18n.load_path ordering conflicts with rails_i18n #489
Conversation
I've looked through the linked discussions and haven't really seen any movement on them recently. We've solved this for our own application by monkey patching |
@brianswko Thanks for the fix - we issued the same problem and your solution worked great. Are there any plans to merge it into master? |
poke @seejohnrun ☝🏻 |
This looks good to me @seejohnrun |
Thank you! Do you mind making a quick update to the |
So looks like this PR stuck only because missing record for CHANGELOG? |
Yes. welcome to open source development 😢 |
this just hit me by way of flaky test failures on ci. the problem is that the proper way would be to either
messed up load path:
|
ice_cube would inject its locale files at the end of I18n.load_path due to its I18n module being autoloaded and thereby overwrite any customisation the user may have made in other locale files earlier in the laod path. i fix this by injecting ice cube locales at gem load time so that the user has a chance to modify locale keys. this also eliminates a bunch of delegation having a custom I18n module; IceCube::I18n is just the same as ::I18n if the i18n gem is available. resolves ice-cube-ruby#489, ice-cube-ruby#432, ice-cube-ruby#431
ice_cube would inject its locale files at the end of `I18n.load_path` due to its `IceCube::I18n` module being `autoload`ed and thereby overwrite any customisation the user may have made in other locale files earlier in the load path. i fix this by injecting ice cube locales at gem load time so that the user has a chance to modify locale keys later. this also eliminates a bunch of delegation having a custom I18n module; `IceCube::I18n` is just the same as ::I18n if the i18n gem is available. resolves ice-cube-ruby#489, ice-cube-ruby#432, ice-cube-ruby#431
ice_cube would inject its locale files at the end of `I18n.load_path` due to its `IceCube::I18n` module being `autoload`ed and thereby overwrite any customisation the user may have made in other locale files earlier in the load path. i fix this by injecting ice cube locales at gem load time so that the user has a chance to modify locale keys later. this also eliminates a bunch of delegation having a custom I18n module; `IceCube::I18n` is just the same as ::I18n if the i18n gem is available. resolves ice-cube-ruby#489, ice-cube-ruby#432, ice-cube-ruby#431
ice_cube would inject its locale files at the end of `I18n.load_path` due to its `IceCube::I18n` module being `autoload`ed and thereby overwrite any customisation the user may have made in other locale files earlier in the load path. i fix this by injecting ice cube locales at gem load time so that the user has a chance to modify locale keys later. this also eliminates a bunch of delegation having a custom I18n module; `IceCube::I18n` is just the same as ::I18n if the i18n gem is available. resolves ice-cube-ruby#489, ice-cube-ruby#432, ice-cube-ruby#431
ice_cube would inject its locale files at the end of `I18n.load_path` due to its `IceCube::I18n` module being `autoload`ed and thereby overwrite any customisation the user may have made in other locale files earlier in the load path. i fix this by injecting ice cube locales at gem load time so that the user has a chance to modify locale keys later. this also eliminates a bunch of delegation having a custom I18n module; `IceCube::I18n` is just the same as ::I18n if the i18n gem is available. resolves ice-cube-ruby#489, ice-cube-ruby#432, ice-cube-ruby#431
* fix I18n.load_path injection ice_cube would inject its locale files at the end of `I18n.load_path` due to its `IceCube::I18n` module being `autoload`ed and thereby overwrite any customisation the user may have made in other locale files earlier in the load path. i fix this by injecting ice cube locales at gem load time so that the user has a chance to modify locale keys later. this also eliminates a bunch of delegation having a custom I18n module; `IceCube::I18n` is just the same as ::I18n if the i18n gem is available. resolves #489, #432, #431 * use __dir__ expansion instead of __FILE__ * disable linter for I18n gymnastics
Addresses #432 and #431
Since
ice_cube
's translation files are different from the defaults inrails-i18n
, the translations are incorrect whenice_cube
gets loaded.For example, in french for the abbreviated form of January:
rails-18n
usesjan.
https://github.com/svenfuchs/rails-i18n/blob/0cb422dc111b2dfa61a19b4740d04e72fb082d17/rails/locale/fr.yml#L23ice_cube
usesJan
https://github.com/seejohnrun/ice_cube/blob/d4443a29de12d277e04fede34df4d0e626a9634e/config/locales/fr.yml#L124When
ice_cube
gets loaded, it overrides the default resulting in incorrect formatting. This change checks for the presence ofrails_i18n
in the load path. If it exists, it insertsice_cube
's files before them so that conflicts get overridden by the defaults. Ifrails_i18n
is not in use, then they get added to the end of the load path.