Catalyst-Plugin-I18N
view release on metacpan or search on metacpan
[% l('Hello Catalyst') %]
[% l('Hello [_1]', 'Catalyst') %]
[% l('lalala[_1]lalala[_2]', ['test', 'foo']) %]
[% l('messages.hello.catalyst') %]
DESCRIPTION
Supports mo/po files and Maketext classes under your application's I18N
namespace.
# MyApp/I18N/de.po
msgid "Hello Catalyst"
msgstr "Hallo Katalysator"
# MyApp/I18N/i_default.po
msgid "messages.hello.catalyst"
msgstr "Hello Catalyst - fallback translation"
# MyApp/I18N/de.pm
package MyApp::I18N::de;
use base 'MyApp::I18N';
our %Lexicon = ( 'Hello Catalyst' => 'Hallo Katalysator' );
1;
CONFIGURATION
You can override any parameter sent to Locale::Maketext::Simple by
lib/Catalyst/Plugin/I18N.pm view on Meta::CPAN
[% l('Hello [_1]', 'Catalyst') %]
[% l('lalala[_1]lalala[_2]', ['test', 'foo']) %]
[% l('messages.hello.catalyst') %]
=head1 DESCRIPTION
Supports mo/po files and Maketext classes under your application's I18N
namespace.
# MyApp/I18N/de.po
msgid "Hello Catalyst"
msgstr "Hallo Katalysator"
# MyApp/I18N/i_default.po
msgid "messages.hello.catalyst"
msgstr "Hello Catalyst - fallback translation"
# MyApp/I18N/de.pm
package MyApp::I18N::de;
use base 'MyApp::I18N';
our %Lexicon = ( 'Hello Catalyst' => 'Hallo Katalysator' );
1;
=head2 CONFIGURATION
lib/Catalyst/Plugin/I18N/Manual.pod view on Meta::CPAN
messages.pot
$ msginit --input=lib/MyApp/I18N/messages.pot --output=lib/MyApp/I18N/sv.po --locale=sv
Created lib/MyApp/I18N/sv.po.
$ vim lib/MyApp/I18N/sv.po
"Content-Type: text/plain; charset=utf-8\n"
#: lib/MyApp.pm:50
msgid "Guest"
msgstr "Gäst"
#. ($name)
#: lib/MyApp.pm:54
msgid "Welcome %1!"
msgstr "Välkommen %1!"
$ perl script/myapp_server.pl
[Fri Dec 2 03:52:45 2005] [catalyst] [debug] Debug messages enabled
[Fri Dec 2 03:52:47 2005] [catalyst] [debug] Loaded plugins:
.------------------------------------------------------------------------------.
| Catalyst::Plugin::I18N |
| Catalyst::Plugin::Unicode |
'------------------------------------------------------------------------------'
lib/Catalyst/Plugin/I18N/Manual.pod view on Meta::CPAN
}
$ xgettext.pl --output=lib/MyApp/I18N/messages.pot --directory=lib/
$ msgmerge --update lib/MyApp/I18N/sv.po lib/MyApp/I18N/messages.pot
. done.
$ vim lib/MyApp/I18N/sv.po
#. ($name)
#: lib/MyApp.pm:54
msgid "Welcome to my homepage %1!"
msgstr "Välkommen till min hemsida %1!"
$ perl script/myapp_server.pl
# point your browser to http://localhost:3000/?name=Joe
# output should render:
Välkommen till min hemsida Joe!
$ perl script/myapp_create.pl view TT TT
lib/Catalyst/Plugin/I18N/Manual.pod view on Meta::CPAN
[% c.loc( 'Welcome to my place [_1]!', c.stash.name ) %]
$ xgettext.pl --output=lib/MyApp/I18N/messages.pot --directory=lib/ --directory=root/
$ msgmerge --update lib/MyApp/I18N/sv.po lib/MyApp/I18N/messages.pot
. done.
$ vim lib/MyApp/I18N/sv.po
#. (c.stash.name)
#: root/test.tt:1
msgid "Welcome to my place %1!"
msgstr "Välkommen till mitt ställe %1!"
$ perl script/myapp_server.pl
[Fri Dec 2 05:12:58 2005] [catalyst] [debug] Debug messages enabled
[Fri Dec 2 05:12:58 2005] [catalyst] [debug] Loaded plugins:
.------------------------------------------------------------------------------.
| Catalyst::Plugin::I18N |
| Catalyst::Plugin::Unicode |
'------------------------------------------------------------------------------'
t/lib/TestApp/I18N/de.po view on Meta::CPAN
msgid "Hello"
msgstr "Hallo"
t/lib/TestApp/I18N/i_default.po view on Meta::CPAN
msgid "messages.hello"
msgstr "Hello - default"
( run in 0.948 second using v1.01-cache-2.11-cpan-97f6503c9c8 )