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@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/

Reply via email to