bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU Coding Standards, internatialisation and plurals


From: Michael Thayer
Subject: GNU Coding Standards, internatialisation and plurals
Date: Sun, 14 May 2006 15:47:08 +0200

Hello,

I would like to point out a problem with your advise on writing
strings in programmes for internationalisation.  To enable translators
to deal with plurals correctly, you recommend using the following
style:

(quote)

    printf ((nfiles != 1 ? "%d files processed"
             : "%d file processed"),
            nfiles);

(unquote)

This has the problem that not all languages treat singular and plural
the same way as English.  For example, Arabic uses singular, dual and
plural rather than just singular and plural.  Russian uses a different
case depending on whether the number ends in 1, in 2-4 or in 5-9, 0 or
11-19.  And I believe many languages treat zero as singular (although
it is probably better to have a sentence like "No files processed" for
zero).  Newer versions of Gettext take these things into account.

Another thing worth mentioning is that it is better to limit strings
to be translated to one number argument per sentence unit (i.e.
"Searched %d directories.  Found %d files"  or "Searched %d
directories and found %d files" rather than "Found %d files in %d
directories") as some languages may prefer to express the arguments in
reverse order ("In %d directories found %d files"), which printf would
probably not take kindly to.

Kind regards,

Michael




reply via email to

[Prev in Thread] Current Thread [Next in Thread]