bug-gnu-utils
[Top][All Lists]
Advanced

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

Assorted i18n bugs with gprof


From: Christian Rose
Subject: Assorted i18n bugs with gprof
Date: 21 Dec 2001 23:38:28 +0100

While translating bfd 2.11 into Swedish, I have encountered some
messages from the source that are problematic with regard to
internationalization.


BUG 1
-----
cg_print.c:78

      printf ("%-6.6s %5.5s %7.7s %11.11s %7.7s+%-7.7s %-8.8s\t%5.5s\n",
              _("index"), _("%time"), _("self"), _("descendents"),
              _("called"), _("self"), _("name"), _("index"));

I believe "descendents" here should really be "descendants". A typo?


BUG 2
-----
gmon_io.c:350

      printf (_("\t%d histogram record%s\n"),
              nhist, nhist == 1 ? "" : "s");
      printf (_("\t%d call-graph record%s\n"),
              narcs, narcs == 1 ? "" : "s");
      printf (_("\t%d basic-block count record%s\n"),
              nbbs, nbbs == 1 ? "" : "s");

This is broken. Never add a s like this to form plural tense. "s" is not
used to form plural tense in a lot of languages, and many eastern
European languages for example have several forms of plural tense,
depending on the number of items. Using multiple, full messages solves
the first problem:

  "\t%d histogram record\n"
  "\t%d histogram records\n"

And if you instead use ngettext() you also solve the second problem:

  printf (ngettext ("\t%d histogram record\n",
                    "\t%d histogram records\n", nhist), nhist);

With a ngettext solution like this, the translator can easily make the
plural forms work correctly for his language from inside the po file.

The ngettext function reference:

" - 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);"


Christian




reply via email to

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