pazt has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks
I'm trying "inflate" languages parts from my App.pl script but i'm not getting works
This is my working App.pl
#!/usr/bin/perl # Brazilian portuguese package App::I18N::pt_br; use Mojo::Base 'Locale::Maketext'; use utf8; our %Lexicon = ('hello world'=> 'Olá Mundo'); # French package App::I18N::fr; use Mojo::Base 'Locale::Maketext'; use utf8; our %Lexicon = ('hello world'=> 'salut monde'); package main; use Mojolicious::Lite; plugin I18N => { namespace => 'App::I18N', support_url_langs => [qw(en fr pt_br)] }; get '/' => 'index'; app->start; __DATA__ @@ index.html.ep %= l 'hello world'
Using that script above everything works. But when i try to separate the language parts, the script not fail, but not translate the 'hello world' word.
I tried split the script like this:
App |+- App.pl |- I18N | |- fr.pm | +- pt_br.pm
App.pl becames:
use Mojolicious::Lite; plugin I18N => { namespace => 'App::I18N', support_url_langs => [qw(en fr pt_br)] }; get '/' => 'index'; app->start; __DATA__ @@ index.html.ep %= l 'hello world'
and package App::I18N::pt_br becames pt_br.pm:
package App::I18N::pt_br; use Mojo::Base 'Locale::Maketext'; use utf8; our %Lexicon = ('hello world'=> 'Olá Mundo');
So.... Am I doing something wrong? How can I split my language parts from my script and keep it working?
Thank you very much
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mojolicious i18n "inflate"
by beech (Parson) on Oct 09, 2016 at 02:59 UTC | |
by pazt (Acolyte) on Oct 09, 2016 at 04:36 UTC | |
by beech (Parson) on Oct 09, 2016 at 10:12 UTC | |
by pazt (Acolyte) on Oct 09, 2016 at 23:49 UTC |