-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Translator] Load plurals from po files properly #31266
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Apr 26, 2019
fabpot
reviewed
May 1, 2019
fabpot
approved these changes
Jul 8, 2019
Thank you @Stadly. |
fabpot
added a commit
that referenced
this pull request
Jul 8, 2019
This PR was squashed before being merged into the 3.4 branch (closes #31266). Discussion ---------- [Translator] Load plurals from po files properly | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10152 (comment) | License | MIT | Doc PR | Plurals were not handled correctly when loading po files. ``` msgid "foo" msgid_plural "foos" msgstr[0] "bar" msgstr[1] "bars" ``` Before, the po entry above was treated as two entries, which doesn't make sense: ``` 'foo' => 'bar' 'foos' => 'bar|bars' ``` With this PR, it is treated as one entry: ``` 'foo|foos' => 'bar|bars' ``` Commits ------- 6b69a99 [Translator] Load plurals from po files properly
fabpot
added a commit
that referenced
this pull request
Jul 8, 2019
This PR was merged into the 3.4 branch. Discussion ---------- [Translator] Load plurals from mo files properly | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #10152 (comment) | License | MIT | Doc PR | Plurals were not handled correctly when loading mo files. ``` msgid "foo" msgid_plural "foos" msgstr[0] "bar" msgstr[1] "bars" ``` Before, the mo entry above was treated as two entries, which doesn't make sense: ``` 'foo' => 'bar' 'foos' => '{0} bar|{1} bars' ``` With this PR, it is treated as one entry: ``` 'foo|foos' => 'bar|bars' ``` This PR does the same as #31266, just for mo files instead of po files. Note, however, that the old behavior differed between po and mo files: `'foos' => 'bar|bars'` for po files and `'foos' => '{0} bar|{1} bars'` for mo files. Commits ------- 97d28b5 Load plurals from mo files properly
fabpot
added a commit
that referenced
this pull request
Jul 8, 2019
…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
This was referenced Jul 27, 2019
Merged
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plurals were not handled correctly when loading po files.
Before, the po entry above was treated as two entries, which doesn't make sense:
With this PR, it is treated as one entry: