Mojolicious::Plugin::IUser3Contributed Perl DocumMojolicious::Plugin::I18n(3p)



NAME
       Mojolicious::Plugin::I18n - Intenationalization Plugin

SYNOPSIS
         # Mojolicious
         $self->plugin('i18n');
         % languages 'de';
         <%=l 'hello' %>

         # Mojolicious::Lite
         plugin 'i18n' => {namespace => 'MyApp::I18N'};
         <%=l 'hello' %>

         # Lexicon
         package MyApp::I18N::de;
         use Mojo::Base 'MyApp::I18N';

         our %Lexicon = (hello => 'hallo');

         1;

DESCRIPTION
       Mojolicious::Plugin::I18n adds Locale::Maketext support to Mojolicious.
       All you have to do besides using this plugin is to add as many lexicon
       classes as you need.  Languages can usually be detected automatically
       from the "Accept-Languages" request header.

OPTIONS
   "default"
         # Mojolicious::Lite
         plugin i18n => {default => 'en'};

       Default language.

   "namespace"
         # Mojolicious::Lite
         plugin i18n => {namespace => 'MyApp::I18N'};

       Lexicon namespace.

HELPERS
   "l"
         <%=l 'hello' %>

       Translate sentence.

   "languages"
         <% languages 'de'; %>

       Change languages.

METHODS
       Mojolicious::Plugin::I18n inherits all methods from Mojolicious::Plugin
       and implements the following new ones.

   "register"
         $plugin->register;

       Register plugin hooks and helpers in Mojolicious application.

SEE ALSO
       Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.



perl v5.12.2                      2011-02-28     Mojolicious::Plugin::I18n(3p)
