Re: xgettext and parameter reordering

[email protected] (Guido Flohr) Wed, 08 Oct 2003 12:50:31 +0200
Newsgroups perl.i18n
Message-ID <[email protected]>
Hi,

Christophe Chisogne wrote:
> Autrijus Tang wrote:
>=20
>> The fact that it handles \$ incorrectly
>=20
>=20
> 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=20
in .po files are not the same as double-quoted Perl strings. Thus the=20
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=20
escaped, in .po files it must not be escaped.

> Below, some syntactic differences,
> for the syntax things (and my own poor memory ;-)
>=20
> 1. Positional args:
> -------------------
>=20
> %2$d for Locale::gettext and std gettext(1)
>=20
> [_2] for Locale::Maketext
>=20
> {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=20
compatible to Locale::gettext.  Locale::gettext_xs is exactly the same=20
as Locale::gettext with bindings for the new GNU gettext functions=20
ngettext() (and friends...) and bind_textdomain_codeset().

I rather would have extended Locale::gettext than introducing a new=20
module (and a new namespace) but the original author of Locale::gettext=20
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.=20
Alternatively Locale::gettext could be treated as obsolete.

Ciao

Guido
--=20
Imperia AG, Development
Leyboldstr. 10 - D-50354 H=FCrth - http://www.imperia.net/