The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

THIS MODULE IS DEPRECATED

This POD documents the deprecated legacy system (pre v0.06)

New code should use the more modern, efficient, and CLDR based Locales object system.

NAME

Locales::Language - (DEPRECATED use Locales instead) ISO two letter codes for language identification (ISO 639)

SYNOPSIS

Classic Style:

    use Locale::Language;  # use environment language
    
    my $lang  = code2language ( 'en' );      # $lang gets 'English'
    my $code  = language2code ( 'French' );  # $code gets 'fr'
    
    my @codes = all_language_codes();
    my @names = all_language_names();

Classic Style With New Default Language:

    use utf8;
    use Locale::Language ( 'de' );  # use German language
    
    my $lang  = code2language ( 'en' );           # $lang gets 'Englisch'
    my $code  = language2code ( 'Französisch' );  # $code gets 'fr'
    
    my @codes = all_language_codes();
    my @names = all_language_names();  # gets list of names in German

    # set default Language to French
    Locales::Language::setLocale ( 'fr' );
    
    $lang  = code2language ( 'en' );              # $lang gets 'Anglais'
    $code  = language2code ( 'Français' );        # $code gets 'fr'

Object Oriented Style:

    use utf8;
    require Locales::Language;

    my $am = new Locales::Language ( "am" );
    my $de = new Locales::Language ( "de" );

    print $am->getLocale, " => ",
          $am->code2language ( "en" ), " / ",
          $am->language2code ( "እንግሊዝኛ" ), "\n";
    print $de->getLocale, " => ",
          $de->code2language ( "en" ), " / ",
          $de->language2code ( "Englisch" ), "\n";

    my @codes   = $am->all_language_codes();
    my @deNames = $de->all_language_names();

Object Oriented Style With New Default Language:

    use utf8;
    use Locale::Language ( 'de' );  # use German language

    my $de = new Locales::Language;

    print $de->getLocale, " => ",
          $de->code2language ( "en" ), " / ",
          $de->language2code ( "Englisch" ), "\n";

      :

DESCRIPTION

The Locale::Language 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 "conversion routines" (described below), or via the two functions which return lists of all language codes or all language names.

CONVERSION ROUTINES

There are two conversion routines: code2language() and language2code().

code2language()

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 undef will be returned.

    $lang = code2language($code);
language2code()

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 undef will be returned.

    $code = language2code('French');

The case of the language name is not important. See the section "KNOWN BUGS AND LIMITATIONS" below.

QUERY ROUTINES

There are two functions which can be used to obtain a list of all language codes, or all language names:

all_language_codes()

Returns a list of all two-letter language codes. The codes are guaranteed to be all lower-case, and not in any particular order.

all_language_names()

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.

BUGS AND LIMITATIONS

  • Currently just supports the two letter language codes - there are also three-letter codes, and numbers. Would these be of any use to anyone?

COPYRIGHT

Portions of the documentation of the module come directly from Locale::Language which was composed by Neil Bowers and contains the following copyright:

Copyright (C) 2002, Neil Bowers <neil@bowers.com>

Copyright (C) 1997-2001 Canon Research Centre Europe (CRE).

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Daniel Yacob, dyacob@cpan.org

Neil Bowers neil@bowers.com (Documentation)

SEE ALSO

Locales::Country

ISO codes for identification of country (ISO 3166). Supports 2-letter, 3-letter, and numeric country codes.

ISO 639:1988 (E/F)

Code for the representation of names of languages.

http://lcweb.loc.gov/standards/iso639-2/langhome.html

Home page for ISO 639-2.

http://www.icu-project.org/

Home page for ICU. The data used in Locales:: comes directly from the ICU CVS repository.

Example Scripts

Provided with this package examples/language*.pl

1 POD Error

The following errors were encountered while parsing the POD:

Around line 104:

Non-ASCII character seen before =encoding in ''Französisch''. Assuming UTF-8