Mojolicious::Plugin::I18N(3pm)

Mojolicious::Plugin::I18N3pm

Internationalization plugin for mojolicious

Usage

  # 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;

Overview

Mojolicious::Plugin::I18N is internationalization plugin for Mojolicious It works with Mojolicious 4.0+.

Old namespace is Mojolicious::Plugin::I18N2.

Options

Mojolicious::Plugin::I18N supports the following options.

"support_url_langs"

  plugin I18N => {support_url_langs => [qw(en de)]};

Detect language from URL.

"support_hosts"

  plugin I18N => {support_hosts => { 'mojolicious.ru' => 'ru', 'mojolicio.us' => 'en' }};

Detect Host header and use language for that host.

"no_header_detect"

  plugin I18N => {no_header_detect => 1};

Off header detect.

"default"

  plugin I18N => {default => 'en'};

Default language for i18n, defaults to "en".

"namespace"

  plugin I18N => {namespace => 'MyApp::I18N'};

Lexicon namespace, defaults to the application class followed by "::I18N".

Helpers

Mojolicious::Plugin::I18N implements helpers same as Mojolicious::Plugin::I18N.

"l"

  %=l 'hello'
  $self->l('hello');

Translate sentence.

"languages"

  % languages 'de';
  $self->languages('de');

Change languages.

Methods

Mojolicious::Plugin::I18N inherits all methods from Mojolicious::Plugin::I18N and reimplements the following new ones.

"register"

  $plugin->register;

Register plugin hooks and helpers in Mojolicious application.

Debug mode

Mojolicious::Plugin::I18N has debug mode.

  # debug mode on
  BEGIN { $ENV{MOJO_I18N_DEBUG} = 1 };
  # or
  MOJO_I18N_DEBUG=1 perl script.pl

Releases

7 releases since Debian 7 (Wheezy); the text changed 3 times.

  1. 7
  2. 8
  3. 9–11
  4. 12–13

Authors

2011-2014 Anatoly Sharifulin <[email protected]>

2010-2012 Sebastian Riedel <[email protected]>

Bugs

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.

•

Github

<http://github.com/sharifulin/mojolicious-plugin-i18n/tree/master>

•

RT: CPAN's request tracker

<http://rt.cpan.org/NoAuth/Bugs.htMail?Dist=Mojolicious-Plugin-I18N>

•

AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Mojolicious-Plugin-I18N>

•

CPANTS: CPAN Testing Service

<http://cpants.perl.org/dist/overview/Mojolicious-Plugin-I18N>

•

CPAN Ratings

<http://cpanratings.perl.org/d/Mojolicious-Plugin-I18N>

•

Search CPAN

<http://search.cpan.org/dist/Mojolicious-Plugin-I18N>

From libmojolicious-plugin-i18n-perl 1.60-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.