Closed
Bug 1415844
Opened 7 years ago
Closed 6 years ago
PLURALS should be aware of PluralRules.jsm's ordering of variants
Categories
(Localization Infrastructure and Tools :: Fluent Migration, enhancement)
Localization Infrastructure and Tools
Fluent Migration
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: stas, Assigned: Pike)
References
Details
Attachments
(1 file, 1 obsolete file)
Certain plural rules defined in PluralRules.jsm list their categories in a different order than CLDR (of course they do...). Latvian is one example: - PluralRules.jsm: one, zero, other [1] - CLDR: zero, one, other [2] The PLURALS transforms should be aware of the differences and migrate variants in the proper order. [1] https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#Plural_rule_6_(3_forms) [2] http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html#lv
Assignee | ||
Comment 1•7 years ago
|
||
stas, do we know which milestone or prefs bugs this blocks yet?
Flags: needinfo?(stas)
Reporter | ||
Comment 2•7 years ago
|
||
We don't know yet. I think we'll need this as soon as a single migrated string uses plurals. Zibi, would you help me set the dependencies right here? Which dependencies of bug 1415730 will require PluralRules?
Flags: needinfo?(stas) → needinfo?(gandalf)
Comment 3•6 years ago
|
||
I don't have an answer yet (keeping NI on me). I know that chrome (first milestone) doesn't, and that containers does. I'm not sure yet what will be the second milestone, but I expect General pane to go next and I didn't write a preliminary patch there yet so don't know if we'll need plurals there.
Comment 4•6 years ago
|
||
Preferences::General XUL part is the first patch that will be blocked by this (bug 1435912). Setting.
Blocks: 1435912
Flags: needinfo?(gandalf)
Reporter | ||
Comment 5•6 years ago
|
||
(In reply to Staś Małolepszy :stas from comment #0) > Certain plural rules defined in PluralRules.jsm list their categories in a > different order than CLDR (of course they do...). Latvian is one example: > > - PluralRules.jsm: one, zero, other [1] > - CLDR: zero, one, other [2] Actually, this is not a good example. The plural categories for Latvian in PluralForm.jsm are (zero, one, other), the same as CLDR.
Reporter | ||
Comment 6•6 years ago
|
||
Lithuanian and Arabic are good examples. flod dug into Lithuanian and produced the following summary. Thanks, flod! I also verified this with Rimas on IRC. Gecko ----- https://searchfox.org/mozilla-central/source/intl/locale/PluralForm.jsm#56 (n) => n%10==1&&n%100!=11?0:n%10>=2&&(n%100<10||n%100>=20)?2:1 1st form (#0): anything ending in 1, but not 11 2nd form (#1): all the other numbers not covered by #0 and #1 3rd form (#2): ends in 2-9 or 22-99, excluding numbers ending with 1 In CLDR-speak, the order here is (one, other, few), which gives: downloadMessage.deleteAll = Pašalinti #1 atsiuntimą?;Pašalinti #1 atsiuntimų?;Pašalinti #1 atsiuntimus? CLDR ---- http://www.unicode.org/cldr/charts/dev/supplemental/language_plural_rules.html#lt 1st form (one): n % 10 = 1 and n % 100 != 11..19 (anything ending in 1, but not 11) 2nd form (few): n % 10 = 2..9 and n % 100 != 11..19 (ends in 2-9 or 22-99, not covered by 'one') 3rd form (other): any other number The correct Fluent message should thus read: delete-all = { $count -> [one] Pašalinti { $count } atsiuntimą? [few] Pašalinti { $count } atsiuntimus? *[other] Pašalinti { $count } atsiuntimų? }
Reporter | ||
Comment 7•6 years ago
|
||
The goal of this bug is the change the migration code such that when a string like downloadMessage.deleteAll is migrated to Fluent in Lithuanian, the first part of the legacy string is assigned to the [one] variant, the second part is assigned to the [other] variant, and the third part is assigned to the [few] variant. Additionally, we should make sure we choose the default variant well. Right now, the last form as defined in .properties is used as the default. Instead, I suggest that we use 'other' and if it doesn't exist, we use 'many'. According to https://hg.mozilla.org/l10n/compare-locales/file/tip/compare_locales/plurals.py all Gecko plural forms have at least one of these categories.
Reporter | ||
Comment 8•6 years ago
|
||
If anyone's interested in moving this forward, I submitted a PR with a test.
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → l10n
Assignee | ||
Comment 9•6 years ago
|
||
Moving over to compare-locales to map gecko to cldr plurals. The tricky piece here is where to put the default variant in the case where the legacy translation doesn't have enough variants. Different stages of this PR implement different strategies: 1. use the last variant in cldr order, and make that default 2. copy the last variant in cldr order to the default cldr order, and make that default.
Attachment #8949702 -
Attachment is obsolete: true
Assignee | ||
Updated•6 years ago
|
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•6 years ago
|
No longer blocks: fluent.migrate
Component: Python Library → Fluent Migration
Product: L20n → Localization Infrastructure and Tools
You need to log in
before you can comment on or make changes to this bug.
Description
•