-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday, 2010-04-11 at 13:22 +0400, Александр Мелентьев wrote:
2010/4/11 Carlos E. R. <>:
Well, gettext has another method, explained in "File: gettext.info, Node:
c-format": a string like:
"'%s' has only %d bytes free."
can be reordered by the translator as:
"Only %2$d bytes free on '%1$s'."
Emm, does it refer to translations only? Cause libstorage has plently
of constructions like %1$s in msgid's. Is it correct?
I'll copy the info page, which is all I know. I personally haven't used
this feature (but a colleague did, it was she who told me of this
feature). Aparently, it is available to translators in any case, but also
to some programmers depending on the platform.
+--******************
File: gettext.info, Node: c-format, Next: objc-format, Prev: Translators for other Languages, Up: Translators for other Languages
15.3.1 C Format Strings
- -----------------------
C format strings are described in POSIX (IEEE P1003.1 2001), section
XSH 3 fprintf(),
`http://www.opengroup.org/onlinepubs/007904975/functions/fprintf.html'.
See also the fprintf() manual page,
`http://www.linuxvalley.it/encyclopedia/ldp/manpage/man3/printf.3.php',
`http://informatik.fh-wuerzburg.de/student/i510/man/printf.html'.
Although format strings with positions that reorder arguments, such
as
"Only %2$d bytes free on '%1$s'."
which is semantically equivalent to
"'%s' has only %d bytes free."
are a POSIX/XSI feature and not specified by ISO C 99, translators can
rely on this reordering ability: On the few platforms where `printf()',
`fprintf()' etc. don't support this feature natively, `libintl.a' or
`libintl.so' provides replacement functions, and GNU `'
activates these replacement functions automatically.
As a special feature for Farsi (Persian) and maybe Arabic,
translators can insert an `I' flag into numeric format directives. For
example, the translation of `"%d"' can be `"%Id"'. The effect of this
flag, on systems with GNU `libc', is that in the output, the ASCII
digits are replaced with the `outdigits' defined in the `LC_CTYPE'
locale category. On other systems, the `gettext' function removes this
flag, so that it has no effect.
Note that the programmer should _not_ put this flag into the
untranslated string. (Putting the `I' format directive flag into an
MSGID string would lead to undefined behaviour on platforms without
glibc when NLS is disabled.)
******************---
If you search the files, you might find examples. Like:
gnome-packagekit.es.po
#. TRANSLATOR: "%i %s %i %s" are "%i minutes %i seconds"
#. * Swap order with "%2$s %2$i %1$s %1$i if needed
#. TRANSLATOR: "%i %s %i %s" are "%i hours %i minutes"
#. * Swap order with "%2$s %2$i %1$s %1$i if needed
#: ../src/gpk-common.c:355 ../src/gpk-common.c:374
#, c-format
msgid "%i %s %i %s"
msgstr "%i %s %i %s"
But then, some programmers use that syntax, which confuses things for us:
libstorage.es.po
#. displayed text before action, %1$s is replaced by mount point e.g. /home
#. %2$s is replaced by a pathname e.g. /etc/fstab
#: ../storage/EtcFstab.cc:917
#, c-format
msgid "Add entry for mount point %1$s to %2$s"
msgstr "Añadir entrada para el punto de montaje %1$s a %2$s"
Ah, I see what you meant. libstorage is indeed full of those constructions
used by the programmer; no idea why, because he doesn't reorder. Maybe to
signal to us that we can reorder as needed, but the purpose is confused.
- --
Cheers,
Carlos E. R.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
iEYEARECAAYFAkvBtfsACgkQtTMYHG2NR9W+LwCaAmIxvfzeIneR35gXG1T6UYV6
xq0An3FEjVhR1yM7Z0gUOkpwDSt9cquF
=OGfv
-----END PGP SIGNATURE-----