=encoding UTF-8 =head1 NAME Mojolicious::Plugin::I18N - Internationalization Plugin for Mojolicious 3.x and higher =head1 SYNOPSIS # Mojolicious $self->plugin('I18N'); % languages 'de'; %=l 'hello' # Mojolicious::Lite (detect language from URL, i.e. /en/ or /de/) plugin I18N => {namespace => 'MyApp::I18N', support_url_langs => [qw(en de)]}; %=l 'hello' # Lexicon package MyApp::I18N::de; use Mojo::Base 'MyApp::I18N'; our %Lexicon = (hello => 'hallo'); 1; =head1 DESCRIPTION L is internationalization plugin for Mojolicious 3.x and higher. Old namespace is L. =head1 OPTIONS L supports the following options. =head2 C plugin I18N => {support_url_langs => [qw(en de)]}; Detect language from URL. =head2 C plugin I18N => {support_hosts => { 'mojolicious.ru' => 'ru', 'mojolicio.us' => 'en' }}; Detect Host header and use language for that host. =head2 C plugin I18N => {no_header_detect => 1}; Off header detect. =head2 C plugin I18N => {default => 'en'}; Default language for i18n, defaults to C. =head2 C plugin I18N => {namespace => 'MyApp::I18N'}; Lexicon namespace, defaults to the application class followed by C<::I18N>. =head1 HELPERS L implements helpers same as L. =head2 C %=l 'hello' $self->l('hello'); Translate sentence. =head2 C % languages 'de'; $self->languages('de'); Change languages. =head1 METHODS L inherits all methods from L and reimplements the following new ones. =head2 C $plugin->register; Register plugin hooks and helpers in L application. =head1 DEBUG MODE L has debug mode. # debug mode on BEGIN { $ENV{MOJO_I18N_DEBUG} = 1 }; # or MOJO_I18N_DEBUG=1 perl script.pl =head1 SEE ALSO L, L, L. =head1 AUTHOR 2011-2012 Anatoly Sharifulin 2010-2012 Sebastian Riedel =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes. =over 5 =item * Github L =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPANTS: CPAN Testing Service L =item * CPAN Ratings L =item * Search CPAN L =back =head1 COPYRIGHT & LICENSE Copyright (C) 2011-2012 by Anatoly Sharifulin. Copyright (C) 2008-2012, Sebastian Riedel. This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0. =cut