perl-i18n

Re: xgettext and parameter reordering

2003-10-07 04:09:07
Autrijus Tang wrote:
The fact that it handles \$ incorrectly

Now I think it handles \ correctly, cfr my previous mail
\ must be replaced by \\ to allow use of \ in
translatable strings.

With that said, once the standard xgettext support perl reasonably
(preferably with [_1]), I'm happy to retire xgettext.pl and replace it
with xmaketext or something else, to avoid confusion.

We'll need xgettext.pl for a long time (and for Locale::Maketest)
because of the different syntax of catalogs
(GNU gettext syntax for .po, the extended one for Maketext,
 and possibly others). [See below]

Furthemore, the -g compatibility flag is a Good Thing (tm).
Without xgettext CVS version (and its Perl support), the only
option to extract strings marked with sigle quotes in Perl code
is the use of xgettext.pl and its compatibility flag to allow
skipping the [xx] translations.

Below, some syntactic differences,
for the syntax things (and my own poor memory ;-)

1. Positional args:
-------------------

%2$d for Locale::gettext and std gettext(1)

[_2] for Locale::Maketext

{name} for Locale::TextDomain

2. Plural forms:
----------------

For std gettext, a header in .po files like
   Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;
to select the index n according to the number
(possibly more than 2, depending on language)
And a .po entry like
     msgid "found %d fatal error"
     msgid_plural "found %d fatal errors"
     msgstr[0] "s'ha trobat %d error fatal"
     msgstr[1] "s'han trobat %d errors fatals"
Translation done by ngettext() instead of gettext()

For Locale::gettext, no ngettext support (yet?)

For Maketest: use of the quant() function and catalogs
entries like
 "[quant,_1,camel was, camels were] released." =>
 "[quant,_1,Kamel wurde,Kamele wurden] freigegeben."


Christophe