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

[BUG] Following Symbols doesn't work with Pluralization lookup #635

Closed
movermeyer opened this issue Aug 23, 2022 · 0 comments · Fixed by #636
Closed

[BUG] Following Symbols doesn't work with Pluralization lookup #635

movermeyer opened this issue Aug 23, 2022 · 0 comments · Fixed by #636

Comments

@movermeyer
Copy link
Contributor

movermeyer commented Aug 23, 2022

What I tried to do

I'm creating an issue to capture the problem laid out in #480 by @Tietew

Using links/Symbols/aliases (whatever you call 'em) and pluralization (i.e., count) doesn't work.

autos: :cars
cars: 
  porsche:
    one: "I have %{count} Porsche 🚗"
    other: "I have %{count} Porsches 🚗"
I18n.t(:'autos.porsche', count: 1)

What I expected to happen

"I have 1 Porsche 🚗"

What actually happened

I18n::InvalidPluralizationData: translation data {:porsche=>{:one=>"I have %{count} Porsche 🚗", :other=>"I have %{count} Porsches 🚗"}} can not be used with :count => 1. key 'one' is missing.

What is happening?

The issue is occurring in the lookup of the linked data.

Since all the original parameters are passed into the sublookup, including count, it is attempting to perform the pluralization lookup prior to returning the resolved value and failing.

History of this issue

Q&A

Q: Why wasn't this noticed by the tests when the changes to Backend::Pluralization were reverted?

A: There was no test with both symbol resolution and pluralization in the Backend::Pluralization tests.

The #480 changes were reverted, but not the #503 changes, so the test added in #480 for Backend::Base didn't start failing.

Versions of i18n, rails, and anything else you think is necessary

i18n 1.12.0 (and many prior versions)
movermeyer added a commit to movermeyer/i18n that referenced this issue Aug 23, 2022
@radar radar closed this as completed in #636 Oct 6, 2022
movermeyer added a commit to movermeyer/i18n that referenced this issue Oct 7, 2022
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 a pull request may close this issue.

1 participant