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

Re: [E-devel] uptime module i18n



Christopher Michael <cpmichael1@comcast.net> writes:

> Fixed this in cvs by adding some if statements are it so that is
> users == 1 it will print just user, and if users > 1 it will print
> users. You should now be able to translate "user" and "users".

I'm sorry, but this is the wrong way to fix this. There are languages
which distinguish between more cases than just '1 foo and '2 foos'.

Please see the ngettext() function described here:

  http://www.gnu.org/software/gettext/manual/html_chapter/gettext_10.html#SEC150

Using ngettext() one could do this:

  snprintf(users, sizeof(users),
           ngettext("user: %d", "users:%d", inst->nusers),
           inst->nusers);

I guess the ngettext() call should be a dngettext() call, but I cannot
remember the domain used... :-)

-- 
Martin Geisler                                     GnuPG Key: 0x7E45DD38

PHP Exif Library      |  PHP Weather             |  PHP Shell
http://pel.sf.net/    |  http://phpweather.net/  |  http://mgeisler.net/
Read/write Exif data  |  Show current weather    |  A shell in a browser

Attachment: pgppg_GNngj0b.pgp
Description: PGP signature