[cfe-dev] Diagnostic Improvements

Gordon Henriksen gordonhenriksen at me.com
Tue Nov 18 10:20:35 PST 2008


On 2008-11-18, at 11:25, Nuno Lopes wrote:

>> DIAG(err_operator_overload_must_be_binary, ERROR,
>>     "overloaded '%0' must be a binary operator (has %u1 parameter
>> %up1)")
>>
>> Where %u1 prints the unsigned, and %up1 (p=plural, or pick a better  
>> letter) prints a "s" if the unsigned is != 1, or nothing if it is.
>>
>> Does this seem like a reasonable thing to do?  Does anyone  
>> volunteer to start tackling it?
>
> Well, if you really want to have good localization, you simply can't  
> do it. Plural is very tricky is other languages than English. Even  
> in english you've many exceptions (e.g. one mouse -> two mice; one  
> child -> two children; etc..). In German it's very complex: there  
> are 7 different rules (AFAIR) and tons of exceptions, so.. Not  
> really important, but I though I could share this info before you  
> make any decision.

Sure you can, it just involves giving the format specifier more  
control. e.g., create a localization DSL so that during localization,  
"parameter(s)" can be expressed correctly as "if (n = 1) then  
'parameter' else 'parameters'" [*].

— Gordon


* Not a proposed syntax.



More information about the cfe-dev mailing list