perl-i18n

xgettext and parameter reordering

2003-10-06 03:39:55

Short question: how can I use standard GNU xgettext for i18n
when using printf parameter reordering ?

In a bit more details:

GNU gettext supports printf parameter reordering, with a syntax
like "%2$d". In C code:

printf(_("I have %1$d houses and %2$d euros"), 2, 2500)

Translated in Perl, the $ must be escaped by '\'. I use " and
not ' because xgettext requires it (no native Perl support).
It becomes

printf(_("I have %1\$d houses and %2\$d euros"), 2, 2500)

My problem is when using standard GNU xgettext to extract
translatable strings. xgettext natively support C and generate
a correct entry in the .po file, with correct translations:

msgid "I have %1$d houses and %2$d euros"

But xgettext doesnt natively supports Perl, and generate
something different, which is not what was intended:

msgid "I have %1\\$d house(s) and %2\\$d euros in my pocket"

Of course, all this lead to untranslated strings.
Is it possible to use standard xgettext without manually
editing the po(t) files it generates, with param reordering?

Christophe


<Prev in Thread] Current Thread [Next in Thread>