.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" 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 "HTML::FormHandler::TraitFor::I18N 3pm" .TH HTML::FormHandler::TraitFor::I18N 3pm "2022-03-25" "perl v5.34.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" HTML::FormHandler::TraitFor::I18N \- localization .SH "VERSION" .IX Header "VERSION" version 0.40068 .PP \fIlanguage_handle, _build_language_handle\fR .IX Subsection "language_handle, _build_language_handle" .PP Holds a Locale::Maketext (or other duck_type class with a 'maketext' method) language handle. The language handle is used to localize the error messages in the field's 'add_error' method. It's also used in various places in rendering to localize labels and button values, etc. .PP The builder for this attribute gets the Locale::Maketext language handle from the environment variable \f(CW$ENV\fR{\s-1LANGUAGE_HANDLE\s0}: .PP .Vb 1 \& $ENV{LANGUAGE_HANDLE} = \*(Aqen_en\*(Aq; .Ve .PP \&...or creates a default language handler using HTML::FormHandler::I18N. (Note that earlier versions required an actual object reference in \s-1ENV,\s0 which is a bad practice and no longer supported.) You can pass in an existing Locale::MakeText subclass instance or create one in a builder. .PP In a form class: .PP .Vb 1 \& sub _build_language_handle { MyApp::I18N::abc_de\->new } .Ve .PP Passed into new or process: .PP .Vb 2 \& my $lh = MyApp::I18N::abc_de\->new; \& my $form = MyApp::Form\->new( language_handle => $lh ); .Ve .PP If you do not set the language_handle, then Locale::Maketext and/or I18N::LangTags may guess, with unexpected results. .PP You can use non\-Locale::Maketext language handles, such as Data::Localize. There's an example of building a Data::Localize language handle in t/xt/locale_data_localize.t in the distribution. .PP If you don't want a particular error message to go through localization, you can use 'push_errors' and 'push_form_errors' instead of 'add_error' and \&'add_form_errors'. .PP Example of getting the language handle from the Catalyst context (where the Catalyst context is passed in with 'ctx'): .PP .Vb 6 \& has \*(Aq+language_handle\*(Aq => ( builder => \*(Aqget_language_handle_from_ctx\*(Aq ); \& sub get_language_handle_from_ctx { \& my $self = shift; \& return MyApp::I18N\->get_handle( \& @{ $self\->ctx\->languages } ); \& } .Ve .SH "AUTHOR" .IX Header "AUTHOR" FormHandler Contributors \- see HTML::FormHandler .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2017 by Gerda Shank. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.