Showing posts with label language. Show all posts
Showing posts with label language. Show all posts

Saturday, April 25, 2009

Getting Languages list in Java

In this post: Getting countries list in Java I wrote about how to get countries list in Java. Getting languages list is quite similar. In fact by making small changes to the code on the countries post languages list can be easily taken.

In order to get the countries list we used this static method of Locale class: Locale.getISOCountries(). Getting languages list is quite similar and can be taken by using this method: Locale.getISOLanguages(). This method returns String array containing all language codes compatible with ISO 639 standard (2 letters code).

Similar to the countries list, we will use a class named Language to store information of a single language:

package com.bashan.blog;
public class Language {
  private String languageCode;
  private String name;
  public Language() {
  }
  public Language(String languageCode, String name) {
    this.languageCode = languageCode;
    this.name = name;
  }
  public String getLanguageCode() {
    return languageCode;
  }
  public void setLanguageCode(String languageCode) {
    this.languageCode = languageCode;
  }
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
  public String toString() {
    return languageCode + ", " + name;
  }
}
And the class LanguageUtil is very similar to CountyUtil, but instead of countries it returns languages:
package com.bashan.blog;
import java.util.*;
public class LanguageUtil {
  public static List<Language> getLanguages(final Locale inLocale) {
    String[] languageCodes = Locale.getISOLanguages();
    List<Language> languages = new ArrayList<Language>(languageCodes.length);
    for (String languageCode : languageCodes) {
      languages.add(new Language(languageCode, new Locale(languageCode, "").getDisplayLanguage(inLocale)));
    }
    Collections.sort(languages, new Comparator<Language>() {
      public int compare(Language c1, Language c2) {
        return c1.getName().compareTo(c2.getName());
      }
    });
    return languages;
  }
  public static Map<String, String> getLanguagesMap(final Locale inLocale) {
    List<Language> countries = getLanguages(inLocale);
    Map<String, String> countriesMap = new LinkedHashMap<String, String>(countries.size());
    for (Language country : countries) {
      countriesMap.put(country.getLanguageCode(), country.getName());
    }
    return countriesMap;
  }
  public static void printLanguages(List<Language> languages) {
    for (Language language : languages) {
      System.out.println(language);
    }
  }
  public static void main(String[] args) {
    // Get list of countries in US English
    System.out.println("---- List of languages in English ----");
    List<Language> languages = getLanguages(Locale.US);
    printLanguages(languages);
    System.out.println("\n\n---- List of languages in Japanese ----");
    // Get list of countries in Japanese
    languages = getLanguages(Locale.JAPANESE);
    printLanguages(languages);
  }
}

And the output for our small test program, which prints all languages once in English and once in Japanese:
---- List of languages in English ----
ab, Abkhazian
aa, Afar
af, Afrikaans
ak, Akan
sq, Albanian
am, Amharic
ar, Arabic
an, Aragonese
hy, Armenian
as, Assamese
av, Avaric
ae, Avestan
ay, Aymara
az, Azerbaijani
bm, Bambara
ba, Bashkir
eu, Basque
be, Belarusian
bn, Bengali
bh, Bihari
bi, Bislama
bs, Bosnian
br, Breton
bg, Bulgarian
my, Burmese
ca, Catalan
ch, Chamorro
ce, Chechen
zh, Chinese
cu, Church Slavic
cv, Chuvash
kw, Cornish
co, Corsican
cr, Cree
hr, Croatian
cs, Czech
da, Danish
dv, Divehi
nl, Dutch
dz, Dzongkha
en, English
eo, Esperanto
et, Estonian
ee, Ewe
fo, Faroese
fj, Fijian
fi, Finnish
fr, French
fy, Frisian
ff, Fulah
gl, Gallegan
lg, Ganda
ka, Georgian
de, German
el, Greek
kl, Greenlandic
gn, Guarani
gu, Gujarati
ht, Haitian
ha, Hausa
he, Hebrew
iw, Hebrew
hz, Herero
hi, Hindi
ho, Hiri Motu
hu, Hungarian
is, Icelandic
io, Ido
ig, Igbo
id, Indonesian
in, Indonesian
ia, Interlingua
ie, Interlingue
iu, Inuktitut
ik, Inupiaq
ga, Irish
it, Italian
ja, Japanese
jv, Javanese
kn, Kannada
kr, Kanuri
ks, Kashmiri
kk, Kazakh
km, Khmer
ki, Kikuyu
rw, Kinyarwanda
ky, Kirghiz
kv, Komi
kg, Kongo
ko, Korean
ku, Kurdish
kj, Kwanyama
lo, Lao
la, Latin
lv, Latvian
li, Limburgish
ln, Lingala
lt, Lithuanian
lu, Luba-Katanga
lb, Luxembourgish
mk, Macedonian
mg, Malagasy
ms, Malay
ml, Malayalam
mt, Maltese
gv, Manx
mi, Maori
mr, Marathi
mh, Marshallese
mo, Moldavian
mn, Mongolian
na, Nauru
nv, Navajo
ng, Ndonga
ne, Nepali
nd, North Ndebele
se, Northern Sami
no, Norwegian
nb, Norwegian Bokmål
nn, Norwegian Nynorsk
ny, Nyanja
oc, Occitan
oj, Ojibwa
or, Oriya
om, Oromo
os, Ossetian
pi, Pali
pa, Panjabi
fa, Persian
pl, Polish
pt, Portuguese
ps, Pushto
qu, Quechua
rm, Raeto-Romance
ro, Romanian
rn, Rundi
ru, Russian
sm, Samoan
sg, Sango
sa, Sanskrit
sc, Sardinian
gd, Scottish Gaelic
sr, Serbian
sn, Shona
ii, Sichuan Yi
sd, Sindhi
si, Sinhalese
sk, Slovak
sl, Slovenian
so, Somali
nr, South Ndebele
st, Southern Sotho
es, Spanish
su, Sundanese
sw, Swahili
ss, Swati
sv, Swedish
tl, Tagalog
ty, Tahitian
tg, Tajik
ta, Tamil
tt, Tatar
te, Telugu
th, Thai
bo, Tibetan
ti, Tigrinya
to, Tonga
ts, Tsonga
tn, Tswana
tr, Turkish
tk, Turkmen
tw, Twi
ug, Uighur
uk, Ukrainian
ur, Urdu
uz, Uzbek
ve, Venda
vi, Vietnamese
vo, Volapük
wa, Walloon
cy, Welsh
wo, Wolof
xh, Xhosa
ji, Yiddish
yi, Yiddish
yo, Yoruba
za, Zhuang
zu, Zulu


---- List of languages in Japanese ----
is, アイスランド語
ay, アイマラ語
ga, アイルランド語
ak, アカン語
az, アゼルバイジャン語
as, アッサム語
aa, アファール語
af, アフリカーンス語
ab, アブハズ語
am, アムハラ語
an, アラゴン語
ar, アラビア語
sq, アルバニア語
hy, アルメニア語
av, アヴァル語
ae, アヴェスタ語
it, イタリア語
ji, イディッシュ語
yi, イディッシュ語
io, イド語
iu, イヌクウティトット語
ik, イヌピアック語
ig, イボ語
id, インドネシア語
in, インドネシア語
ug, ウイグル語
cy, ウェールズ語
wo, ウォロフ語
uk, ウクライナ語
uz, ウズベク語
ur, ウルドゥー語
ee, エウェ語
et, エストニア語
eo, エスペラント語
oj, オジブワ語
os, オセチア語
nl, オランダ語
or, オリヤー語
kk, カザフ語
ks, カシミール語
ca, カタロニア語
kr, カヌリ語
kn, カンナダ語
km, カンボジア語
om, ガラ語
gl, ガリシア語
lg, ガンダ語
ki, キクユ語
ky, キルギス語
el, ギリシア語
kj, クゥニャマ語
cr, クリー語
ku, クルド語
hr, クロアチア語
gu, グジャラート語
kl, グリーンランド語
ka, グルジア語
gn, グワラニ語
qu, ケチュア語
xh, コサ語
kv, コミ語
co, コルシカ語
kg, コンゴ語
kw, コーンウォール語
sm, サモア語
sc, サルディニア語
sg, サンゴ語
sa, サンスクリット語
ss, シスワティ語
sn, ショナ語
sd, シンド語
si, シンハラ語
jv, ジャワ語
sv, スウェーデン語
gd, スコットランド・ゲール語
es, スペイン語
sk, スロバキア語
sl, スロベニア語
sw, スワヒリ語
su, スンダ語
zu, ズールー語
st, セソト語
sr, セルビア語
so, ソマリ語
th, タイ語
tl, タガログ語
tg, タジク語
tt, タタール語
ty, タヒチ語
ta, タミール語
cs, チェコ語
ce, チェチェン語
bo, チベット語
ch, チャモロ語
cv, チュヴァシュ語
za, チワン語
ts, ツォンガ語
tn, ツワナ語
ti, ティグリニア語
te, テルグ語
dv, ディベヒ語
da, デンマーク語
tw, トゥイ語
tk, トルクメン語
tr, トルコ語
to, トンガ語
de, ドイツ語
na, ナウル語
nv, ナバホ語
ny, ニャンジャ語
ne, ネパール語
no, ノルウェー語
nn, ノルウェー語 (ニューノルスク)
nb, ノルウェー語 (ボークモール)
ht, ハイチ語
ha, ハウサ語
hu, ハンガリー語
ba, バシキール語
eu, バスク語
bm, バンバラ語
ps, パシュトー語
pa, パンジャブ語
pi, パーリ語
ho, ヒリ・モツ語
hi, ヒンディー語
bi, ビスラマ語
bh, ビハール語
my, ビルマ語
fj, フィジー語
fi, フィンランド語
fo, フェロー語
fr, フランス語
ff, フラ語
fy, フリジア語
bg, ブルガリア語
br, ブルトン語
dz, ブータン語
oc, プロバンス語
he, ヘブライ語
iw, ヘブライ語
hz, ヘレロ語
vi, ベトナム語
bn, ベンガル語
ve, ベンダ語
fa, ペルシア語
bs, ボスニア語
vo, ボラピュク語
pt, ポルトガル語
pl, ポーランド語
mi, マオリ語
mk, マケドニア語
ms, マライ語
mg, マラガシー語
ml, マラヤーラム語
mr, マラーティー語
mt, マルタ語
gv, マン島語
mh, マーシャル語
mo, モルダビア語
mn, モンゴル語
yo, ヨルバ語
lo, ラオ語
la, ラテン語
lv, ラトビア語 (レット語)
lt, リトアニア語
ln, リンガラ語
li, リンブルグ語
lb, ルクセンブルク語
lu, ルバ語
rw, ルワンダ語
rn, ルンジ語
ro, ルーマニア語
rm, レト=ロマン語
ru, ロシア語
wa, ワロン語
ng, ンドンガ語
zh, 中国語
se, 北サミ語
nd, 北ンデベレ語
nr, 南ンデベレ語
ii, 四川語
ia, 国際語
ie, 国際語
cu, 教会スラブ語
ja, 日本語
be, 白ロシア語
en, 英語
ko, 韓国語

Monday, March 30, 2009

Getting Countries list in Java

Most modern web applications need to show somewhere a dropdown or a list containing all countries. Getting the list of all countries is solved in all sort of ways:

  • Building a database table containing all countries.
  • Storing all list of countries in a file.
  • Build a hard coded list or array of all countries.

One additional way, is using java to get all list of countries. The benefit of using Java to do the Job, is that Java can produce the list of countries in any desired language. This is good for internationalized web applications. Another good reason, is maintenance. On each new release the data is kept updated. Country names and and country codes are not changed and added often, but changes do happen from time to time and it is best to be updated with no effort.

The list of countries can be generated by calling the method of Locale class: getISOCountries(). This method returns string array all all the exiting country codes in ISO 3116-1 alpha-2 (2 letter) standard.

From this list it is very easy to create Locales for all countries. By calling the Locale method: getDisplayCountry(), the name of the country can be retrieved. Calling this method with a given Locale returns the name of the country in the specific language of the locale. By the way, I noted that Java did not implemented completely the getDisplayCountry() for all languages. For example, if you would like to get the list of countries in Hebrew, the only country that is returned actually in Hebrew is Israel. I believe that over time Java will include translations for all languages.

After generating list of countries for a specific language, we will sort the list. Of course that the list will be sorted according to the chosen language.

We will use a basic Country class for representing a single country, this class has only 2 members: country code and name:

public class Country {
    private String countryCode;
    private String name;
    public Country(String countryCode, String name)
    {
        this.countryCode = countryCode;
        this.name = name;
    }
    public String getCountryCode() {
        return countryCode;
    }
    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String toString()
    {
        return countryCode + ", " + name;
    }
}

And the CountryUtil class for generating list of countries for a specifc language.

This class has 2 methods:

  • getCountries: This method returns list of Country objects of all countries in a specific desired language (Locale).
  • getCountriesMap: This method returns a Map of all countries in a specific desired languages (Locale). The key of the map is the countryCode and the values is the name of the country. A map can be useful if you would like to get a country by its code. Note that in order to construct the Map the class: LinkedHashMap is used. This is done in order to preserve the sort order of the list.

This is the CountryUtil class:

package com.bashan.blog;
import java.util.*;
public class CountryUtil {
  public static List<Country> getCountries(final Locale inLocale) {
    String[] countryCodes = Locale.getISOCountries();
    List<Country> countries = new ArrayList<Country>(countryCodes.length);
    for (String countryCode : countryCodes) {
      countries.add(new Country(countryCode, new Locale("", countryCode).getDisplayCountry(inLocale)));
    }
    Collections.sort(countries, new Comparator<Country>() {
      public int compare(Country c1, Country c2) {
        return c1.getName().compareTo(c2.getName());
      }
    });
    return countries;
  }
  public static Map<String, String> getCountriesMap(final Locale inLocale) {
    List<Country> countries = getCountries(inLocale);
    Map<String, String> countriesMap = new LinkedHashMap<String, String>(countries.size());
    for (Country country : countries) {
      countriesMap.put(country.getCountryCode(), country.getName());
    }
    return countriesMap;
  }
  public static void printCounties(List<Country> countries) {
    for (Country country : countries) {
      System.out.println(country);
    }
  }
  public static void main(String[] args) {
    // Get list of countries in US English
    System.out.println("---- List of countries in English ----");
    List<Country> countries = getCountries(Locale.US);
    printCounties(countries);
    System.out.println("---- List of countries in Japanese ----");
    // Get list of countries in Japanese
    countries = getCountries(Locale.JAPANESE);
    printCounties(countries);
  }
}
On the bottom of the class you can notice a small testing program that outputs all countries in English and in Japanese. This is how the output looks like:
---- List of countries in English ----
AF, Afghanistan
AL, Albania
DZ, Algeria
AS, American Samoa
AD, Andorra
AO, Angola
AI, Anguilla
AQ, Antarctica
AG, Antigua and Barbuda
AR, Argentina
AM, Armenia
AW, Aruba
AU, Australia
AT, Austria
AZ, Azerbaijan
BS, Bahamas
BH, Bahrain
BD, Bangladesh
BB, Barbados
BY, Belarus
BE, Belgium
BZ, Belize
BJ, Benin
BM, Bermuda
BT, Bhutan
BO, Bolivia
BA, Bosnia and Herzegovina
BW, Botswana
BV, Bouvet Island
BR, Brazil
IO, British Indian Ocean Territory
VG, British Virgin Islands
BN, Brunei
BG, Bulgaria
BF, Burkina Faso
BI, Burundi
KH, Cambodia
CM, Cameroon
CA, Canada
CV, Cape Verde
KY, Cayman Islands
CF, Central African Republic
TD, Chad
CL, Chile
CN, China
CX, Christmas Island
CC, Cocos Islands
CO, Colombia
KM, Comoros
CG, Congo
CK, Cook Islands
CR, Costa Rica
HR, Croatia
CU, Cuba
CY, Cyprus
CZ, Czech Republic
CI, Côte d'Ivoire
DK, Denmark
DJ, Djibouti
DM, Dominica
DO, Dominican Republic
EC, Ecuador
EG, Egypt
SV, El Salvador
GQ, Equatorial Guinea
ER, Eritrea
EE, Estonia
ET, Ethiopia
FK, Falkland Islands
FO, Faroe Islands
FJ, Fiji
FI, Finland
FR, France
GF, French Guiana
PF, French Polynesia
TF, French Southern Territories
GA, Gabon
GM, Gambia
GE, Georgia
DE, Germany
GH, Ghana
GI, Gibraltar
GR, Greece
GL, Greenland
GD, Grenada
GP, Guadeloupe
GU, Guam
GT, Guatemala
GN, Guinea
GW, Guinea-Bissau
GY, Guyana
HT, Haiti
HM, Heard Island And McDonald Islands
HN, Honduras
HK, Hong Kong
HU, Hungary
IS, Iceland
IN, India
ID, Indonesia
IR, Iran
IQ, Iraq
IE, Ireland
IL, Israel
IT, Italy
JM, Jamaica
JP, Japan
JO, Jordan
KZ, Kazakhstan
KE, Kenya
KI, Kiribati
KW, Kuwait
KG, Kyrgyzstan
LA, Laos
LV, Latvia
LB, Lebanon
LS, Lesotho
LR, Liberia
LY, Libya
LI, Liechtenstein
LT, Lithuania
LU, Luxembourg
MO, Macao
MK, Macedonia
MG, Madagascar
MW, Malawi
MY, Malaysia
MV, Maldives
ML, Mali
MT, Malta
MH, Marshall Islands
MQ, Martinique
MR, Mauritania
MU, Mauritius
YT, Mayotte
MX, Mexico
FM, Micronesia
MD, Moldova
MC, Monaco
MN, Mongolia
ME, Montenegro
MS, Montserrat
MA, Morocco
MZ, Mozambique
MM, Myanmar
NA, Namibia
NR, Nauru
NP, Nepal
NL, Netherlands
AN, Netherlands Antilles
NC, New Caledonia
NZ, New Zealand
NI, Nicaragua
NE, Niger
NG, Nigeria
NU, Niue
NF, Norfolk Island
KP, North Korea
MP, Northern Mariana Islands
NO, Norway
OM, Oman
PK, Pakistan
PW, Palau
PS, Palestine
PA, Panama
PG, Papua New Guinea
PY, Paraguay
PE, Peru
PH, Philippines
PN, Pitcairn
PL, Poland
PT, Portugal
PR, Puerto Rico
QA, Qatar
RE, Reunion
RO, Romania
RU, Russia
RW, Rwanda
SH, Saint Helena
KN, Saint Kitts And Nevis
LC, Saint Lucia
PM, Saint Pierre And Miquelon
VC, Saint Vincent And The Grenadines
WS, Samoa
SM, San Marino
ST, Sao Tome And Principe
SA, Saudi Arabia
SN, Senegal
RS, Serbia
CS, Serbia and Montenegro
SC, Seychelles
SL, Sierra Leone
SG, Singapore
SK, Slovakia
SI, Slovenia
SB, Solomon Islands
SO, Somalia
ZA, South Africa
GS, South Georgia And The South Sandwich Islands
KR, South Korea
ES, Spain
LK, Sri Lanka
SD, Sudan
SR, Suriname
SJ, Svalbard And Jan Mayen
SZ, Swaziland
SE, Sweden
CH, Switzerland
SY, Syria
TW, Taiwan
TJ, Tajikistan
TZ, Tanzania
TH, Thailand
CD, The Democratic Republic Of Congo
TL, Timor-Leste
TG, Togo
TK, Tokelau
TO, Tonga
TT, Trinidad and Tobago
TN, Tunisia
TR, Turkey
TM, Turkmenistan
TC, Turks And Caicos Islands
TV, Tuvalu
VI, U.S. Virgin Islands
UG, Uganda
UA, Ukraine
AE, United Arab Emirates
GB, United Kingdom
US, United States
UM, United States Minor Outlying Islands
UY, Uruguay
UZ, Uzbekistan
VU, Vanuatu
VA, Vatican
VE, Venezuela
VN, Vietnam
WF, Wallis And Futuna
EH, Western Sahara
YE, Yemen
ZM, Zambia
ZW, Zimbabwe
AX, Åland Islands

---- List of countries in Japanese ----

IS, アイスランド
IE, アイルランド
AZ, アゼルバイジャン
AF, アフガニスタン
AS, アメリカンサモア
US, アメリカ合衆国
AE, アラブ首長国連邦
DZ, アルジェリア
AR, アルゼンチン
AL, アルバニア
AW, アルバ島
AM, アルメニア
AI, アンギラ
AO, アンゴラ
AG, アンチグアバーブーダ
AD, アンドラ
YE, イエメン
GB, イギリス
IL, イスラエル
IT, イタリア
IQ, イラク
IR, イラン
IN, インド
ID, インドネシア
UG, ウガンダ
UA, ウクライナ
UZ, ウズベキスタン
UY, ウルグアイ
EC, エクアドル
EG, エジプト
EE, エストニア
ET, エチオピア
ER, エリトリア
SV, エルサルバドル
OM, オマーン
NL, オランダ
AN, オランダ領アンティル諸島
AU, オーストラリア
AT, オーストリア
AX, オーランド諸島
KZ, カザフスタン
QA, カタール
CA, カナダ
CM, カメルーン
KH, カンボジア
CV, カーボベルデ
GY, ガイアナ
GA, ガボン
GM, ガンビア
GH, ガーナ
CY, キプロス
CU, キューバ
KI, キリバス
KG, キルギスタン
GN, ギニア
GW, ギニアビサウ
GR, ギリシア
KW, クウェート
CK, クック諸島
CX, クリスマス島
HR, クロアチア
GT, グアテマラ
GP, グアドループ
GU, グアム
GL, グリーンランド
GE, グルジア
GD, グレナダ
KY, ケイマン諸島
KE, ケニア
CC, ココス諸島
CR, コスタリカ
KM, コモロ
CO, コロンビア
CG, コンゴ
CD, コンゴ民主共和国
CI, コートジボアール
SA, サウジアラビア
GS, サウスジョージア島・サウスサンドウィッチ島
ST, サントメ・プリンシペ
PM, サンピエール島・ミクロン島
SM, サンマリノ
ZM, ザンビア
SL, シエラレオネ
SY, シリア
SG, シンガポール
DJ, ジブチ
GI, ジブラルタル
JM, ジャマイカ
ZW, ジンバブエ
CH, スイス
SE, スウェーデン
SJ, スバールバル諸島・ヤンマイエン島
ES, スペイン
SR, スリナム
LK, スリランカ
SK, スロバキア
SI, スロベニア
SZ, スワジランド
SD, スーダン
SC, セイシェル
SN, セネガル
RS, セルビア
CS, セルビア・モンテネグロ
KN, セントクリストファー・ネイビス
VC, セントビンセントおよびグレナディーン諸島
SH, セントヘレナ島
LC, セントルシア
SO, ソマリア
SB, ソロモン諸島
TH, タイ
TJ, タジキスタン
TZ, タンザニア
TC, タークス諸島・カイコス諸島
CZ, チェコ
TD, チャド
TN, チュニジア
CL, チリ
TV, ツバル
DK, デンマーク
TK, トケラウ諸島
TT, トリニダード・トバゴ
TM, トルクメニスタン
TR, トルコ
TO, トンガ
TG, トーゴ
DE, ドイツ
DO, ドミニカ共和国
DM, ドミニカ国
NG, ナイジェリア
NR, ナウル
NA, ナミビア
NU, ニウエ島
NI, ニカラグア
NE, ニジェール
NC, ニューカレドニア
NZ, ニュージーランド
NP, ネパール
NO, ノルウェー
NF, ノーフォーク島
HT, ハイチ
HU, ハンガリー
HM, ハード・マクドナルド諸島
VA, バチカン
VU, バヌアツ
BS, バハマ
BB, バルバドス
BD, バングラデシュ
BM, バーミューダ諸島
BH, バーレーン
PK, パキスタン
PA, パナマ
PG, パプアニューギニア
PW, パラオ
PY, パラグアイ
PS, パレスチナ
PN, ピトケアン島
FJ, フィジー
PH, フィリピン
FI, フィンランド
FO, フェロー諸島
FK, フォークランド諸島
FR, フランス
TF, フランス領極南諸島
BR, ブラジル
BG, ブルガリア
BF, ブルキナファソ
BN, ブルネイ
BI, ブルンジ
BT, ブータン
BV, ブーベ島
PR, プエルトリコ
VN, ベトナム
BJ, ベニン
VE, ベネズエラ
BY, ベラルーシ
BZ, ベリーズ
BE, ベルギー
PE, ペルー
HN, ホンジュラス
BA, ボスニア・ヘルツェゴビナ
BW, ボツワナ
BO, ボリビア
PT, ポルトガル
PL, ポーランド
MO, マカオ
MK, マケドニア
MG, マダガスカル
YT, マヨット島
MW, マラウイ
ML, マリ
MT, マルタ
MQ, マルティニーク島
MY, マレーシア
MH, マーシャル諸島
FM, ミクロネシア
MM, ミャンマー
MX, メキシコ
MZ, モザンビーク
MC, モナコ
MV, モルディブ
MD, モルドバ
MA, モロッコ
MN, モンゴル
ME, モンテネグロ
MS, モントセラト島
MU, モーリシャス
MR, モーリタニア
JO, ヨルダン
LA, ラオス
LV, ラトビア
LT, リトアニア
LI, リヒテンシュタイン
LY, リビア
LR, リベリア
LU, ルクセンブルク
RW, ルワンダ
RO, ルーマニア
LS, レソト
LB, レバノン
RE, レユニオン
RU, ロシア
WF, ワリス・フテュナ諸島
CF, 中央アフリカ共和国
CN, 中華人民共和国
GF, 仏領ギアナ
PF, 仏領ポリネシア
MP, 北マリアナ諸島
ZA, 南アフリカ
AQ, 南極
TW, 台湾
KR, 大韓民国
JP, 日本
KP, 朝鮮民主主義人民共和国
TL, 東ティモール
VI, 米領バージン諸島
UM, 米領太平洋諸島
IO, 英領インド洋地域
VG, 英領バージン諸島
EH, 西サハラ
WS, 西サモア
GQ, 赤道ギニア
HK, 香港