[Catalyst] Localisation
Chakkit Ngamsom
chakkit at ibiz.co.th
Thu Oct 6 14:05:36 GMT 2011
Hi Duncan,
You should use Plugin here:
http://search.cpan.org/dist/Catalyst-Plugin-I18N/lib/Catalyst/Plugin/I18N.pm
Check at configuration section if you want to specify directory for .po files or elsr.
Regards,
Chakkit
On Oct 6, 2011, at 7:39 PM, Duncan Garland <Duncan.Garland at motortrak.com> wrote:
> 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
>
>
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20111006/0eb383ec/attachment.htm
More information about the Catalyst
mailing list