[cfe-commits] r59803 - in /cfe/trunk:

Cédric Venet cedric.venet at laposte.net
Fri Nov 21 15:05:06 PST 2008


Sebastian Redl a écrit :
> Chris Lattner wrote:
>> On Nov 21, 2008, at 4:23 AM, Sebastian Redl wrote:
>>> I was planning to implement a modifier that works like this:
>>> "We have %0 %c0{1:mouse|:mice}"
>>> i.e. a simple case statement. ("case parameter 0 in") The modifer 
>>> picks an
>>> integral argument and executes the case. It could be more complicated 
>>> for
>>> languages that, say, have different forms for 0, 1, 2, and more cases:
>>> "%c0{0:something|1:somethingelse|2:yetanotherthing|:finaloption}"
>>
>> Sure, this works for me.  A few requests: please use a longer modifier 
>> name than "c" (I don't have any specific suggestions though).  My 
>> intent is for tricky things to use longer names (like 'select') and 
>> very few but common things to use short names like 's'.   Second, 
>> please consider supporting ranges: %whatever{3-7:blah}, so we can 
>> handle Polish:
>> http://www.gnu.org/software/automake/manual/gettext/Plural-forms.html
> Well, here's my patch. This was a fun little exercise. The modifier is 
> called plural, and the syntax is explained at length in the comments.
>> Third, please make sure you have a testcase for this so that we know 
>> if something breaks.
> I've got a small test program which uses a copy of the code, but how do 
> I add a proper test case for this feature? My small program isn't run as 
> part of the regressions, and is bound to go out of sync.
> 
> Sebastian

Hi,

Wouldn't it be better to have a translation specific describing the 
plural form instead of specifying it each time. Something like:

/// Polish
DEFINE_PLURAL_MODEL("{1:form0|:form1}");
DIAG(diag,"%0 %plural{form0|form1}0");

/// Polish
DEFINE_PLURAL_MODEL("{1:0|%100=(10,20):2|%10=(2,4):1|:2}");
DIAG(diag,"%0 %plural{form0|form1|form2}0");

for exception, we could style use your %case specifier.

just my 2cents

Cédric



More information about the cfe-commits mailing list