perl-i18n

Re: xgettext and parameter reordering

2003-10-08 03:48:06
Hi,

Christophe Chisogne wrote:
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.

Again for the records, just to make things clear: Double-quoted strings in .po files are not the same as double-quoted Perl strings. Thus the Perl directive

        gettext ("%1\$s is replaced by %2\$s.");
        # Equivalent to:
        gettext ('%1$s is replaced by %2$s');

must result in

        msgid "%1$s is replaced by %2$s."
        msgstr "%2$s remplace %1$s."

in a .po file, because in Perl qq strings a literal dollar sign must be escaped, in .po files it must not be escaped.

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

Locale::gettext is really a subset of Locale::TextDomain/libintl-perl.

2. Plural forms:
----------------
For Locale::gettext, no ngettext support (yet?)

Yes and no: libintl-perl contains Locale::gettext_xs which is downwards compatible to Locale::gettext. Locale::gettext_xs is exactly the same as Locale::gettext with bindings for the new GNU gettext functions ngettext() (and friends...) and bind_textdomain_codeset().

I rather would have extended Locale::gettext than introducing a new module (and a new namespace) but the original author of Locale::gettext was not available. As soon as Locale::gettext is in sync again with GNU gettext, I would happily withdraw Locale::gettext_xs from libintl-perl. Alternatively Locale::gettext could be treated as obsolete.

Ciao

Guido
--
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.net/