Mojoli...n::I18N(3pm)
β¨ NAME β¨
Mojolicious::Plugin::I18N β the Internationalization Plugin for Mojolicious, bestie π (that's the page you're reading, filed under the perl manual name Mojoli...n::I18N(3pm), iykyk)
πΈ 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;
π¦ DESCRIPTION π¦
So Mojolicious::Plugin::I18N is, like, the internationalization plugin for Mojolicious. It works with Mojolicious 4.0+ β yes, ancient, but she still serves π
.
The old namespace is Mojolicious::Plugin::I18N2, in case you were digging through grandma's code and found it.
π OPTIONS π
Mojolicious::Plugin::I18N supports the following options, bestie. Read them all, they're short.
support_url_langs
plugin I18N => {support_url_langs => [qw(en de)]};
Detect language from URL. Cute, right? π
support_hosts
plugin I18N => {support_hosts => { 'mojolicious.ru' => 'ru', 'mojolicio.us' => 'en' }};
Detect the Host header and use the language for that host. She's reading the room π¬.
no_header_detect
plugin I18N => {no_header_detect => 1};
Off header detect. That's it, that's the whole option π«Ά.
default
plugin I18N => {default => 'en'};
Default language for i18n, defaults to "en". No thoughts, just en π.
namespace
plugin I18N => {namespace => 'MyApp::I18N'};
Lexicon namespace, defaults to the application class followed by "::I18N". Very demure, very mindful β¨.
π HELPERS π
Mojolicious::Plugin::I18N implements helpers same as Mojolicious::Plugin::I18N. (Yes, it literally says that. Iconic of it.)
l
%=l 'hello'
$self->l('hello');
Translate sentence. That's the whole vibe πΈ.
languages
% languages 'de';
$self->languages('de');
Change languages. Swap the whole fit π
π₯ 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. Plug her in, she's ready π.
π DEBUG MODE π
Mojolicious::Plugin::I18N has debug mode. Main character energy fr fr.
# debug mode on
BEGIN { $ENV{MOJO_I18N_DEBUG} = 1 };
# or
MOJO_I18N_DEBUG=1 perl script.pl
π SEE ALSO π
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
π«Ά AUTHORS π«Ά
2011-2014 Anatoly Sharifulin <sharifulin@gmail.com>
2010-2012 Sebastian Riedel <kraihx@googlemail.com>
π 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. Bestie, they will keep you posted, no cap π£.
- 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>
π COPYRIGHT & LICENSE π
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.
And that's the whole page, bestie β¨ β brought to you by perl v5.34.0, dated 2022-06-15, filed under Mojoli...n::I18N(3pm). Go forth and translate everything π¦π
π¦ where this page comes from
- debian bookworm: libmojolicious-plugin-i18n-perl 1.60-2 Β· Artistic-2.0
- debian trixie: libmojolicious-plugin-i18n-perl 1.60-2 Β· Artistic-2.0
- ubuntu noble: libmojolicious-plugin-i18n-perl 1.60-2 Β· Artistic-2.0
- ubuntu resolute: libmojolicious-plugin-i18n-perl 1.60-2 Β· Artistic-2.0
- ubuntu stonking: libmojolicious-plugin-i18n-perl 1.60-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms