[Chandler-dev] [I18N/L10N] Interesting post about plural forms

Brian Kirsch bkirsch at osafoundation.org
Mon Dec 3 11:29:22 PST 2007


Ah yes plurals!

Certainly it is challenging to try and capture language semantics in  
an easy modifiable way.

The best option I have seen so far with in the Chandler libraries is  
the PyICU ChoiceFormat class.

I use it in the mail service to format numeric variations in English  
strings.

For example:

DOWNLOAD_START_MESSAGES = ChoiceFormat(_(u"1#%(accountName)s:  
Downloading %(numberOfMessages)s message...|1<%(accountName)s:  
Downloading %(numberOfMessages)s messages..."))


The above statement says if the value passed to the ChoiceFormat is 1  
then use:

%(accountName)s: Downloading %(numberOfMessages)s message...


Otherwise:

%(accountName)s: Downloading %(numberOfMessages)s messages...

Note that in this case 0 or any negative numbers are not going to be  
passed to the ChoiceFormat.

Since the entire ChoiceFormat string appears in the localizers po  
file, he or she is free
to add language specific numeric string variations to the translation.


-Brian



On Dec 2, 2007, at 10:14 PM, Philippe Bossut wrote:

> Interesting. Note that they're wrong saying that semitic languages  
> have only 2 forms. Arabic at least has 3: singular, dual (for 2 of  
> something) and plural. Hebrew also but only some nouns have the  
> dual form. Apparently, the GNU still needs a couple more iterations...
>
> Cheers,
> - Philippe
>
> Heikki Toivonen wrote:
>> http://ed.agadak.net/2007/12/one-potato-two-potato-three-potato-four
>>
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>
> Open Source Applications Foundation "chandler-dev" mailing list
> http://lists.osafoundation.org/mailman/listinfo/chandler-dev



More information about the chandler-dev mailing list