Created
December 13, 2010 09:15
Revisions
-
shoorick created this gist
Dec 13, 2010 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ #!/usr/bin/env perl use Mojolicious::Lite; get '/' => sub { my $self = shift; $self->render( 'template' => 'index', 'count' => int rand 33, ); }; plugin 'charset' => { 'charset' => 'utf8' }; plugin 'textdomain' => { 'domain' => 'example', 'search_dirs' => [ 'locale' ], }; app->start; __DATA__ @@ index.html.ep % layout 'page'; in template: %= __ 'It works?'; <p>Plural via <code>__nx</code>: <%= __nx '{count} apple was found', '{count} apples were found', $count, 'count' => $count %> </p> <p>Plural via <code>__n</code>: <%= sprintf __n ( '%d apple was found', '%d apples were found', $count), $count %> </p> @@ layouts/page.html.ep <!doctype html><html> <head><title>i18n <%= __ 'Example' %></title></head> <body> <h1>in layout: <%= __ 'It works?' %></h1> <%== content %> </body> </html>