NAME
Mojolicious::Plugin::Message::Locale - Mojolicious Plugin
SYNOPSIS
# locale.conf
{
common => {
title => { en => 'TITLE', ja => 'タイトル' },
message => { en => 'MESSAGE', ja => 'メッセージ' }
},
original => {
message => { en => 'OROGINAL MESSAGE', ja => 'オリジナル' }
}
}
# Mojolicious
$self->plugin('Message::Locale', {
default_message => '',
locale => 'en',
file => 'locale.conf',
});
# same $self->plugin('Message::Locale');
$self->locale('message', 'common'); # MESSAGE
$self->locale('message', 'original'); # ORIGINAL MESSAGE
$self->set_locale('ja');
$self->locale('title'); # タイトル
$self->locale('message', 'original'); # オリジナル
$self->set_locale('en');
$self->locale('title'); # TITLE
$self->locale('title', 'original'); # TITLE
# template .html.ep
<%= locale "title" %>
<%= locale "title", "original" %>
<%= locale "message" %>
<%= locale "message", "original" %>
DESCRIPTION
Mojolicious::Plugin::Message::Locale is a plugin for Mojolicious apps to localize messages using Mojolicious::Plugin::Config
METHODS
Mojolicious::Plugin::Message::Locale inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register($app, $conf);
Register plugin in Mojolicious application.
SEE ALSO
Mojolicious, Mojolicious::Guides, http://mojolicious.
AUTHOR
Kei Shimada <sasakure_kei __at__ cpan.org>
REPOSITORY
git clone git@github.com:sasakure-kei/p5-Mojolicious-Plugin-Message-Locale.git
LICENCE AND COPYRIGHT
Copyright (c) 2012, Kei Shimada <sasakure_kei __at__ cpan.org>
. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.