Looking for people's experience with po files.
Michael Pelletier
mvpel at hushmail.com
Wed Sep 10 13:25:53 EDT 2008
Numbered argument conversion specifications ("%1$d") are an XSI (X/Open
System Interfaces) extension to the ISO C standard.
If you use them in code for cross-platform or legacy environments, it
probably wouldn't be a bad idea to #ifdef against the _XOPEN_UNIX constant.
The GNU C library is XSI compliant by default.
-Michael Pelletier.
-----Original Message-----
From: gnhlug-discuss-bounces at mail.gnhlug.org
[mailto:gnhlug-discuss-bounces at mail.gnhlug.org] On Behalf Of
VirginSnow at vfemail.net
Sent: Wednesday, September 10, 2008 1:08 PM
To: gnhlug-discuss at mail.gnhlug.org
Subject: Re: Looking for people's experience with po files.
> Date: Wed, 10 Sep 2008 12:14:13 -0400
> From: Dan Coutu <coutu at snowy-owl.com>
> part of what gettext handles by default. The trick there is to use
> gettext to obtain the translation and then do string processing (your
> language's equivalent of sprintf) in order to do the variable
> substitution. There are, however, potential pitfalls with this logic.
> Not all languages place words in the same order. What is one language
> might be "You have 10 items in your shopping cart worth $50 total"
> might in another language read more like "Your total of $50 is for item
count 10".
Most versions of printf will allow you to rearrange the order in which
conversion specifiers consume arguments by using "%n$" where you would
normally use "%". Example:
printf("number1 is %2$d, and number2 is %1$d.\n", number2, number1);
does the same thing as
printf("number1 is %d, and number2 is %d.\n", number1, number2);
_______________________________________________
gnhlug-discuss mailing list
gnhlug-discuss at mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/
More information about the gnhlug-discuss
mailing list