1CGI::FormBuilder::MessaUgseesr(3C)ontributed Perl DocumeCnGtIa:t:iFoonrmBuilder::Messages(3)
2
3
4

NAME

6       CGI::FormBuilder::Messages - Localized message support for FormBuilder
7

SYNOPSIS

9           use CGI::FormBuilder::Messages;
10
11           my $mesg = CGI::FormBuilder::Messages->new(
12                           $file ⎪⎪ \%hash ⎪⎪ ':locale'
13                      );
14
15           print $mesg->js_invalid_text;
16

DESCRIPTION

18       This module handles localization for FormBuilder. It is invoked by
19       specifying the "messages" option to FormBuilder's  "new()" method.
20       Currently included with FormBuilder are several different locales:
21
22           English (default)    en_US
23           Danish               da_DK
24           German/Deutsch       de_DE
25           Spanish/Espanol      es_ES
26           Japanese             ja_JP
27           Norwegian/Norvegian  no_NO
28           Turkish              tr_TR
29
30       To enable automatic localization that will detect the client's locale
31       and use one of these included locales, simply turn on "auto" messages:
32
33           my $form = CGI::FormBuilder->new(messages => 'auto');
34
35       Or, to use a specific locale, specify it as ":locale"
36
37           # Force Danish messages
38           my $form = CGI::FormBuilder->new(messages => ':da_DK');
39
40       In addition to these included locales, you can completely customize
41       your own messages. Each message that FormBuilder outputs is given a
42       unique key.  You can selectively override FormBuilder messages by spec‐
43       ifying a different message string for a given message key.
44
45       To do so, first create a file and give it a unique name. In this exam‐
46       ple we will use a shortened locale as the suffix:
47
48           # messages.en
49           # FormBuilder messages for "en" locale
50           js_invalid_start      %s error(s) were found in your form:\n
51           js_invalid_end        Fix these fields and try again!
52           js_invalid_select     - You must choose an option for the "%s" field\n
53
54       Then, specify this file to "new()".
55
56           my $form = CGI::FormBuilder->new(messages => 'messages.en');
57
58       Alternatively, you could specify this directly as a hashref:
59
60           my $form = CGI::FormBuilder->new(
61                 messages => {
62                     js_invalid_start  => '%s error(s) were found in your form:\n',
63                     js_invalid_end    => 'Fix these fields and try again!',
64                     js_invalid_select => '- Choose an option from the "%s" list\n',
65                 }
66              );
67
68       Although in practice this is rarely useful, unless you just want to
69       tweak one or two things.
70
71       This system is easy, and there are many many messages that can be cus‐
72       tomized.  Here is a list of messages, along with their default values:
73
74           form_invalid_input          Invalid entry
75           form_invalid_checkbox       Check one or more options
76           form_invalid_file           Invalid filename
77           form_invalid_password       Invalid entry
78           form_invalid_radio          Choose an option
79           form_invalid_select         Select an option from this list
80           form_invalid_textarea       Please fill this in
81           form_invalid_default        Invalid entry
82
83           form_invalid_text           %s error(s) were encountered with your submission.
84                                       Please correct the fields %shighlighted%s below.
85
86           form_required_text          Fields that are %shighlighted%s are required.
87
88           form_confirm_text           Success! Your submission has been received %s.
89
90           form_select_default         -select-
91           form_grow_default           Additional %s
92           form_other_default          Other:
93           form_reset_default          Reset
94           form_submit_default         Submit
95
96           js_noscript                 Please enable JavaScript or use a newer browser.
97           js_invalid_start            %s error(s) were encountered with your submission:
98           js_invalid_end              Please correct these fields and try again.
99
100           js_invalid_checkbox         - Check one or more of the "%s" options
101           js_invalid_default          - Invalid entry for the "%s" field
102           js_invalid_file             - Invalid filename for the "%s" field
103           js_invalid_input            - Invalid entry for the "%s" field
104           js_invalid_multiple         - Select one or more options from the "%s" list
105           js_invalid_password         - Invalid entry for the "%s" field
106           js_invalid_radio            - Choose one of the "%s" options
107           js_invalid_select           - Select an option from the "%s" list
108           js_invalid_textarea         - Please fill in the "%s" field
109
110           mail_confirm_subject        %s Submission Confirmation
111           mail_confirm_text           Your submission has been received %s, and will be processed shortly.
112           mail_results_subject        %s Submission Results
113
114       The "js_" tags are used in JavaScript alerts, whereas the "form_" tags
115       are used in HTML and templates managed by FormBuilder.
116
117       In some of the messages, you will notice a %s "printf" format. This is
118       because these messages will include certain details for you. For exam‐
119       ple, the "js_invalid_start" tag will print the number of errors if you
120       include the %s format tag. Of course, this is optional, and you can
121       leave it out.
122
123       The best way to get an idea of how these work is to experiment a lit‐
124       tle.  It should become obvious really quickly.
125

TRANSLATORS

127       Foreign language translations were contributed by the following people:
128
129       Danish translation (da_DK)
130           Jonas Smedegaard
131
132       German translation (de_DE)
133           Thilo Planz
134
135       Spanish translation (es_ES)
136           Florian Merges
137
138       French translation (fr_FR)
139           Laurent Dami
140
141       Japanese translation (ja_JP)
142           Toru Yamaguchi and Thilo Planz
143
144       Norwegian translation (no_NO)
145           Steinar Fremme
146
147       Turkish translation (tr_TR)
148           Recai Oktaş
149
150       Thanks!
151

SEE ALSO

153       CGI::FormBuilder
154

REVISION

156       $Id: Messages.pm 100 2007-03-02 18:13:13Z nwiger $
157

AUTHOR

159       Copyright (c) 2000-2006 Nate Wiger <nate@wiger.org>. All Rights
160       Reserved.
161
162       This module is free software; you may copy this under the terms of the
163       GNU General Public License, or the Artistic License, copies of which
164       should have accompanied your Perl kit.
165
166
167
168perl v5.8.8                       2007-03-02     CGI::FormBuilder::Messages(3)
Impressum