perl-i18n

Re: long strings and xgettext.pl

2005-11-09 10:23:40
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sava Chankov wrote:
| Guido Flohr wrote:
|>Still BTW, it is generally a bad idea to use a single underscore as
|>an alias for gettext().  That function is automatically global.
|
| I don't understand neither why a name of underscore makes a function
automatically global nor why is it a bad idea gettext() to be global.
Could you please explain?

I can't tell you why that is.  But you can easily test it.  Define a
function "_" in one Module.pm and you can call it without any
declaration from AnotherModule.pm.

In C, "_" is usually something like

#define _(arg) dgettext (DOMAINNAME, arg)

This allows libraries to use independent message catalogs.  With a
global function, you cannot achieve this.  Locale::TextDomain therefore
uses a double underscore as the default shortcut function.

Besides, "_" is also a magic file handle that caches the information
from the last call to stat() or lstat().  See the pod for File::Find.

Regards,
Guido
- --
Imperia AG, Development
Leyboldstr. 10 - D-50354 Hürth - http://www.imperia.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFDcjCJOo0HNPWNDz0RAjUkAKDpveMo9dJa8ZjuJUGUD/v54EiddgCg2bGd
1ME2WCXxKu0Yaa/ZKbOCz00=
=qWTn
-----END PGP SIGNATURE-----

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