.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Catalyst::Plugin::I18N 3pm" .TH Catalyst::Plugin::I18N 3pm "2022-11-27" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::Plugin::I18N \- I18N for Catalyst .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Catalyst \*(AqI18N\*(Aq; \& \& print join \*(Aq \*(Aq, @{ $c\->languages }; \& $c\->languages( [\*(Aqde\*(Aq] ); \& print $c\->localize(\*(AqHello Catalyst\*(Aq); .Ve .PP Use a macro if you're lazy: .PP .Vb 3 \& [% MACRO l(text, args) BLOCK; \& c.localize(text, args); \& END; %] \& \& [% l(\*(AqHello Catalyst\*(Aq) %] \& [% l(\*(AqHello [_1]\*(Aq, \*(AqCatalyst\*(Aq) %] \& [% l(\*(Aqlalala[_1]lalala[_2]\*(Aq, [\*(Aqtest\*(Aq, \*(Aqfoo\*(Aq]) %] \& [% l(\*(Aqmessages.hello.catalyst\*(Aq) %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Supports mo/po files and Maketext classes under your application's I18N namespace. .PP .Vb 3 \& # MyApp/I18N/de.po \& msgid "Hello Catalyst" \& msgstr "Hallo Katalysator" \& \& # MyApp/I18N/i_default.po \& msgid "messages.hello.catalyst" \& msgstr "Hello Catalyst \- fallback translation" \& \& # MyApp/I18N/de.pm \& package MyApp::I18N::de; \& use base \*(AqMyApp::I18N\*(Aq; \& our %Lexicon = ( \*(AqHello Catalyst\*(Aq => \*(AqHallo Katalysator\*(Aq ); \& 1; .Ve .SS "\s-1CONFIGURATION\s0" .IX Subsection "CONFIGURATION" You can override any parameter sent to Locale::Maketext::Simple by specifying a \f(CW\*(C`maketext_options\*(C'\fR hashref to the \f(CW\*(C`Plugin::I18N\*(C'\fR config section. For example, the following configuration will override the \f(CW\*(C`Decode\*(C'\fR parameter which normally defaults to \f(CW1\fR: .PP .Vb 6 \& _\|_PACKAGE_\|_\->config( \& \*(AqPlugin::I18N\*(Aq => \& maketext_options => { \& Decode => 0 \& } \& ); .Ve .PP All languages fallback to MyApp::I18N which is mapped onto the i\-default language tag. If you use arbitrary message keys, use i_default.po to translate into English, otherwise the message key itself is returned. .SS "\s-1EXTENDED METHODS\s0" .IX Subsection "EXTENDED METHODS" \fIsetup\fR .IX Subsection "setup" .SS "\s-1METHODS\s0" .IX Subsection "METHODS" \fIlanguages\fR .IX Subsection "languages" .PP Contains languages. .PP .Vb 2 \& $c\->languages([\*(Aqde_DE\*(Aq]); \& print join \*(Aq\*(Aq, @{ $c\->languages }; .Ve .PP \fIlanguage\fR .IX Subsection "language" .PP return selected locale in your locales list. .PP \fIlanguage_tag\fR .IX Subsection "language_tag" .PP return language tag for current locale. The most notable difference from this method in comparison to \f(CW\*(C`language()\*(C'\fR is typically that languages and regions are joined with a dash and not an underscore. .PP .Vb 2 \& $c\->language(); # en_us \& $c\->language_tag(); # en\-us .Ve .PP \fIinstalled_languages\fR .IX Subsection "installed_languages" .PP Returns a hash of { langtag => \*(L"descriptive name for language\*(R" } based on language files in your application's I18N directory. The descriptive name is based on I18N::LangTags::List information. If the descriptive name is not available, will be undef. .PP \fIloc\fR .IX Subsection "loc" .PP \fIlocalize\fR .IX Subsection "localize" .PP Localize text. .PP .Vb 1 \& print $c\->localize( \*(AqWelcome to Catalyst, [_1]\*(Aq, \*(Aqsri\*(Aq ); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Catalyst .SH "AUTHORS" .IX Header "AUTHORS" Sebastian Riedel .PP Brian Cassidy .PP Christian Hansen .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (c) 2005 \- 2009 the Catalyst::Plugin::I18N \*(L"\s-1AUTHORS\*(R"\s0 as listed above. .PP This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.