-
Notifications
You must be signed in to change notification settings - Fork 360
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
Remove "overriding" translation keys #432
Remove "overriding" translation keys #432
Conversation
… translations from the commonly used I18n systems.
@MGPalmer thanks! do you mind adding a test or two to make sure formats can differ between locales? I'm unsure if they already exist |
Hmm I'm not 100% sure I understand what you'd like me to test... However, looking over the code and specs, it seems to me like only the ice_cube....formats.default is being used, and that is pretty well tested. In fact, setting a different to_s format seems broken:
Maybe because the instance variable set is not actually used in this getter:
but that's a different ticket ;) |
Yes, it looks like that setting was just left behind after translations were added. We should remove since it does nothing, but that could break code which actually sets it, so it should have a deprecation first. |
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.
Thanks for this!
Unfortunately, I'm not sure if we can use this approach since those default values come from a rails gem, which would make us dependent on loading all of rails:
- https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/de.yml#L42
- https://github.com/svenfuchs/rails-i18n/blob/master/lib/rails_i18n/railtie.rb#L1
It would be nice to use those strings, but we would like to avoid this dependency if possible. (I suspect there's a way to reuse them without a runtime gem dependency.)
The real problem is that previously, the load order was causing other problems and now it sounds like we are overwriting these fields the wrong way. I will take another look at the c7b305c commit which broke this.
config/locales/fr.yml
Outdated
default: "%a, %d %b %Y %H:%M:%S %z" | ||
long: "%d %B %Y %H:%M" | ||
short: "%d %b %H:%M" | ||
pm: pm |
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.
👮 dropped line ending at EOF
Also I'm surprised why the test suite is all green here with these removed... something to look into. I'm still not 100% on this: do all users who use i18n use it with i18n-rails anyway? |
I might be mistaken, but my guess is that the format keys I've removed have not actually been used in ice_cube.
This would of course be my favorite solution! |
…ed_on_upstream_master
This will be resolved by #489 |
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
Refs #431
All specs still pass, and this solves my overriding problem :)