Skip to content

Conversation

@fatkodima
Copy link
Contributor

See rails/rails#51253.

The output is confusing and always shows as an empty hash:

# In a rails app
config.i18n.fallbacks = { :'en-GB' => [:en], :'en-UK' => [:en], :'en-US' => [:en] }

I18n.fallbacks # => {}
I18n.fallbacks.class # => I18n::Locale::Fallbacks
I18n.fallbacks.instance_variable_get(:@map) # => {:"en-GB"=>[:en], :"en-UK"=>[:en], :"en-US"=>[:en]}

Should we also override empty? method?

@radar
Copy link
Collaborator

radar commented Mar 5, 2024

Yes, I think if empty? is acting in a "surprising" fashion, then we should fix it up here to behave as expected. Happy for you to add this in this PR too.


I noticed the build is failing and I'll get the workflows tidied up today in my own PR.

@fatkodima fatkodima force-pushed the add-inspect-to-fallbacks branch from 420b880 to aca633e Compare March 5, 2024 22:08
@fatkodima fatkodima changed the title Implement custom Fallbacks#inspect Implement Fallbacks#inspect and Fallbacks#empty? Mar 5, 2024
@fatkodima
Copy link
Contributor Author

Added empty? method.

@radar radar force-pushed the add-inspect-to-fallbacks branch from a818376 to aca633e Compare March 5, 2024 22:20
* master:
  Clearly specify which versions of Ruby + Rails we support
  Add back Ruby 3.0 support
  Use actions/checkout@v4, as Node 16 actions have been deprecated
  Bump Mocha deps to v2 to fix build issue
  Specify racc as a dependency
  Update workflows
@radar radar merged commit 5fb9e63 into ruby-i18n:master Mar 5, 2024
@radar
Copy link
Collaborator

radar commented Mar 5, 2024

Thank you!

@fatkodima fatkodima deleted the add-inspect-to-fallbacks branch March 5, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants