Mojoli...n::I18N(3pm)

πŸ“¦
version 1.60 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 (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 πŸ¦‹πŸ’œ