Format-tags placeholders (was: Re: [xliff-tools] Another question on PO and XLIFF)

Asgeir Frimannsson asgeirf at redhat.com
Mon May 2 21:45:07 PDT 2005


Hi,

On Tue, 3 May 2005 01:26, Fredrik Corneliusson wrote:
> This brings up a question about how much help filters can give the
> translator. For example if a message uses c-formatting and the placeholders
> changes sequence in the translation the XLIFF to PO filter could
> automatically add or check the sequence representation (eg. %2$s %1$s)
> based on the ph tag id. I think could lower the entry bar for
> translators, make translation more efficient and at the provide
> functionality not provided by the current PO editors.
>
> What's your take on this?

I'm all for this approach (extracting parameters to <ph> elements), if it's 
correctly implemented. Gettext supports a wide variety of source formats, and 
extraction should occur when one of the following flags are present:
awk-format
c-format
csharp-format
elips-format
gcc-internal-format
java-format
librep-format
lisp-format
objc-format
perl-format
perl-brace-format
php-format
python-format
sh-format
tcl-format
ycp-format

(might have missed some)

And all these languages have different rules for how a parameter is 
represented (E.g. {1,number} for Java, %d for C), and validating/parsing all 
these can get complex.

..Then you have the side-cases, like when handling parameters in Farsi, you 
have to change %d to %Id [1].

But yeah, it's fully possible, and I hope to implement this (including 
re-ordering) for at least c-format in my filters. But I don't think we should 
have it as a requirement in the guide, -but we should further discuss the 
options.

Another issue: Are we are using a too low level of abstraction in c-based opne 
source applications? In Qt/KDE we're using %1, %2 etc, and do further 
formatting of the parameters in the source code, and I see this as a better 
approach than having complex c-parameters.

Maybe we should start using something like:
printf( _("My name is %1s and I have %2s in my bank account"), name 
format_currency(value, current_locale) )

in favour of this approach:
printf( _("My name is %1s and I have USD %2d.02 in my bank account",name, 
value)

cheers,
asgeir

[1] 
http://lists.freedesktop.org/archives/xliff-tools/2005-February/000041.html


More information about the xliff-tools mailing list