Skip to content

Conversation

@hatajoe
Copy link

@hatajoe hatajoe commented Apr 28, 2025

because of our test is failling with following error:

     I18n::InvalidPluralizationData:
       translation data {:other=>"ユーザー"} can not be used with :count => 1. key 'one' is missing.

because of our test is failling with following error:
```
     I18n::InvalidPluralizationData:
       translation data {:other=>"ユーザー"} can not be used with :count => 1. key 'one' is missing.
```
@JasonBarnabe
Copy link

Per https://www.unicode.org/cldr/charts/47/supplemental/language_plural_rules.html, Japanese does not have a "one" rule. I also see no error in my testing.

> I18n.t('activerecord.models.user', locale: :ja, count: 0)
=> "ユーザー"
> I18n.t('activerecord.models.user', locale: :ja, count: 1)
=> "ユーザー"
> I18n.t('activerecord.models.user', locale: :ja, count: 2)
=> "ユーザー"

@hatajoe
Copy link
Author

hatajoe commented Apr 28, 2025

Thank you for reply. We have no errors in rails console.
We encountered the error in our test since when we upgraded devise-i18n from v1.12.1 to v1.13.0.
So I suspected the change of ja.yml in v1.13.0, but I have no idea now.
I'll check it out when I have time.

@hatajoe
Copy link
Author

hatajoe commented May 1, 2025

We have no errors in rails console.

This was my bad.

I'm reproducing the error in my testing for devise-i18n v1.13.0.

****(dev)> I18n.t('activerecord.models.user', locale: :ja, count: 0)
=> "ユーザー"
****(dev)> I18n.t('activerecord.models.user', locale: :ja, count: 1)
(****):2:in `<main>': translation data {:other=>"ユーザー"} can not be used with :count => 1. key 'one' is missing. (I18n::InvalidPluralizationData)

              old_raise.call(*args, **kwargs)
                             ^^^^^^^^^^^^^^^
****(dev)> I18n.t('activerecord.models.user', locale: :ja, count: 2)
=> "ユーザー"

It also has the same error in ko locale which has no :one key in activerecord.models.user.

I had no error for devise-i18n v1.12.1.

****(dev)> I18n.t('activerecord.models.user', locale: :ja, count: 0)
=> "ユーザー"
****(dev)> I18n.t('activerecord.models.user', locale: :ja, count: 1)
=> "ユーザー"
****(dev)> I18n.t('activerecord.models.user', locale: :ja, count: 2)
=> "ユーザー"

Japanese does not have a "one" rule

That's right. I'm not sure but It could be an issue related to Rails I18n..?
I close this until the issue becomes clear. Sorry for taking your time.

@hatajoe hatajoe closed this May 1, 2025
@JasonBarnabe
Copy link

I have seen a similar issue for locales not defined by https://github.com/svenfuchs/rails-i18n - see ruby-i18n/i18n#706. But as I showed above, that does not include Japanese (or Korean) for me.

@hatajoe
Copy link
Author

hatajoe commented May 1, 2025

Sounds great. I pulled ruby-i18n/i18n#707 to my project, then my issue is solved.

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