Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / Locale / Language.html
blob5248b5a5e21fd1d1ac27774c296cd0426f8c1872
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>Locale::Language - ISO two letter codes for language identification</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;Locale::Language - ISO two letter codes for language identification</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 <li><a href="#conversion_routines">CONVERSION ROUTINES</a></li>
26 <li><a href="#query_routines">QUERY ROUTINES</a></li>
27 <li><a href="#examples">EXAMPLES</a></li>
28 <li><a href="#known_bugs_and_limitations">KNOWN BUGS AND LIMITATIONS</a></li>
29 <li><a href="#see_also">SEE ALSO</a></li>
30 <li><a href="#author">AUTHOR</a></li>
31 <li><a href="#copyright">COPYRIGHT</a></li>
32 </ul>
33 <!-- INDEX END -->
35 <hr />
36 <p>
37 </p>
38 <h1><a name="name">NAME</a></h1>
39 <p>Locale::Language - ISO two letter codes for language identification (ISO 639)</p>
40 <p>
41 </p>
42 <hr />
43 <h1><a name="synopsis">SYNOPSIS</a></h1>
44 <pre>
45 use Locale::Language;
47 $lang = code2language('en'); # $lang gets 'English'
48 $code = language2code('French'); # $code gets 'fr'
50 @codes = all_language_codes();
51 @names = all_language_names();</pre>
52 <p>
53 </p>
54 <hr />
55 <h1><a name="description">DESCRIPTION</a></h1>
56 <p>The <code>Locale::Language</code> module provides access to the ISO two-letter
57 codes for identifying languages, as defined in ISO 639. You can either
58 access the codes via the <a href="#conversion_routines">conversion routines</a> (described below),
59 or via the two functions which return lists of all language codes or
60 all language names.</p>
61 <p>
62 </p>
63 <hr />
64 <h1><a name="conversion_routines">CONVERSION ROUTINES</a></h1>
65 <p>There are two conversion routines: <a href="#item_code2language"><code>code2language()</code></a> and <a href="#item_language2code"><code>language2code()</code></a>.</p>
66 <dl>
67 <dt><strong><a name="item_code2language"><code>code2language()</code></a></strong>
69 <dd>
70 <p>This function takes a two letter language code and returns a string
71 which contains the name of the language identified. If the code is
72 not a valid language code, as defined by ISO 639, then <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html#item_undef"><code>undef</code></a>
73 will be returned.</p>
74 </dd>
75 <dd>
76 <pre>
77 $lang = code2language($code);</pre>
78 </dd>
79 </li>
80 <dt><strong><a name="item_language2code"><code>language2code()</code></a></strong>
82 <dd>
83 <p>This function takes a language name and returns the corresponding
84 two letter language code, if such exists.
85 If the argument could not be identified as a language name,
86 then <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html#item_undef"><code>undef</code></a> will be returned.</p>
87 </dd>
88 <dd>
89 <pre>
90 $code = language2code('French');</pre>
91 </dd>
92 <dd>
93 <p>The case of the language name is not important.
94 See the section <a href="#known_bugs_and_limitations">KNOWN BUGS AND LIMITATIONS</a> below.</p>
95 </dd>
96 </li>
97 </dl>
98 <p>
99 </p>
100 <hr />
101 <h1><a name="query_routines">QUERY ROUTINES</a></h1>
102 <p>There are two function which can be used to obtain a list of all
103 language codes, or all language names:</p>
104 <dl>
105 <dt><strong><a name="item_all_language_codes"><code>all_language_codes()</code></a></strong>
107 <dd>
108 <p>Returns a list of all two-letter language codes.
109 The codes are guaranteed to be all lower-case,
110 and not in any particular order.</p>
111 </dd>
112 </li>
113 <dt><strong><a name="item_all_language_names"><code>all_language_names()</code></a></strong>
115 <dd>
116 <p>Returns a list of all language names for which there is a corresponding
117 two-letter language code. The names are capitalised, and not returned
118 in any particular order.</p>
119 </dd>
120 </li>
121 </dl>
123 </p>
124 <hr />
125 <h1><a name="examples">EXAMPLES</a></h1>
126 <p>The following example illustrates use of the <a href="#item_code2language"><code>code2language()</code></a> function.
127 The user is prompted for a language code, and then told the corresponding
128 language name:</p>
129 <pre>
130 $| = 1; # turn off buffering
132 print &quot;Enter language code: &quot;;
133 chop($code = &lt;STDIN&gt;);
134 $lang = code2language($code);
135 if (defined $lang)
137 print &quot;$code = $lang\n&quot;;
139 else
141 print &quot;'$code' is not a valid language code!\n&quot;;
142 }</pre>
144 </p>
145 <hr />
146 <h1><a name="known_bugs_and_limitations">KNOWN BUGS AND LIMITATIONS</a></h1>
147 <ul>
148 <li>
149 <p>In the current implementation, all data is read in when the
150 module is loaded, and then held in memory.
151 A lazy implementation would be more memory friendly.</p>
152 </li>
153 <li>
154 <p>Currently just supports the two letter language codes -
155 there are also three-letter codes, and numbers.
156 Would these be of any use to anyone?</p>
157 </li>
158 </ul>
160 </p>
161 <hr />
162 <h1><a name="see_also">SEE ALSO</a></h1>
163 <dl>
164 <dt><strong><a name="item_locale_3a_3acountry">Locale::Country</a></strong>
166 <dd>
167 <p>ISO codes for identification of country (ISO 3166).
168 Supports 2-letter, 3-letter, and numeric country codes.</p>
169 </dd>
170 </li>
171 <dt><strong><a name="item_locale_3a_3ascript">Locale::Script</a></strong>
173 <dd>
174 <p>ISO codes for identification of written scripts (ISO 15924).</p>
175 </dd>
176 </li>
177 <dt><strong><a name="item_locale_3a_3acurrency">Locale::Currency</a></strong>
179 <dd>
180 <p>ISO three letter codes for identification of currencies and funds (ISO 4217).</p>
181 </dd>
182 </li>
183 <dt><strong><a name="item_1988">ISO 639:1988 (E/F)</a></strong>
185 <dd>
186 <p>Code for the representation of names of languages.</p>
187 </dd>
188 </li>
189 <dt><strong><a name="item_http_3a_2f_2flcweb_2eloc_2egov_2fstandards_2fiso63"><a href="http://lcweb.loc.gov/standards/iso639-2/langhome.html">http://lcweb.loc.gov/standards/iso639-2/langhome.html</a></a></strong>
191 <dd>
192 <p>Home page for ISO 639-2.</p>
193 </dd>
194 </li>
195 </dl>
197 </p>
198 <hr />
199 <h1><a name="author">AUTHOR</a></h1>
200 <p>Neil Bowers &lt;<a href="mailto:neil@bowers.com">neil@bowers.com</a>&gt;</p>
202 </p>
203 <hr />
204 <h1><a name="copyright">COPYRIGHT</a></h1>
205 <p>Copyright (C) 2002-2004, Neil Bowers.</p>
206 <p>Copyright (c) 1997-2001 Canon Research Centre Europe (CRE).</p>
207 <p>This module is free software; you can redistribute it and/or
208 modify it under the same terms as Perl itself.</p>
209 <table border="0" width="100%" cellspacing="0" cellpadding="3">
210 <tr><td class="block" style="background-color: #cccccc" valign="middle">
211 <big><strong><span class="block">&nbsp;Locale::Language - ISO two letter codes for language identification</span></strong></big>
212 </td></tr>
213 </table>
215 </body>
217 </html>