[GRASS5] PATCH: i.gensig

Glynn Clements glynn at gclements.plus.com
Fri Jul 22 23:25:25 EDT 2005


Daniel Calvelo Aros wrote:

> > > -    fprintf (stderr, "Calculating class covariance matri%s ...", S->nsigs==1?"x":"ces");
> > > +    G_message(_("Calculating class covariance matri%s ..."), 
> > > +              S->nsigs==1 ? "x" : "ces");
> 
> Please correct these to have two distinct strings in singluar and plural, e.g.
> 
> if( S->nsigs == 1 ){
>   G_message(_("Calculating class covariance matrix ..."));
> }else{
>   G_message(_("Calculating class covariance matrices ..."));
> }

In the general case, it's preferable to use a conditional expression
for the format string, i.e.:

  G_message(S->nsigs == 1
             ? _("Calculating class covariance matrix ...")
             : _("Calculating class covariance matrices ..."));

If the format string contains % specifiers and you are passing
arguments, you don't need to repeat the argument list for each case.

> Because: 
> 
> 1) Not every language has an easy suffix replacement plural/singular handling.
> E.g. in spanish you also need to change an article that doesn't exist in english.
> 
> 2) "x" and "ces" are not being translated.
> 
> 3) It's not at all obvious in the .po file what "... matri%s" corresponds to.
> 
> There are three or four occurences of this trick.

All good points:

Just in case it isn't clear: don't try to "construct" sentences with
printf(). This isn't limited to singular/plural forms, but also to
negatives (e.g. foo("X %s Y", test ? "is" : "is not")) and
alternatives (e.g. foo("X is %s", test ? "on" : "off")).

The problem is that trying to translate individual words, devoid of
context, is almost impossible. It needs to be borne in mind that any
given string can only have one translation in a module[1]. If you try
to translate individual words (particularly essential verbs such as
"is" or "has", or prepositions), you can easily end up with
conflicting translations.

[1] In this case, "module" means a text domain, i.e. either
"grasslibs" or "grassmods".

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list