1N/A
1N/A=head1 NAME
1N/A
1N/ALocale::Language - ISO two letter codes for language identification (ISO 639)
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use Locale::Language;
1N/A
1N/A $lang = code2language('en'); # $lang gets 'English'
1N/A $code = language2code('French'); # $code gets 'fr'
1N/A
1N/A @codes = all_language_codes();
1N/A @names = all_language_names();
1N/A
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThe C<Locale::Language> module provides access to the ISO two-letter
1N/Acodes for identifying languages, as defined in ISO 639. You can either
1N/Aaccess the codes via the L<conversion routines> (described below),
1N/Aor via the two functions which return lists of all language codes or
1N/Aall language names.
1N/A
1N/A
1N/A=head1 CONVERSION ROUTINES
1N/A
1N/AThere are two conversion routines: C<code2language()> and C<language2code()>.
1N/A
1N/A=over 4
1N/A
1N/A=item code2language()
1N/A
1N/AThis function takes a two letter language code and returns a string
1N/Awhich contains the name of the language identified. If the code is
1N/Anot a valid language code, as defined by ISO 639, then C<undef>
1N/Awill be returned.
1N/A
1N/A $lang = code2language($code);
1N/A
1N/A=item language2code()
1N/A
1N/AThis function takes a language name and returns the corresponding
1N/Atwo letter language code, if such exists.
1N/AIf the argument could not be identified as a language name,
1N/Athen C<undef> will be returned.
1N/A
1N/A $code = language2code('French');
1N/A
1N/AThe case of the language name is not important.
1N/ASee the section L<KNOWN BUGS AND LIMITATIONS> below.
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 QUERY ROUTINES
1N/A
1N/AThere are two function which can be used to obtain a list of all
1N/Alanguage codes, or all language names:
1N/A
1N/A=over 4
1N/A
1N/A=item C<all_language_codes()>
1N/A
1N/AReturns a list of all two-letter language codes.
1N/AThe codes are guaranteed to be all lower-case,
1N/Aand not in any particular order.
1N/A
1N/A=item C<all_language_names()>
1N/A
1N/AReturns a list of all language names for which there is a corresponding
1N/Atwo-letter language code. The names are capitalised, and not returned
1N/Ain any particular order.
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 EXAMPLES
1N/A
1N/AThe following example illustrates use of the C<code2language()> function.
1N/AThe user is prompted for a language code, and then told the corresponding
1N/Alanguage name:
1N/A
1N/A $| = 1; # turn off buffering
1N/A
1N/A print "Enter language code: ";
1N/A chop($code = <STDIN>);
1N/A $lang = code2language($code);
1N/A if (defined $lang)
1N/A {
1N/A print "$code = $lang\n";
1N/A }
1N/A else
1N/A {
1N/A print "'$code' is not a valid language code!\n";
1N/A }
1N/A
1N/A=head1 KNOWN BUGS AND LIMITATIONS
1N/A
1N/A=over 4
1N/A
1N/A=item *
1N/A
1N/AIn the current implementation, all data is read in when the
1N/Amodule is loaded, and then held in memory.
1N/AA lazy implementation would be more memory friendly.
1N/A
1N/A=item *
1N/A
1N/ACurrently just supports the two letter language codes -
1N/Athere are also three-letter codes, and numbers.
1N/AWould these be of any use to anyone?
1N/A
1N/A=back
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/A=over 4
1N/A
1N/A=item Locale::Country
1N/A
1N/AISO codes for identification of country (ISO 3166).
1N/ASupports 2-letter, 3-letter, and numeric country codes.
1N/A
1N/A=item Locale::Script
1N/A
1N/AISO codes for identification of written scripts (ISO 15924).
1N/A
1N/A=item Locale::Currency
1N/A
1N/AISO three letter codes for identification of currencies and funds (ISO 4217).
1N/A
1N/A=item ISO 639:1988 (E/F)
1N/A
1N/ACode for the representation of names of languages.
1N/A
1N/A=item http://lcweb.loc.gov/standards/iso639-2/langhome.html
1N/A
1N/AHome page for ISO 639-2.
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 AUTHOR
1N/A
1N/ANeil Bowers E<lt>neil@bowers.comE<gt>
1N/A
1N/A=head1 COPYRIGHT
1N/A
1N/ACopyright (C) 2002, Neil Bowers.
1N/A
1N/ACopyright (c) 1997-2001 Canon Research Centre Europe (CRE).
1N/A
1N/AThis module is free software; you can redistribute it and/or
1N/Amodify it under the same terms as Perl itself.
1N/A
1N/A=cut
1N/A