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

Plural rules not working properly with specific numbers. #734

Open
bwprado opened this issue Aug 18, 2023 · 1 comment
Open

Plural rules not working properly with specific numbers. #734

bwprado opened this issue Aug 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@bwprado
Copy link

bwprado commented Aug 18, 2023

Version

5.26.1

Describe the bug

When using typesafe-i18n with React.js and importing LL class for text translations for itens with plural rules, some numbers above 0 are not recognized as plural, for example:

<LineLabel> {LL.fit.programsPage.item.numberOfWorkouts(workoutsLength as number)} </LineLabel>

numberOfWorkouts: '{{ No workouts | 1 workout | ?? workouts }}',

This should return No workouts for 0 workoutsLength, 1 workout for 1 workoutsLength and any other number above 2 should return number workouts.

And it does for a variaty of numbers, but every number that ends with 1 or 2 (above 20) is either 1 workout or workouts (without the number)

Reproduction

React component:

const workouts = 21
return (
      <div>
            {LL.numberOfWorkouts(workouts)}
      </div>
)

Translation:

numberOfWorkouts: '{{ No workouts | 1 workout | ?? workouts }}',

Logs

There are no logs.

Config

{
   "baseLocale": "br",
   "adapter": "react",
   "$schema": "https://unpkg.com/typesafe-i18n@5.24.3/schema/typesafe-i18n.json"
}

Additional information

No response

@bwprado bwprado added the bug Something isn't working label Aug 18, 2023
@ivanhofer
Copy link
Owner

Can you please share a repo where I can reproduce this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants