home *** CD-ROM | disk | FTP | other *** search
Wrap
<HTML> <HEAD> <TITLE>Locale::Language - ISO two letter codes for language identification</TITLE> <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css"> <LINK REV="made" HREF="mailto:"> </HEAD> <BODY> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc"> <STRONG><P CLASS=block> Locale::Language - ISO two letter codes for language identification</P></STRONG> </TD></TR> </TABLE> <A NAME="__index__"></A> <!-- INDEX BEGIN --> <UL> <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI> <LI><A HREF="#synopsis">SYNOPSIS</A></LI> <LI><A HREF="#description">DESCRIPTION</A></LI> <LI><A HREF="#conversion routines">CONVERSION ROUTINES</A></LI> <LI><A HREF="#query routines">QUERY ROUTINES</A></LI> <LI><A HREF="#examples">EXAMPLES</A></LI> <LI><A HREF="#known bugs and limitations">KNOWN BUGS AND LIMITATIONS</A></LI> <LI><A HREF="#see also">SEE ALSO</A></LI> <LI><A HREF="#author">AUTHOR</A></LI> <LI><A HREF="#copyright">COPYRIGHT</A></LI> </UL> <!-- INDEX END --> <HR> <P> <H1><A NAME="name">NAME</A></H1> <P>Locale::Language - ISO two letter codes for language identification (ISO 639)</P> <P> <HR> <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1> <UL> <LI>Linux</LI> <LI>Solaris</LI> <LI>Windows</LI> </UL> <HR> <H1><A NAME="synopsis">SYNOPSIS</A></H1> <PRE> use Locale::Language; </PRE> <PRE> $lang = code2language('en'); # $lang gets 'English' $code = language2code('French'); # $code gets 'fr'</PRE> <PRE> @codes = all_language_codes(); @names = all_language_names();</PRE> <P> <HR> <H1><A NAME="description">DESCRIPTION</A></H1> <P>The <CODE>Locale::Language</CODE> module provides access to the ISO two-letter codes for identifying languages, as defined in ISO 639. You can either access the codes via the <A HREF="#conversion routines">conversion routines</A> (described below), or with the two functions which return lists of all language codes or all language names.</P> <P> <HR> <H1><A NAME="conversion routines">CONVERSION ROUTINES</A></H1> <P>There are two conversion routines: <A HREF="#item_code2language"><CODE>code2language()</CODE></A> and <A HREF="#item_language2code"><CODE>language2code()</CODE></A>.</P> <DL> <DT><STRONG><A NAME="item_code2language"><CODE>code2language()</CODE></A></STRONG><BR> <DD> This function takes a two letter language code and returns a string which contains the name of the language identified. If the code is not a valid language code, as defined by ISO 639, then <A HREF="../../../lib/Pod/perlfunc.html#item_undef"><CODE>undef</CODE></A> will be returned. <PRE> $lang = code2language($code);</PRE> <P></P> <DT><STRONG><A NAME="item_language2code"><CODE>language2code()</CODE></A></STRONG><BR> <DD> This function takes a language name and returns the corresponding two letter language code, if such exists. If the argument could not be identified as a language name, then <A HREF="../../../lib/Pod/perlfunc.html#item_undef"><CODE>undef</CODE></A> will be returned. <PRE> $code = language2code('French');</PRE> <P>The case of the language name is not important. See the section <A HREF="#known bugs and limitations">KNOWN BUGS AND LIMITATIONS</A> below.</P> <P></P></DL> <P> <HR> <H1><A NAME="query routines">QUERY ROUTINES</A></H1> <P>There are two function which can be used to obtain a list of all language codes, or all language names:</P> <DL> <DT><STRONG><A NAME="item_all_language_codes"><CODE>all_language_codes()</CODE></A></STRONG><BR> <DD> Returns a list of all two-letter language codes. The codes are guaranteed to be all lower-case, and not in any particular order. <P></P> <DT><STRONG><A NAME="item_all_language_names"><CODE>all_language_names()</CODE></A></STRONG><BR> <DD> Returns a list of all language names for which there is a corresponding two-letter language code. The names are capitalised, and not returned in any particular order. <P></P></DL> <P> <HR> <H1><A NAME="examples">EXAMPLES</A></H1> <P>The following example illustrates use of the <A HREF="#item_code2language"><CODE>code2language()</CODE></A> function. The user is prompted for a language code, and then told the corresponding language name:</P> <PRE> $| = 1; # turn off buffering </PRE> <PRE> print "Enter language code: "; chop($code = <STDIN>); $lang = code2language($code); if (defined $lang) { print "$code = $lang\n"; } else { print "'$code' is not a valid language code!\n"; }</PRE> <P> <HR> <H1><A NAME="known bugs and limitations">KNOWN BUGS AND LIMITATIONS</A></H1> <UL> <LI> In the current implementation, all data is read in when the module is loaded, and then held in memory. A lazy implementation would be more memory friendly. <P></P></UL> <P> <HR> <H1><A NAME="see also">SEE ALSO</A></H1> <DL> <DT><STRONG><A NAME="item_Locale%3A%3ACountry">Locale::Country</A></STRONG><BR> <DD> ISO two letter codes for identification of country (ISO 3166). <P></P> <DT><STRONG><A NAME="item_1988">ISO 639:1988 (E/F)</A></STRONG><BR> <DD> Code for the representation of names of languages. <P></P></DL> <P> <HR> <H1><A NAME="author">AUTHOR</A></H1> <P>Neil Bowers <<A HREF="mailto:neilb@cre.canon.co.uk">neilb@cre.canon.co.uk</A>></P> <P> <HR> <H1><A NAME="copyright">COPYRIGHT</A></H1> <P>Copyright (c) 1997 Canon Research Centre Europe (CRE).</P> <P>This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</P> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%> <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc"> <STRONG><P CLASS=block> Locale::Language - ISO two letter codes for language identification</P></STRONG> </TD></TR> </TABLE> </BODY> </HTML>