1Mojolicious::Plugin::I1U8sNe(r3)Contributed Perl DocumenMtoajtoiloincious::Plugin::I18N(3)
2
3
4

NAME

6       Mojolicious::Plugin::I18N - Internationalization Plugin for Mojolicious
7

SYNOPSIS

9         # Mojolicious
10         $self->plugin('I18N');
11         % languages 'de';
12         %=l 'hello'
13
14         # Mojolicious::Lite (detect language from URL, i.e. /en/ or /de/)
15         plugin I18N => {namespace => 'MyApp::I18N', support_url_langs => [qw(en de)]};
16         %=l 'hello'
17
18         # Lexicon
19         package MyApp::I18N::de;
20         use Mojo::Base 'MyApp::I18N';
21
22         our %Lexicon = (hello => 'hallo');
23
24         1;
25

DESCRIPTION

27       Mojolicious::Plugin::I18N is internationalization plugin for
28       Mojolicious It works with Mojolicious 4.0+.
29
30       Old namespace is Mojolicious::Plugin::I18N2.
31

OPTIONS

33       Mojolicious::Plugin::I18N supports the following options.
34
35   "support_url_langs"
36         plugin I18N => {support_url_langs => [qw(en de)]};
37
38       Detect language from URL.
39
40   "support_hosts"
41         plugin I18N => {support_hosts => { 'mojolicious.ru' => 'ru', 'mojolicio.us' => 'en' }};
42
43       Detect Host header and use language for that host.
44
45   "no_header_detect"
46         plugin I18N => {no_header_detect => 1};
47
48       Off header detect.
49
50   "default"
51         plugin I18N => {default => 'en'};
52
53       Default language for i18n, defaults to "en".
54
55   "namespace"
56         plugin I18N => {namespace => 'MyApp::I18N'};
57
58       Lexicon namespace, defaults to the application class followed by
59       "::I18N".
60

HELPERS

62       Mojolicious::Plugin::I18N implements helpers same as
63       Mojolicious::Plugin::I18N.
64
65   "l"
66         %=l 'hello'
67         $self->l('hello');
68
69       Translate sentence.
70
71   "languages"
72         % languages 'de';
73         $self->languages('de');
74
75       Change languages.
76

METHODS

78       Mojolicious::Plugin::I18N inherits all methods from
79       Mojolicious::Plugin::I18N and reimplements the following new ones.
80
81   "register"
82         $plugin->register;
83
84       Register plugin hooks and helpers in Mojolicious application.
85

DEBUG MODE

87       Mojolicious::Plugin::I18N has debug mode.
88
89         # debug mode on
90         BEGIN { $ENV{MOJO_I18N_DEBUG} = 1 };
91
92         # or
93         MOJO_I18N_DEBUG=1 perl script.pl
94

SEE ALSO

96       Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
97

AUTHORS

99       2011-2014 Anatoly Sharifulin <sharifulin@gmail.com>
100
101       2010-2012 Sebastian Riedel <kraihx@googlemail.com>
102

BUGS

104       Please report any bugs or feature requests to
105       "bug-mojolicious-plugin-i18n at rt.cpan.org", or through the web
106       interface at
107       <http://rt.cpan.org/NoAuth/ReportBug.htMail?Queue=Mojolicious-Plugin-I18N>.
108       We will be notified, and then you'll automatically be notified of
109       progress on your bug as we make changes.
110
111       ·    Github
112
113            <http://github.com/sharifulin/mojolicious-plugin-i18n/tree/master>
114
115       ·    RT: CPAN's request tracker
116
117            <http://rt.cpan.org/NoAuth/Bugs.htMail?Dist=Mojolicious-Plugin-I18N>
118
119       ·    AnnoCPAN: Annotated CPAN documentation
120
121            <http://annocpan.org/dist/Mojolicious-Plugin-I18N>
122
123       ·    CPANTS: CPAN Testing Service
124
125            <http://cpants.perl.org/dist/overview/Mojolicious-Plugin-I18N>
126
127       ·    CPAN Ratings
128
129            <http://cpanratings.perl.org/d/Mojolicious-Plugin-I18N>
130
131       ·    Search CPAN
132
133            <http://search.cpan.org/dist/Mojolicious-Plugin-I18N>
134
136       Copyright (C) 2011-2014 by Anatoly Sharifulin.  Copyright (C)
137       2008-2012, Sebastian Riedel.
138
139       This program is free software, you can redistribute it and/or modify it
140       under the terms of the Artistic License version 2.0.
141
142
143
144perl v5.28.0                      2018-07-15      Mojolicious::Plugin::I18N(3)
Impressum