Maketext library

Paolo Bonzini bonzini at gnu.org
Mon Oct 15 07:16:56 UTC 2007


> Doesn't gettext handle the plural forms by making you put in a
> translation for each case, in every language?  Did you read the
> "horror story" part from the second link I sent?  If that story is
> bogus then gettext is probably fine.

It is not fully bogus.  The fact that Slavic and Baltic languages use 
different cases for some endings of the numeral is true, see 
http://en.wikipedia.org/wiki/Lithuanian_grammar#Noun_modification_by_numeral 
for an example.  However, other part of the horror story are a bit 
exaggerated.

For example, in Italian "0 file trovati" (compare with "1 file trovato" 
and "2 file trovati") is a perfectly fine sentence, though less elegant 
than "Nessun file trovato" ("No file found").  But then, "0 files found" 
sounds a little weird in English too.

Also I don't think that the exponential explosion of translation strings 
is unavoidable if you want to have multiple numerals in a single 
sentences.  For example, in English you can choose to have up to seven 
strings like these (%d meaning any number >1):

     0 files and 0 directories were found
     1 file was found (and 0 directories)
     1 directory was found (and 0 files)
     1 file and 1 directory were found
     %d files and 1 directory were found
     1 file and %d directories were found
     %d files and %d directories were found

... or you can use the following strings:

     Found %s and %s
     1 file
     1 directory
     %d files
     %d directories

This set does not grow exponentially and, while in general %s should be 
avoided, in this case it should be relatively easy to translate without 
problems (e.g. in Italian it would not work to translate the first 
literally, but you could translate it as "I found %s and %s").


Regarding actual experiences with gettext, G++ translation has problems 
because it computes parts of a sentence using printf and %s, which is a 
no-no.  I suggested having multiple strings for the same phrase (e.g. 
"template") for the different prepositions/cases ("of a template", 
"within a template", "to a template",...) but the patch was rejected. 
In this cases, maketext probably would not need some of the contortions 
that I had to apply, but those contortions are in maketext itself and it 
would not place less burden on the translator.

Paolo



More information about the Squeak-dev mailing list