Repository: WeblateOrg/weblate

Issue:
Problems with i18next v4 JSON format
### Describe the issue

When importing base language files from languages other that English plural forms are not extracted correctly to translation components from i18next v4 JSON files.

Example:
/ru/test.json (i18next v4 JSON):
```json
{
  "tags": {
    "show-more": {
      "plural_one": "Показать еще {{count}} тег",
      "plural_few": "Показать еще {{count}} тега",
      "plural_many": "Показать еще {{count}} тегов"
    }
  }
}
```
![2023-02-06_13-46](https://user-images.githubusercontent.com/9917883/216952723-2cfa5bf7-9514-443e-b0c2-4b0fc9246fcf.png)


As you can see in Weblate UI `plural_one` value is incorrectly mapped to to "few" plural form, "one" and "many" is missing, and "other" is used instead of "many".

Also "zero" special plural suffix currently suported in i18next v4 json is seems to be not supported in weblate at all (see i18next [documentation](https://www.i18next.com/translation-function/plurals#languages-with-multiple-plurals)) breaking any locale file using it.

### I already tried

- [X] I've read and searched [the documentation](https://docs.weblate.org/).
- [X] I've searched for similar issues in this repository.

### Steps to reproduce the behavior

_No response_

### Expected behavior

_No response_

### Screenshots

_No response_

### Exception traceback

_No response_

### How do you run Weblate?

Docker container

### Weblate versions

_No response_

### Weblate deploy checks

_No response_

### Additional context

_No response_


Discussion:
What version do you use? This should be already fixed in recent releases, see https://github.com/translate/translate/pull/4818
This issue looks more like a support question than an issue. We strive to answer these reasonably fast, but [purchasing the support subscription](https://weblate.org/support/) is not only more responsible and faster for your business but also makes Weblate stronger.

In case your question is already answered, [making a donation](https://weblate.org/donate/) is the right way to say thank you!
> What version do you use? This should be already fixed in recent releases, see [translate/translate#4818](https://github.com/translate/translate/pull/4818)

Version 4.15.2, deployed from docker just today.
Ah, the translate-toolkit with the fix was not yet released. You can try `bleeding` version of the container for now, see https://docs.weblate.org/en/latest/admin/install/docker.html#choosing-docker-hub-tag for info on tags.
I've just released and it will land in the Docker container soon: https://github.com/WeblateOrg/docker/pull/1729
The issue you have reported is now resolved. If you don’t feel it’s right, please follow its labels to get a clue for further steps.

* In case you see a similar problem, please open a separate issue.
* If you are happy with the outcome, don’t hesitate to support Weblate by making a [donation](https://weblate.org/donate/).
> I've just released and it will land in the Docker container soon: [WeblateOrg/docker#1729](https://github.com/WeblateOrg/docker/pull/1729)

@nijel 
Just tested it 4.16-dev version, the behavior is a little different but still broken.

Same JSON now result in this:
![2023-02-06_18-09](https://user-images.githubusercontent.com/9917883/217008302-d5ba4a19-0dc9-413f-923c-500d0e73f227.png)
"_one" form is mapped correctly, "_few" - is empty, "_many" - is missing from UI, "_other" - is present and empty.
i18next "_zero" suffix is still not supported and missing from UI.

It seems the issue is not resolved.
Can you please take a look at translate-toolkit version it uses? It is visible at `/about/` URL.
> Can you please take a look at translate-toolkit version it uses? It is visible at `/about/` URL.

translate-toolkit 3.8.3
similar bug 
translate-toolkit 3.8.4

test case

```json
{
  "promotetitle": "21232",
  "promotegift": "21232",
  "promoteendsinNdays": "21232",
  "promoteenddate": "21232",
  "promoteextradeal": "21232",
  "promotetagtext": "21232",
  "pormotebannertext": "21232",
  "pormotebannertimerange": "21232"
}
```



weblate :
![image](https://user-images.githubusercontent.com/11308261/217761751-45cffeb9-0f88-4c2b-990b-134cb7a41ffe.png)


wrong key / value 




@Timsonrobl 
> translate-toolkit 3.8.3

Okay, then the above linked fix is not included, you need 3.8.4 for it.

@uihoh0 
> similar bug

Please open a separate issue for that with clear description of how your translations are configured. That apparently has nothing to do with handling plurals.

@nijel 
Just tested it on version with translate-toolkit 3.8.4 and the result is exactly the same as before: only "_one" is mapped, "_many" field is missing, "_other" present and empty
I don't understand why "many" field is missing in the UI, even with the source mapping issue aside.
Most Slavic languages have "many" plural form according to ISO CLDR [Language Plural Rules](https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_plural_rules.html) but Weblate is displaying "other" instead of "many" for them.
Could this be the source of this issue? This doesn't explain why "few" isn't mapping correctly though.

Resolving patch:
diff --git a/weblate/trans/models/component.py b/weblate/trans/models/component.py
--- a/weblate/trans/models/component.py
+++ b/weblate/trans/models/component.py
@@ -3145,6 +3145,7 @@ def load_intermediate_store(self):
         """Load translate-toolkit store for intermediate."""
         return self.file_format_cls.parse(
             self.get_intermediate_filename(),
+            language_code=self.source_language.code,
             source_language=self.source_language.code,
         )
 
@@ -3164,6 +3165,7 @@ def load_template_store(self, fileobj=None):
         """Load translate-toolkit store for template."""
         return self.file_format_cls.parse(
             fileobj or self.get_template_filename(),
+            language_code=self.source_language.code,
             source_language=self.source_language.code,
             is_template=True,
         )


Test patch: