.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" 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 "CGI::FormBuilder::Messages 3pm" .TH CGI::FormBuilder::Messages 3pm "2019-01-19" "perl v5.28.1" "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" CGI::FormBuilder::Messages \- Localized message support for FormBuilder .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use CGI::FormBuilder::Messages; \& \& my $mesg = CGI::FormBuilder::Messages\->new( \& $file || \e%hash || \*(Aq:locale\*(Aq \& ); \& \& print $mesg\->js_invalid_text; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module handles localization for \fBFormBuilder\fR. It is invoked by specifying the \f(CW\*(C`messages\*(C'\fR option to \fBFormBuilder\fR's \f(CW\*(C`new()\*(C'\fR method. Currently included with \fBFormBuilder\fR are several different locales: .PP .Vb 8 \& English (default) en_US \& Danish da_DK \& German/Deutsch de_DE \& Spanish/Espanol es_ES \& Japanese ja_JP \& Norwegian/Norvegian no_NO \& Turkish tr_TR \& Russian ru_RU .Ve .PP To enable automatic localization that will detect the client's locale and use one of these included locales, simply turn on \f(CW\*(C`auto\*(C'\fR messages: .PP .Vb 1 \& my $form = CGI::FormBuilder\->new(messages => \*(Aqauto\*(Aq); .Ve .PP Or, to use a specific locale, specify it as \*(L":locale\*(R" .PP .Vb 2 \& # Force Danish messages \& my $form = CGI::FormBuilder\->new(messages => \*(Aq:da_DK\*(Aq); .Ve .PP In addition to these included locales, you can completely customize your own messages. Each message that \fBFormBuilder\fR outputs is given a unique key. You can selectively override \fBFormBuilder\fR messages by specifying a different message string for a given message key. .PP To do so, first create a file and give it a unique name. In this example we will use a shortened locale as the suffix: .PP .Vb 5 \& # messages.en \& # FormBuilder messages for "en" locale \& js_invalid_start %s error(s) were found in your form:\en \& js_invalid_end Fix these fields and try again! \& js_invalid_select \- You must choose an option for the "%s" field\en .Ve .PP Then, specify this file to \f(CW\*(C`new()\*(C'\fR. .PP .Vb 1 \& my $form = CGI::FormBuilder\->new(messages => \*(Aqmessages.en\*(Aq); .Ve .PP Alternatively, you could specify this directly as a hashref: .PP .Vb 7 \& my $form = CGI::FormBuilder\->new( \& messages => { \& js_invalid_start => \*(Aq%s error(s) were found in your form:\en\*(Aq, \& js_invalid_end => \*(AqFix these fields and try again!\*(Aq, \& js_invalid_select => \*(Aq\- Choose an option from the "%s" list\en\*(Aq, \& } \& ); .Ve .PP Although in practice this is rarely useful, unless you just want to tweak one or two things. .PP This system is easy, and there are many many messages that can be customized. Here is a list of messages, along with their default values: .PP .Vb 8 \& form_invalid_input Invalid entry \& form_invalid_checkbox Check one or more options \& form_invalid_file Invalid filename \& form_invalid_password Invalid entry \& form_invalid_radio Choose an option \& form_invalid_select Select an option from this list \& form_invalid_textarea Please fill this in \& form_invalid_default Invalid entry \& \& form_invalid_text %s error(s) were encountered with your submission. \& Please correct the fields %shighlighted%s below. \& \& form_required_text Fields that are %shighlighted%s are required. \& \& form_confirm_text Success! Your submission has been received %s. \& \& form_select_default \-select\- \& form_grow_default Additional %s \& form_other_default Other: \& form_reset_default Reset \& form_submit_default Submit \& \& js_noscript Please enable JavaScript or use a newer browser. \& js_invalid_start %s error(s) were encountered with your submission: \& js_invalid_end Please correct these fields and try again. \& \& js_invalid_checkbox \- Check one or more of the "%s" options \& js_invalid_default \- Invalid entry for the "%s" field \& js_invalid_file \- Invalid filename for the "%s" field \& js_invalid_input \- Invalid entry for the "%s" field \& js_invalid_multiple \- Select one or more options from the "%s" list \& js_invalid_password \- Invalid entry for the "%s" field \& js_invalid_radio \- Choose one of the "%s" options \& js_invalid_select \- Select an option from the "%s" list \& js_invalid_textarea \- Please fill in the "%s" field \& \& mail_confirm_subject %s Submission Confirmation \& mail_confirm_text Your submission has been received %s, and will be processed shortly. \& mail_results_subject %s Submission Results .Ve .PP The \f(CW\*(C`js_\*(C'\fR tags are used in JavaScript alerts, whereas the \f(CW\*(C`form_\*(C'\fR tags are used in \s-1HTML\s0 and templates managed by FormBuilder. .PP In some of the messages, you will notice a \f(CW%s\fR \f(CW\*(C`printf\*(C'\fR format. This is because these messages will include certain details for you. For example, the \f(CW\*(C`js_invalid_start\*(C'\fR tag will print the number of errors if you include the \f(CW%s\fR format tag. Of course, this is optional, and you can leave it out. .PP The best way to get an idea of how these work is to experiment a little. It should become obvious really quickly. .SH "TRANSLATORS" .IX Header "TRANSLATORS" Foreign language translations were contributed by the following people: .IP "Danish translation (da_DK)" 4 .IX Item "Danish translation (da_DK)" Jonas Smedegaard .IP "German translation (de_DE)" 4 .IX Item "German translation (de_DE)" Thilo Planz .IP "Spanish translation (es_ES)" 4 .IX Item "Spanish translation (es_ES)" Florian Merges .IP "French translation (fr_FR)" 4 .IX Item "French translation (fr_FR)" Laurent Dami .IP "Japanese translation (ja_JP)" 4 .IX Item "Japanese translation (ja_JP)" Toru Yamaguchi and Thilo Planz .IP "Norwegian translation (no_NO)" 4 .IX Item "Norwegian translation (no_NO)" Steinar Fremme .IP "Turkish translation (tr_TR)" 4 .IX Item "Turkish translation (tr_TR)" Recai Oktaş .PP Thanks! .SH "SEE ALSO" .IX Header "SEE ALSO" CGI::FormBuilder .SH "REVISION" .IX Header "REVISION" \&\f(CW$Id:\fR Messages.pm 100 2007\-03\-02 18:13:13Z nwiger $ .SH "AUTHOR" .IX Header "AUTHOR" Copyright (c) Nate Wiger . All Rights Reserved. .PP This module is free software; you may copy this under the terms of the \s-1GNU\s0 General Public License, or the Artistic License, copies of which should have accompanied your Perl kit.