Mojolicious::Plugin::I18N(3pm) | User Contributed Perl Documentation | Mojolicious::Plugin::I18N(3pm) |
Mojolicious::Plugin::I18N - Internationalization Plugin for Mojolicious
# 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;
Mojolicious::Plugin::I18N is internationalization plugin for Mojolicious It works with Mojolicious 4.0+.
Old namespace is Mojolicious::Plugin::I18N2.
Mojolicious::Plugin::I18N supports the following options.
plugin I18N => {support_url_langs => [qw(en de)]};
Detect language from URL.
plugin I18N => {support_hosts => { 'mojolicious.ru' => 'ru', 'mojolicio.us' => 'en' }};
Detect Host header and use language for that host.
plugin I18N => {no_header_detect => 1};
Off header detect.
plugin I18N => {default => 'en'};
Default language for i18n, defaults to "en".
plugin I18N => {namespace => 'MyApp::I18N'};
Lexicon namespace, defaults to the application class followed by "::I18N".
Mojolicious::Plugin::I18N implements helpers same as Mojolicious::Plugin::I18N.
%=l 'hello' $self->l('hello');
Translate sentence.
% languages 'de'; $self->languages('de');
Change languages.
Mojolicious::Plugin::I18N inherits all methods from Mojolicious::Plugin::I18N and reimplements the following new ones.
$plugin->register;
Register plugin hooks and helpers in Mojolicious application.
Mojolicious::Plugin::I18N has debug mode.
# debug mode on BEGIN { $ENV{MOJO_I18N_DEBUG} = 1 }; # or MOJO_I18N_DEBUG=1 perl script.pl
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
2011-2014 Anatoly Sharifulin <sharifulin@gmail.com>
2010-2012 Sebastian Riedel <kraihx@googlemail.com>
Please report any bugs or feature requests to "bug-mojolicious-plugin-i18n at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.htMail?Queue=Mojolicious-Plugin-I18N>. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes.
<http://github.com/sharifulin/mojolicious-plugin-i18n/tree/master>
<http://rt.cpan.org/NoAuth/Bugs.htMail?Dist=Mojolicious-Plugin-I18N>
<http://annocpan.org/dist/Mojolicious-Plugin-I18N>
<http://cpants.perl.org/dist/overview/Mojolicious-Plugin-I18N>
<http://cpanratings.perl.org/d/Mojolicious-Plugin-I18N>
<http://search.cpan.org/dist/Mojolicious-Plugin-I18N>
Copyright (C) 2011-2014 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.
2022-06-15 | perl v5.34.0 |