gettext: c-format

1 
1 15.3.1 C Format Strings
1 -----------------------
1 
1    C format strings are described in POSIX (IEEE P1003.1 2001), section
1 XSH 3 fprintf(),
1 <http://www.opengroup.org/onlinepubs/007904975/functions/fprintf.html>.
1 See also the fprintf() manual page,
1 <http://www.linuxvalley.it/encyclopedia/ldp/manpage/man3/printf.3.php>,
1 <http://informatik.fh-wuerzburg.de/student/i510/man/printf.html>.
1 
1    Although format strings with positions that reorder arguments, such
1 as
1 
1      "Only %2$d bytes free on '%1$s'."
1 
1 which is semantically equivalent to
1 
1      "'%s' has only %d bytes free."
1 
1 are a POSIX/XSI feature and not specified by ISO C 99, translators can
1 rely on this reordering ability: On the few platforms where ‘printf()’,
1 ‘fprintf()’ etc.  don’t support this feature natively, ‘libintl.a’ or
1 ‘libintl.so’ provides replacement functions, and GNU ‘<libintl.h>’
1 activates these replacement functions automatically.
1 
1    As a special feature for Farsi (Persian) and maybe Arabic,
1 translators can insert an ‘I’ flag into numeric format directives.  For
1 example, the translation of ‘"%d"’ can be ‘"%Id"’.  The effect of this
1 flag, on systems with GNU ‘libc’, is that in the output, the ASCII
1 digits are replaced with the ‘outdigits’ defined in the ‘LC_CTYPE’
1 locale category.  On other systems, the ‘gettext’ function removes this
1 flag, so that it has no effect.
1 
1    Note that the programmer should _not_ put this flag into the
1 untranslated string.  (Putting the ‘I’ format directive flag into an
1 MSGID string would lead to undefined behaviour on platforms without
1 glibc when NLS is disabled.)
1