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
Native PO and MO pluralization #29963
Comments
Would you like to send a PR to achieve so? That'd be welcome and the best way to make it happen if you need it. |
I had a look at this issue for #eufossa |
Makes sense, please submit a PR if you think otherwise ;) I'm closing for now. |
I've now submitted a PR :) #31269 |
…tadly) This PR was submitted for the master branch but it was squashed and merged into the 4.4 branch instead (closes #31269). Discussion ---------- [Translator] Dump native plural formats to po files | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29963, #10152 | License | MIT | Doc PR | Implementing support for dumping to the native po plural format. ``` 'foo|foos' => 'bar|bars' ``` Before, the entry above was dumped directly: ``` msgid "foo|foos" msgstr "bar|bars" ``` With this PR, it is dumped using the native po plural format: ``` msgid "foo" msgid_plural "foos" msgstr[0] "bar" msgstr[1] "bars" ``` Strings using explicit rules or contain more than 2 pluralization forms are still dumped directly, as the po format does not support such cases: ``` '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars' ``` ``` msgid "{0} no foos|one foo|%count% foos" msgstr "{0} no bars|one bar|%count% bars" ``` This PR complements #31266, fixing loading of native po plural formats. Commits ------- dc31739 [Translator] Dump native plural formats to po files
The PO translation file format and MO translation file format natively support pluralization, making it easy to translate pluralizable strings using tools such as Poedit.
The PoFileLoader and MoFileLoader support the native pluralization.
The PoFileDumper and MoFileDumper, however, do not support the native pluralization. It would be really nice if this could be implemented.
The PO format is:
For example:
This works very well when the untranslated language only has two pluralization forms (singular and plural). The translated language can have more complex rules. I don't think the native pluralization can be used when the untranslated language has complex pluralization rules, or when using Explicit Interval Pluralization.
Note: It seems that the Qt format also support pluralization natively (
numerusform
). The QtFileDumper does not support this, and it doesn't seem that QtFileLoader does either.The text was updated successfully, but these errors were encountered: