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

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

Re: Translating format strings with multiple instances of things that co


From: Chusslove Illich
Subject: Re: Translating format strings with multiple instances of things that could be plural
Date: Fri, 6 Jul 2007 12:25:44 +0200
User-agent: KMail/1.9.5

> [: James Youngman :]
> My problem is the final printf() call here. %1$s is certain to be over 200
> [...]

...which is of no decision value, as many languages will use the singular
for for some numbers other than 1. E.g. 201 would also take singular form in
my language. (Just a side remark.)

> [...] but the others could be anywhere between 0 and a very large number.
> How can I make this code translation-friendly? On obvious option is to
> break it up [...] but [...] which is very unfriendly to the translators.

This problem pops up every now and then. For the moment, I would
nevertheless suggest a "controlled" breakup, properly positioned and well
commented for the translator (the /* xgettext: ... */ comments are going to
be extracted into POT file):

  /* xgettext: This is a text composition, where each argument is a
     sentence in itself which has plural forms. These partial sentences
     are given in the several messages below, so take care to match
     their structure with the composition here. */
  const char *msg = _("%1$s,\n\n"
                      "\t%2$s,\n"
                      "\t%3$s,\n"
                      "\t%4$s.\n");

  /* xgettext: %1$s of the text composition above. */
  const char *ins1 = _n("File names have a cumulative length of one byte.\n"
                        "Of those file names",
                        "File names have a cumulative length of %s bytes.\n"
                        "Of those file names",
                        statistics.total_filename_length);

  /* xgettext: %2$s of the text composition above. */
  const char *ins2 = _n("one contains whitespace",
                        "%s contain whitespace",
                        statistics.whitespace_count);

  /* xgettext: %3$s of the text composition above. */
  const char *ins3 = _n("one contains newline characters",
                        "%s contain newline characters",
                        statistics.newline_count);

  /* xgettext: %4$s of the text composition above. */
  const char *ins4 = _n("and one contains characters with the high bit set",
                        "and %s contain characters with the high bit set",
                        statistics.highbit_filename_count);

  /* Now the composition. */
  char ibuf1[MAXSZ];
  snprintf( ibuf1, MAXSZ, ins1,
            human_readable( statistics.total_filename_length, hbuf1,
                            human_ceiling, 1, 1 ) );
  /* etc. */
  printf( msg, ibuf1, ibuf2, ibuf3, ibuf4 );

Providing that in the target language there are no interdependencies between
sentences (in case of which there would be no escape to providing all
combinations), translator is now well informed and can manipulate both the
parts and their composition as he likes.

-- 
Chusslove Illich (Часлав Илић)

Attachment: pgpIn9Nnc4A9i.pgp
Description: PGP signature


reply via email to

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