
Locale::Country::Multilingual - ISO codes for country identification with multi-language (ISO 3166)

use Locale::Country::Multilingual;
my $lcm = Locale::Country::Multilingual->new();
$country = $lcm->code2country('jp'); # $country gets 'Japan'
$country = $lcm->code2country('chn'); # $country gets 'China'
$country = $lcm->code2country('250'); # $country gets 'France'
$code = $lcm->country2code('Norway'); # $code gets 'no'
$lcm->set_lang('cn'); # set default language to Chinese
$country = $lcm->code2country('cn'); # $country gets 'ä¸å½'
$code = $lcm->country2code('æ¥æ¬'); # $code gets 'jp'
@codes = $lcm->all_country_codes();
@names = $lcm->all_country_names();
# more heavy call
my $lang = 'en';
$country = $lcm->code2country('cn', $lang); # $country gets 'China'
$lang = 'cn';
$country = $lcm->code2country('cn', $lang); # $country gets 'ä¸å½'
my $CODE = 'LOCALE_CODE_ALPHA_2'; # by default
$code = $lcm->country2code('Norway', $CODE); # $code gets 'no'
$CODE = 'LOCALE_CODE_ALPHA_3';
$code = $lcm->country2code('Norway', $CODE); # $code gets 'nor'
$CODE = 'LOCALE_CODE_NUMERIC';
$code = $lcm->country2code('Norway', $CODE); # $code gets '578'
$code = $lcm->country2code('æªå¨', $CODE, 'cn'); # with lang=cn
$CODE = 'LOCALE_CODE_ALPHA_3';
$lang = 'cn';
@codes = $lcm->all_country_codes($CODE); # return codes with 3alpha
@names = $lcm->all_country_names($lang); # get all Chinese Countries Names

other languages are welcome to send by email.


Thanks to michele ongaro for Italian/Spanish/Portuguese/German/French/Japanese dat files.
Thanks to Andreas Marienborg for Norwegian dat file.

Fayland Lam, <fayland at gmail.com>

Copyright 2007-2008 Fayland Lam, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.