Skip to content
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

I18n::InvalidPluralizationData (translation data {:one=>"tenth", :other=>"tenths"} #167

Open
touch-dev-null opened this issue Nov 4, 2019 · 7 comments
Labels

Comments

@touch-dev-null
Copy link

Hello,

Have an issue with EN translation, please see an example:

irb(main):016:0> I18n.with_locale(:ru) { (3.75).to_words }
=> "три целых и семьдесят пять сотых"

irb(main):017:0> I18n.with_locale(:fr) { (3.75).to_words }
=> "trois et soixante-quinze centièmes"

irb(main):018:0> I18n.with_locale(:ua) { (3.75).to_words }
=> "три цiлих i сiмдесят п’ять сотих"

irb(main):019:0> I18n.with_locale(:en) { (3.75).to_words }
Traceback (most recent call last):
        2: from (irb):19
        1: from (irb):19:in `block in irb_binding'
I18n::InvalidPluralizationData (translation data {:one=>"hundredth", :other=>"hundredths"} can not be used with :count => 75. key 'many' is missing.)
irb(main):020:0> 
@jlduran
Copy link
Collaborator

jlduran commented Nov 4, 2019

Hi!

I haven't been able to reproduce it. Do you mind sharing your installed gem versions?:

>> I18n.with_locale(:en) { (3.75).to_words }
=> "three and seventy-five hundredths"
>> NumbersAndWords::VERSION
=> "0.11.6"
>> I18n::VERSION
=> "1.7.0"

@touch-dev-null
Copy link
Author

touch-dev-null commented Nov 5, 2019

The same for me:

irb(main):006:0> NumbersAndWords::VERSION
=> "0.11.6"
irb(main):007:0> I18n::VERSION
=> "1.6.0"

Also, I have found one thing - this error happened for me only in staging and production Rails environments. In development all works as expected:

Loading production environment (Rails 5.2.3)
2.6.3 :001 > Rails.env
 => "production" 
2.6.3 :002 > I18n.with_locale(:en) { (3.75).to_words }
Traceback (most recent call last):
        2: from (irb):2
        1: from (irb):2:in `block in irb_binding'
I18n::InvalidPluralizationData (translation data {:one=>"hundredth", :other=>"hundredths"} can not be used with :count => 75. key 'many' is missing.)
Loading development environment (Rails 5.2.3)
2.6.3 :001 > Rails.env
 => "development" 
2.6.3 :002 > I18n.with_locale(:en) { (3.75).to_words }
 => "three and seventy-five hundredths" 

Do you know how is it possible?

@dblock
Copy link
Collaborator

dblock commented Nov 5, 2019

There's a difference with localization data in those environments. Try to put up a project where this is reproducible that we can play with?

@dblock dblock added the bug? label Nov 5, 2019
@touch-dev-null
Copy link
Author

Sorry, it is private repo, I can`t share it.

I created new clean rails app and tested it - it is working without exceptions both for prod and dev o_O

Also, in my project, it started to work without exception when I changed

config.i18n.fallbacks = true

on

config.i18n.fallbacks = false

into config/environtments/production.rb

@dblock
Copy link
Collaborator

dblock commented Nov 5, 2019

That's what I am saying, you have something in your en.yml that cannot be found, while it works for other languages. Try to drop two of your .yml's into the test Rails app?

@touch-dev-null
Copy link
Author

Interesting, I reverted config.i18n.fallbacks to the true again and cleaned up all yml files in config/locales and an exception was reproduced.

Also, I tried to disable most of gems which I am using in my app without any luck.

Will try to find the issue reason and update you.

@jlduran
Copy link
Collaborator

jlduran commented Nov 9, 2019

I wonder if it is related to ruby-i18n/i18n#401

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants