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

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

Re: [PATCH] I18n flag for msgfmt


From: Bruno Haible
Subject: Re: [PATCH] I18n flag for msgfmt
Date: Mon, 5 Jan 2004 16:00:23 +0100
User-agent: KMail/1.5

> glibc 2.2 adds i18n flag to printf formats, which msgfmt doesn't support
> it. Attached is a small patch for format-c.c which adds it.

Hi,

Given that this 'I' flag is not portable (it is not even documented in
the glibc manual!), any program using it would need a variant of the format
string without this 'I' flag:

  #ifdef __GLIBC__
    printf (_("%Id inhabitants"), n);
  #else
    printf (_("%d inhabitants"), n);
  #endif

Which makes extra work for the translators. Therefore I suggest that you
use the technique described in the gettext manual, section "Preparing
Translatable Strings", leading to

  char buf1[100];
  #ifdef __GLIBC__
    sprintf(buf1, "%Id", n);
  #else
    sprintf(buf1, "%d", n);
  #endif
  printf (_("%s inhabitants"), buf1);

And once you do this, msgfmt doesn't need to know any more about the 'I'
modifier.

Bruno





reply via email to

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