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: Hamed Malek
Subject: Re: [PATCH] I18n flag for msgfmt
Date: Tue, 06 Jan 2004 17:14:53 +0330

On Mon, 2004-01-05 at 18:30, Bruno Haible wrote:
> > 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!)
Well, in printf manual(3), you can find a small documentation, but
actually as Joseph S. Mayer said that's reverse-engineered documentation
and can't reflect proper specification about this flag.
> , 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.
> 
Let me explain you why we need this flag in msgfmt. Persian unlike other
languages uses its own digits, so translators should use "%Id" instead
of "%d" in .po files. This makes extra work for translators anyway. Also
due to it, there is no way except adding 'I' flag in .po files.
Now, to make this flag work for gettext I think it's better to change
the patch to something like this:
#ifdef __GLIBC__
  while (*format == ' ' || *format == '+' || *format == '-'
         || *format == '#' || *format == '0'
         || *format == 'I' || *format== '\'')
    format++;
#else
  while (*format == ' ' || *format == '+' || *format == '-'
         || *format == '#' || *format == '0' || *format == '\'')
    format++;
#endif

Then, It would be portable.

Hamed Malek






reply via email to

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