Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Firefox OS plural forms

2 views
Skip to first unread message

Mihovil Stanic

unread,
Oct 25, 2014, 2:07:45 PM10/25/14
to dev-...@lists.mozilla.org
Hello all,

How do I use plural forms in FFOS?

On this link:
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_best_practices#Use_proper_plural_forms

Example says:
delete-cookies = {[ plural(n) ]}
delete-cookies[zero] = Delete {{ n }} cookies
delete-cookies[one] = Delete {{ n }} cookie
delete-cookies[two] = Delete {{ n }} cookies
delete-cookies[few] = Delete {{ n }} cookies
delete-cookies[many] = Delete {{ n }} cookies
delete-cookies[other] = Delete {{ n }} cookies

Problem is, I don't know what "few", "many" and "other" means. Also, I
don't know how "two" applies to my language (croatian HR).
As seen here,
https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#Plural_rule_.237_.283_forms.29
,
croatian has 3 plural rules.

1 and everything ending with 1, except 11.
2-4 and everything ending with 2-4 except 12, 13 and 14.
0 and everything else.

How do I fit those 3 rules into all those FFOS categories!?

Best regards,
Mihovil

Francesco Lodolo [:flod]

unread,
Oct 25, 2014, 3:06:50 PM10/25/14
to Mozilla l10n Mailing List
Hi Mihovil,
I'm not sure if there's documentation available about Firefox OS plural
forms (I'll ask on Monday).

In any case, for Croatian the mapping should be this:

- ends in 1, excluding 11: [one]
- ends in 2-4, excluding 12-14: [few]
- everything else: [many]

There are 2 other forms that needs to be localized (as explained in that
document, you need to fill all the forms, even if your locale has less):

- [zero] is often a special case, like "no message selected" without the
number
- [other] is usually the default fallback, in your case it will be the
same as [many]

All this based on the l10n.js code (rule for hr is #11)
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/l10n.js#L405-L418

Francesco
> _______________________________________________
> dev-l10n mailing list
> dev-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-l10n
>

Michael Wolf

unread,
Oct 25, 2014, 3:55:32 PM10/25/14
to
Mihovil Stanic schrieb:
> As seen here,
> https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals#Plural_rule_.237_.283_forms.29
> ,
> croatian has 3 plural rules.
>
> 1 and everything ending with 1, except 11.
> 2-4 and everything ending with 2-4 except 12, 13 and 14.
> 0 and everything else.
>
> How do I fit those 3 rules into all those FFOS categories!?

Hello Mihovil,

the Firefox OS plural rules are based on CLDR:

http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html


Regards,

Michael

Mihovil Stanic

unread,
Oct 27, 2014, 4:23:33 PM10/27/14
to dev-...@lists.mozilla.org
Francesco, Michael,

Thank you for reply.
I checked source code Francesco linked and only 1, few, many are
mentioned (and others as exception).
I have one more question.
http://mozilla.locamotion.org/hr/firefoxos_2.1/translate/apps/email/email.properties.po#unit=7806513

In english there is explicitly number 1 in string. Since in croatian
this plural form is not only for 1, it's also for 21, 31, 41... I
replaced number 1 with {{ n }}. Hope that's correct and won't break
anything.

Mihovil

26.10.2014. u 20:00, dev-l10n...@lists.mozilla.org je napisao/la:
> Date: Sat, 25 Oct 2014 21:06:41 +0200
> From: "Francesco Lodolo [:flod]" <fl...@lodolo.net>
> To: Mozilla l10n Mailing List <dev-...@lists.mozilla.org>
> Subject: Re: Firefox OS plural forms
> Message-ID:
> <CAGB+t-eApyNiC7urx=XroA-BPX641q5CaX...@mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8

Francesco Lodolo [:flod]

unread,
Oct 27, 2014, 4:32:56 PM10/27/14
to Mozilla l10n Mailing List
If you look at the 1st string of the group, you'll see the name of the
variable used and you can add it to your plural forms.

In this case is 'n' (the most common)
https://hg.mozilla.org/gaia-l10n/en-US/file/86f3073e71a1/apps/sms/sms.properties#l7

But in this case is 'value'
https://hg.mozilla.org/gaia-l10n/en-US/file/86f3073e71a1/apps/system/system.properties#l489

Franesco



2014-10-27 21:22 GMT+01:00 Mihovil Stanic <moz...@miho.im>:

> Francesco, Michael,
>
> Thank you for reply.
> I checked source code Francesco linked and only 1, few, many are mentioned
> (and others as exception).
> I have one more question.
> http://mozilla.locamotion.org/hr/firefoxos_2.1/translate/
> apps/email/email.properties.po#unit=7806513
>
> In english there is explicitly number 1 in string. Since in croatian this
> plural form is not only for 1, it's also for 21, 31, 41... I replaced
> number 1 with {{ n }}. Hope that's correct and won't break anything.
>
> Mihovil
>
> 26.10.2014. u 20:00, dev-l10n...@lists.mozilla.org je napisao/la:
>
>> Date: Sat, 25 Oct 2014 21:06:41 +0200
>> From: "Francesco Lodolo [:flod]" <fl...@lodolo.net>
>> To: Mozilla l10n Mailing List <dev-...@lists.mozilla.org>
>> Subject: Re: Firefox OS plural forms
>> Message-ID:
>> <CAGB+t-eApyNiC7urx=XroA-BPX641q5CaX-zrPTxKXFdRffp_w@
>> mail.gmail.com>
>> Content-Type: text/plain; charset=UTF-8
>>
>> Hi Mihovil,
>> I'm not sure if there's documentation available about Firefox OS plural
>> forms (I'll ask on Monday).
>>
>> In any case, for Croatian the mapping should be this:
>>
>> - ends in 1, excluding 11: [one]
>> - ends in 2-4, excluding 12-14: [few]
>> - everything else: [many]
>>
>> There are 2 other forms that needs to be localized (as explained in that
>> document, you need to fill all the forms, even if your locale has less):
>>
>> - [zero] is often a special case, like "no message selected" without
>> the
>> number
>> - [other] is usually the default fallback, in your case it will be the
>> same as [many]
>>
>> All this based on the l10n.js code (rule for hr is #11)
>> https://github.com/mozilla-b2g/gaia/blob/master/shared/
>> js/l10n.js#L405-L418
>>
>> Francesco
>>
>>
>>
>>

Michael Wolf

unread,
Oct 27, 2014, 4:42:57 PM10/27/14
to
Mihovil Stanic schrieb:
> Francesco, Michael,
>
> Thank you for reply.
> I checked source code Francesco linked and only 1, few, many are
> mentioned (and others as exception).
> I have one more question.
> http://mozilla.locamotion.org/hr/firefoxos_2.1/translate/apps/email/email.properties.po#unit=7806513
>
>
> In english there is explicitly number 1 in string. Since in croatian
> this plural form is not only for 1, it's also for 21, 31, 41... I
> replaced number 1 with {{ n }}. Hope that's correct and won't break
> anything.

Yes, that's correct. It is like Francesco has written. I translate into
Upper and Lower Sorbian and there the rule for "1" is as follows: 1,
101, 201, 301, 401 etc.

Regards,
Michael



0 new messages