Open rhofer opened 5 years ago
Should Weblate consider the case where messageformat keys are used only for part of the string, for example with {count, plural, one{One year} other{# years}} ago
? What about strings controlled by more than one plurals?
MessageFormat people seems to think that it is a good idea, at least with the myriad possible plural or gender input combinations required. This would mean a very different UI: instead of giving one input boxes for each plural form, Weblate will need to come up with something that lets the user deal with this complexity, preferably visually. For now we can, of course, just treat these as any other variable format string and check for them as such...
First step should be syntax validation. That way we ensure that translators get correct feedback in case they mess up something. The similar feature will be needed for Fluent (see https://github.com/WeblateOrg/weblate/issues/1926), but using different syntax.
The UI might come later, once we switch to some rich editor (what is needed for things like https://github.com/WeblateOrg/weblate/issues/1930 or https://github.com/WeblateOrg/weblate/issues/443).
There is even existing Python parser for the syntax: https://github.com/rolepoint/pyseeyou
The pyseeyou grammar has lagged quite a bit compared to the js messageformat PEG. Among other things, we are likely to bump into problems with escapes and general function formatters. There is also a new ordinal class to take care of (I think.) I was planning to update it.
Thanks for insight, I just found this library when looking for something else and did not investigate it at all. For the reference the related issue is https://github.com/rolepoint/pyseeyou/issues/11
See also #2856
Any news regarding #3286 ?
ICU support is being developed in #2856, that could be baseline for implementing this.
Situation
Having angular applications where ngx-translate is used as translation handler, the basic JSON output is used as translation resource. This itself does not support pluralization. Therefore, plug-ins are available to properly handle this based on ICU MessageFormat.
Request
In order to use ngx-translate with proper pluralization, the schema needs to follow MessageFormat according ICU. Reference:
Example
English source
Czech translation
Requires
Follow-up to #2855