[xliff-tools] comments about Representation Guide - *-format
Bruno Haible
bruno at clisp.org
Mon Oct 10 05:12:03 PDT 2005
Hi,
In the process of putting a PO -> XLIFF converter into the GNU gettext
tools, I have a few issues with the Representation Guide (labelled
Working Draft 7 June 2005). Please tell me if they have already been
resolved - I've been unable to follow all the discussions on this list.
Here is the first, blocking one.
Section 5.6.3. X-format
The proposed approach of using <ph> elements to shield the translator
from the complexities of format strings is interesting. However, there are
issues:
a) What is the expected labelling of a format directive that doesn't
take an argument? Example:
#, c-format
msgid "Increased by 0.7%%."
msgstr "Gestiegen um 7 o/oo."
Such a format directive can be omitted or added by the translator.
b) What is the expected labelling of a format directive that takes
several arguments? Example:
#, c-format
msgid "File name is %.*s, number is %d."
msgstr "Le %d-ième fichier est %.*s."
The "%.*s" directive consumes two arguments: an integer and a string
argument. How should it be labelled?
c) How to extend this principle to Lisp and Scheme format strings?
Recall that these format strings can contain loops. For example,
in order to output a list of strings, in C the programmer has to write
code that dispatches among
"Written in %d by %s."
"Written in %d by %s and %s."
"Written in %d by %s, %s and %s."
"Written in %d by %s, %s, %s and %s."
"Written in %d by %s, %s, %s, %s and %s."
whereas in Lisp a single format string does it all, for any number of
arguments:
"Written in ~D by ~{~A~^~*~#[ and ~:;, ~]~:*~}."
The format string represents a loop. The translator cannot simply
translate the text pieces and permute the rest. In cases like this,
the translator must also be able to change the control logic in the
format string.
And of course the ~D and the ~A are not permutable: the format string
expects one number and a list of strings, and if a translator would
write "Ecrit par ~A en ~{~D~^~*~#[ and ~:;, ~]~:*~}."
then it would expect a single string and a list of numbers.
Bruno
More information about the xliff-tools
mailing list