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 broke after adding new language #2949

Open
viktorisacenko opened this issue Feb 26, 2025 · 1 comment
Open

Plural broke after adding new language #2949

viktorisacenko opened this issue Feb 26, 2025 · 1 comment

Comments

@viktorisacenko
Copy link

viktorisacenko commented Feb 26, 2025

After adding a new language to an existing project, the plural properties are not the same and its not possible to add new ones (one, two, more ...)

  1. Create language (e.g. de, en ....)
  2. Add keys and translate with plural (one, two, more)
  3. Add new language (e.g. es-MX)
  4. Activate this language in translations
  5. Go to the key with (one, two, more)
  6. Click on this new created language
  7. Plural is broken, 'two' is missing on this language but exists on other language
    • Sorting of the plurals should be more logically (instead of. one, more, two. -> one, two, more.... , other)

Expected behavior
-> Plurals should be the same if new language is created after the keys are set.
-> It should be possible to add keywords (one, two, more, other....) in the web ui

-> It should be also possible to add more then 1 variables, because its possible to add these inside the code. (If added in web ui but not in code, then should be an error thrown)

Image
Image

Versions and environment

  • Tolgee Platform: Version: v3.105.1
  • Environment: Docker
  • Browser: Chrome
  • "@tolgee/vue": "^6.2.1",
@stepan662
Copy link
Contributor

stepan662 commented Feb 26, 2025

Hey, what you are reporting is actually an intended behavior.

The logic is following:

  1. By default we only show fields which are defined for the given language, according to this table https://www.unicode.org/cldr/charts/46/supplemental/language_plural_rules.html
  2. If the raw ICU value contains other varians we display them as well (below the official ones - thats why two is on the bottom), however it's currently not possible to add them in the UI

If you want to have some more advanced logic, I recommend using separate keys and decide which one to use in the code. Usage of unsupported plural variants can be a bit tricky because it doesn't directly map to the numbers. In some languages for example one can include both 0 and 1. So it's good to separate the "plural logic" from "business logic".

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

No branches or pull requests

2 participants