Subject: | i18n doesn't seem to work at all in modules |
I'm running perl-5.8.7 on Windows XP in UK English.
Create the following two files in C:\Temp\i18n :-
Foo.pm
------
package Foo;
use i18n 'C:/Temp/i18n';
sub foo { print ~~'Test' }
1;
en.po
-----
msgid "Test"
msgstr "English"
Now "cd" to that directory and run "perl -MFoo -e "Foo::foo()". The output
is "Test". It should be "English". (I18N::LangTags::Detect::detect() returns ('en-gb') on my system.)
The i18n pragma does seem to work OK in scripts, though. For example, create the following file in the same directory:-
test.pl
-------
use i18n 'C:/Temp/i18n';
print ~~'Test';
and then run "perl test.pl" and the output is "English" as expected.
(One-liners also work fine, e.g.
perl -Mi18n=. -e "print ~~'Test'"
also produces "English".)
I couldn't figure out at a quick glance why it doesn't work in modules, but clearly this is a real bummer.