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 (i18next v4) not working for Montenegrin #11197

Open
2 tasks done
dusan-smolnikar opened this issue Mar 13, 2024 · 8 comments
Open
2 tasks done

Plural rules (i18next v4) not working for Montenegrin #11197

dusan-smolnikar opened this issue Mar 13, 2024 · 8 comments
Labels
bug Something is broken.

Comments

@dusan-smolnikar
Copy link

Describe the issue

I am using i18next v4 json files for my translations. Among the languages I also have Montengrin (me.js)

In the file me.js I had a plural form of the following translation:
"episode_one": "{number} epizoda",
"episode_other": "{number} epizoda",
"episode_few": "{number} epizode",

However, Weblate for some reason requires the forms one, few, many:
Screenshot 2024-03-13 at 23 32 03

When I save this translation string I lose the episode_few key from my source file, but episode_one and episode_other are kept.

I already tried

  • I've read and searched the documentation.
  • I've searched for similar filed issues in this repository.

Steps to reproduce the behavior

  1. Import me.js with correct plural rules into weblate:
"episode_one": "{number} epizoda",
"episode_other": "{number} epizoda",
"episode_few": "{number} epizode",

Weblate requires me to write entries:

  • episode_one
  • episode_few
  • episode_many

Expected behavior

Weblate requires entering of

  • episode_one
  • episode_other
  • episode_few

Screenshots

Screenshot 2024-03-13 at 23 32 03

Exception traceback

No response

How do you run Weblate?

Other

Weblate versions

Weblate 5.3.1

Weblate deploy checks

No response

Additional context

No response

nijel added a commit to WeblateOrg/language-data that referenced this issue Mar 14, 2024
@nijel
Copy link
Member

nijel commented Mar 14, 2024

There are two issues here:

  1. translate-toolkit doesn't have a definition for this language (because it's not present in CLDR) and loads and saves only one/many.
  2. Weblate has wrong labels here. The reason is that it uses the same plural formula as other languages which have one/few/many. This is caused by Weblate not supporting decimals in plural formulas and I don't see an easy way to address this. But this is just a display issue (showing Many instead of Other) and doesn't affect saving.

@nijel nijel added the bug Something is broken. label Mar 14, 2024
@dusan-smolnikar
Copy link
Author

dusan-smolnikar commented Mar 14, 2024

Regarding no. 1 - Not sure if this info is helpful at all, but in the Unicode CLDR the language is defined as sr-Latn-ME. The plural rules are the same as for Serbian (sr). Is there a way I can configure language aliases to make Weblate believe this is Serbian language? However, I do have Serbian language separate though, and they shouldn't be mixed.

For no. 2 - It's not just a display issue. I entered all 3 values in Weblate and committed - But this resulted in translations being deleted in my git repository. The only workaround was to manually return the key/value pair and not touch this translation in Weblate.
Screenshot 2024-03-13 at 23 15 27

@nijel
Copy link
Member

nijel commented Mar 14, 2024

Writing is again caused by missing definitions in the translate-toolkit.

nijel added a commit to WeblateOrg/language-data that referenced this issue Mar 15, 2024
This makes it easier to deal with non-standard names of the files.

See WeblateOrg/weblate#11197
nijel added a commit to nijel/translate that referenced this issue Mar 15, 2024
This now includes CLDR and Weblate aliases to better deal with files not
using standard CLDR language codes. See
WeblateOrg/weblate#11197
@nijel
Copy link
Member

nijel commented Mar 15, 2024

translate/translate#5212 should address saving/loading part, let's keep this issue open for the display issue.

nijel added a commit to translate/translate that referenced this issue Mar 15, 2024
This now includes CLDR and Weblate aliases to better deal with files not
using standard CLDR language codes. See
WeblateOrg/weblate#11197
@dusan-smolnikar
Copy link
Author

Great, thanks!

@gs-xpeng
Copy link

We also met the similar issue :
We found that :

“aaaa”:"aaaa",
“aaaa_one”:"aaaa",
“aaaa_two”:"aaaa",
will keep the key “aaaa” stay only .

“aaaa”:"aaaa",
“aaaa_other”:"aaaa",
will keep the key “aaaa” stay only .

@gs-xpeng
Copy link

Is there any way to disable Plural rules ?

@nijel
Copy link
Member

nijel commented Apr 22, 2024

@gs-xpeng You can use "JSON file" instead, it will load all keys as they are.

The plural fix got finally released today at translate-toolkit: https://github.com/translate/translate/releases/tag/3.13.0

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

No branches or pull requests

3 participants