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">
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:" />
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"> Locale::Language - ISO two letter codes for language identification
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
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>
38 <h1><a name=
"name">NAME
</a></h1>
39 <p>Locale::Language - ISO two letter codes for language identification (ISO
639)
</p>
43 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
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>
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>
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>
67 <dt><strong><a name=
"item_code2language"><code>code2language()
</code></a></strong>
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>
77 $lang = code2language($code);
</pre>
80 <dt><strong><a name=
"item_language2code"><code>language2code()
</code></a></strong>
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>
90 $code = language2code('French');
</pre>
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>
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>
105 <dt><strong><a name=
"item_all_language_codes"><code>all_language_codes()
</code></a></strong>
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>
113 <dt><strong><a name=
"item_all_language_names"><code>all_language_names()
</code></a></strong>
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>
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
130 $| =
1; # turn off buffering
132 print
"Enter language code:
";
133 chop($code =
<STDIN
>);
134 $lang = code2language($code);
137 print
"$code = $lang\n
";
141 print
"'$code' is not a valid language code!\n
";
146 <h1><a name=
"known_bugs_and_limitations">KNOWN BUGS AND LIMITATIONS
</a></h1>
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>
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>
162 <h1><a name=
"see_also">SEE ALSO
</a></h1>
164 <dt><strong><a name=
"item_locale_3a_3acountry">Locale::Country
</a></strong>
167 <p>ISO codes for identification of country (ISO
3166).
168 Supports
2-letter,
3-letter, and numeric country codes.
</p>
171 <dt><strong><a name=
"item_locale_3a_3ascript">Locale::Script
</a></strong>
174 <p>ISO codes for identification of written scripts (ISO
15924).
</p>
177 <dt><strong><a name=
"item_locale_3a_3acurrency">Locale::Currency
</a></strong>
180 <p>ISO three letter codes for identification of currencies and funds (ISO
4217).
</p>
183 <dt><strong><a name=
"item_1988">ISO
639:
1988 (E/F)
</a></strong>
186 <p>Code for the representation of names of languages.
</p>
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>
192 <p>Home page for ISO
639-
2.
</p>
199 <h1><a name=
"author">AUTHOR
</a></h1>
200 <p>Neil Bowers
<<a href=
"mailto:neil@bowers.com">neil@bowers.com
</a>></p>
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"> Locale::Language - ISO two letter codes for language identification
</span></strong></big>