The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 base 'MyApp::I18N';

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

    1;

DESCRIPTION

Mojolicous::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'};
namespace
    # Mojolicious::Lite
    plugin i18n => {namespace => 'MyApp::I18N'};

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://mojolicious.org.