Comment 2 for bug 420368

Revision history for this message
abdullahc (sneetsher) wrote :

Yeah,

Here the definition from GNU manual:
============================
Function: char * ngettext (const char *msgid1, const char *msgid2, unsigned long int n)

    The ngettext function is similar to the gettext function as it finds the message catalogs in the same way. But it takes two extra arguments. The msgid1 parameter must contain the singular form of the string to be converted. It is also used as the key for the search in the catalog. The msgid2 parameter is the plural form. The parameter n is used to determine the plural form. If no message catalog is found msgid1 is returned if n == 1, otherwise msgid2.

    An example for the use of this function is:

              printf (ngettext ("%d file removed", "%d files removed", n), n);

    Please note that the numeric value n has to be passed to the printf function as well. It is not sufficient to pass it only to ngettext.

    In the English singular case, the number – always 1 – can be replaced with "one":

              printf (ngettext ("One file removed", "%d files removed", n), n);

    This works because the ‘printf’ function discards excess arguments that are not consumed by the format string.

    It is also possible to use this function when the strings don't contain a cardinal number:

              puts (ngettext ("Delete the selected file?",
                              "Delete the selected files?",
                              n));

    In this case the number n is only used to choose the plural form.
============================

As you see:

- n is the number of the things you are counting.

- English has 2 forms. You will write them directly in the source. as with gettext!
 (and for other languages form gettext lib will take care of them depending on your variable n and plural equation of that language. Don't worry about this, All what they needs is just n)

Alright?