[Catalyst] Localisation
Duncan Garland
Duncan.Garland at motortrak.com
Thu Oct 6 12:39:43 GMT 2011
Hi,
Has any anybody got a working example of the use of Locale::Maketext with Locale::Maketext::Lexicon? I think I've missed something simple. My example code is:
{ package Lexicon;
use base 'Locale::Maketext';
use Locale::Maketext::Lexicon {
fr => ['Gettext' => "hello_fr2.po" ],
};
sub fr::xxx { print "Hello!"; return "hello"; }
1;
}
my $l = Lexicon->get_handle( 'fr' );
print $l->maketext( "Hello" ) . "\n";
print $l->maketext( "Nuts ~[xxx~]" ) . "\n";
The hello_fr2.po contains:
msgid "Hello"
msgstr "Bonjour"
msgid "Goodbye"
msgstr "Au revoir"
msgid "Your search matched [quant,_1,book]"
msgstr "Vous trouvez [ quant, _1, livre ]"
msgid "You are my [ord,_1] something."
msgid "[numf,_1]"
msgstr "[numf,_1]"
msgid "Nuts [xxx]"
msgstr "Bolts [xxx]"
The output is:
Bonjour
Bolts [xxx]
So the simple substitutions work but I can't get it to call the function. Furthermore, it puts tilde before each bracket, so I can't get a match for anything with a function unless I put tildes in there. I've missed something simple. Any ideas?
Thanks
Duncan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20111006/445c0c60/attachment.htm
More information about the Catalyst
mailing list