Locale Codes as Text, PHP Array and JSON Array

List of Locale CodesOften during my random programming projects I find that I need a list of locales in one format or another… to that extent I decided to create this post which has the list of locales formatted in various ways.  First as a plain text list so that you can put it into a text file and load the text file into your programming language of choice.  Then I also include it as PHP array and JSON encoded array.  Enjoy!

Plain Text List of Locale Codes

af-ZA
am-ET
ar-AE
ar-BH
ar-DZ
ar-EG
ar-IQ
ar-JO
ar-KW
ar-LB
ar-LY
ar-MA
arn-CL
ar-OM
ar-QA
ar-SA
ar-SY
ar-TN
ar-YE
as-IN
az-Cyrl-AZ
az-Latn-AZ
ba-RU
be-BY
bg-BG
bn-BD
bn-IN
bo-CN
br-FR
bs-Cyrl-BA
bs-Latn-BA
ca-ES
co-FR
cs-CZ
cy-GB
da-DK
de-AT
de-CH
de-DE
de-LI
de-LU
dsb-DE
dv-MV
el-GR
en-029
en-AU
en-BZ
en-CA
en-GB
en-IE
en-IN
en-JM
en-MY
en-NZ
en-PH
en-SG
en-TT
en-US
en-ZA
en-ZW
es-AR
es-BO
es-CL
es-CO
es-CR
es-DO
es-EC
es-ES
es-GT
es-HN
es-MX
es-NI
es-PA
es-PE
es-PR
es-PY
es-SV
es-US
es-UY
es-VE
et-EE
eu-ES
fa-IR
fi-FI
fil-PH
fo-FO
fr-BE
fr-CA
fr-CH
fr-FR
fr-LU
fr-MC
fy-NL
ga-IE
gd-GB
gl-ES
gsw-FR
gu-IN
ha-Latn-NG
he-IL
hi-IN
hr-BA
hr-HR
hsb-DE
hu-HU
hy-AM
id-ID
ig-NG
ii-CN
is-IS
it-CH
it-IT
iu-Cans-CA
iu-Latn-CA
ja-JP
ka-GE
kk-KZ
kl-GL
km-KH
kn-IN
kok-IN
ko-KR
ky-KG
lb-LU
lo-LA
lt-LT
lv-LV
mi-NZ
mk-MK
ml-IN
mn-MN
mn-Mong-CN
moh-CA
mr-IN
ms-BN
ms-MY
mt-MT
nb-NO
ne-NP
nl-BE
nl-NL
nn-NO
nso-ZA
oc-FR
or-IN
pa-IN
pl-PL
prs-AF
ps-AF
pt-BR
pt-PT
qut-GT
quz-BO
quz-EC
quz-PE
rm-CH
ro-RO
ru-RU
rw-RW
sah-RU
sa-IN
se-FI
se-NO
se-SE
si-LK
sk-SK
sl-SI
sma-NO
sma-SE
smj-NO
smj-SE
smn-FI
sms-FI
sq-AL
sr-Cyrl-BA
sr-Cyrl-CS
sr-Cyrl-ME
sr-Cyrl-RS
sr-Latn-BA
sr-Latn-CS
sr-Latn-ME
sr-Latn-RS
sv-FI
sv-SE
sw-KE
syr-SY
ta-IN
te-IN
tg-Cyrl-TJ
th-TH
tk-TM
tn-ZA
tr-TR
tt-RU
tzm-Latn-DZ
ug-CN
uk-UA
ur-PK
uz-Cyrl-UZ
uz-Latn-UZ
vi-VN
wo-SN
xh-ZA
yo-NG
zh-CN
zh-HK
zh-MO
zh-SG
zh-TW
zu-ZA

PHP Array of Locale Codes

Single Line PHP Locale Code Setup

$locales = array(‘af-ZA’, ‘am-ET’, ‘ar-AE’, ‘ar-BH’, ‘ar-DZ’, ‘ar-EG’, ‘ar-IQ’, ‘ar-JO’, ‘ar-KW’, ‘ar-LB’, ‘ar-LY’, ‘ar-MA’, ‘arn-CL’, ‘ar-OM’, ‘ar-QA’, ‘ar-SA’, ‘ar-SY’, ‘ar-TN’, ‘ar-YE’, ‘as-IN’, ‘az-Cyrl-AZ’, ‘az-Latn-AZ’, ‘ba-RU’, ‘be-BY’, ‘bg-BG’, ‘bn-BD’, ‘bn-IN’, ‘bo-CN’, ‘br-FR’, ‘bs-Cyrl-BA’, ‘bs-Latn-BA’, ‘ca-ES’, ‘co-FR’, ‘cs-CZ’, ‘cy-GB’, ‘da-DK’, ‘de-AT’, ‘de-CH’, ‘de-DE’, ‘de-LI’, ‘de-LU’, ‘dsb-DE’, ‘dv-MV’, ‘el-GR’, ‘en-029’, ‘en-AU’, ‘en-BZ’, ‘en-CA’, ‘en-GB’, ‘en-IE’, ‘en-IN’, ‘en-JM’, ‘en-MY’, ‘en-NZ’, ‘en-PH’, ‘en-SG’, ‘en-TT’, ‘en-US’, ‘en-ZA’, ‘en-ZW’, ‘es-AR’, ‘es-BO’, ‘es-CL’, ‘es-CO’, ‘es-CR’, ‘es-DO’, ‘es-EC’, ‘es-ES’, ‘es-GT’, ‘es-HN’, ‘es-MX’, ‘es-NI’, ‘es-PA’, ‘es-PE’, ‘es-PR’, ‘es-PY’, ‘es-SV’, ‘es-US’, ‘es-UY’, ‘es-VE’, ‘et-EE’, ‘eu-ES’, ‘fa-IR’, ‘fi-FI’, ‘fil-PH’, ‘fo-FO’, ‘fr-BE’, ‘fr-CA’, ‘fr-CH’, ‘fr-FR’, ‘fr-LU’, ‘fr-MC’, ‘fy-NL’, ‘ga-IE’, ‘gd-GB’, ‘gl-ES’, ‘gsw-FR’, ‘gu-IN’, ‘ha-Latn-NG’, ‘he-IL’, ‘hi-IN’, ‘hr-BA’, ‘hr-HR’, ‘hsb-DE’, ‘hu-HU’, ‘hy-AM’, ‘id-ID’, ‘ig-NG’, ‘ii-CN’, ‘is-IS’, ‘it-CH’, ‘it-IT’, ‘iu-Cans-CA’, ‘iu-Latn-CA’, ‘ja-JP’, ‘ka-GE’, ‘kk-KZ’, ‘kl-GL’, ‘km-KH’, ‘kn-IN’, ‘kok-IN’, ‘ko-KR’, ‘ky-KG’, ‘lb-LU’, ‘lo-LA’, ‘lt-LT’, ‘lv-LV’, ‘mi-NZ’, ‘mk-MK’, ‘ml-IN’, ‘mn-MN’, ‘mn-Mong-CN’, ‘moh-CA’, ‘mr-IN’, ‘ms-BN’, ‘ms-MY’, ‘mt-MT’, ‘nb-NO’, ‘ne-NP’, ‘nl-BE’, ‘nl-NL’, ‘nn-NO’, ‘nso-ZA’, ‘oc-FR’, ‘or-IN’, ‘pa-IN’, ‘pl-PL’, ‘prs-AF’, ‘ps-AF’, ‘pt-BR’, ‘pt-PT’, ‘qut-GT’, ‘quz-BO’, ‘quz-EC’, ‘quz-PE’, ‘rm-CH’, ‘ro-RO’, ‘ru-RU’, ‘rw-RW’, ‘sah-RU’, ‘sa-IN’, ‘se-FI’, ‘se-NO’, ‘se-SE’, ‘si-LK’, ‘sk-SK’, ‘sl-SI’, ‘sma-NO’, ‘sma-SE’, ‘smj-NO’, ‘smj-SE’, ‘smn-FI’, ‘sms-FI’, ‘sq-AL’, ‘sr-Cyrl-BA’, ‘sr-Cyrl-CS’, ‘sr-Cyrl-ME’, ‘sr-Cyrl-RS’, ‘sr-Latn-BA’, ‘sr-Latn-CS’, ‘sr-Latn-ME’, ‘sr-Latn-RS’, ‘sv-FI’, ‘sv-SE’, ‘sw-KE’, ‘syr-SY’, ‘ta-IN’, ‘te-IN’, ‘tg-Cyrl-TJ’, ‘th-TH’, ‘tk-TM’, ‘tn-ZA’, ‘tr-TR’, ‘tt-RU’, ‘tzm-Latn-DZ’, ‘ug-CN’, ‘uk-UA’, ‘ur-PK’, ‘uz-Cyrl-UZ’, ‘uz-Latn-UZ’, ‘vi-VN’, ‘wo-SN’, ‘xh-ZA’, ‘yo-NG’, ‘zh-CN’, ‘zh-HK’, ‘zh-MO’, ‘zh-SG’, ‘zh-TW’, ‘zu-ZA’);

Multi Line PHP Locale Code Setup

$locales = array();
$locales[] = ‘af-ZA’;
$locales[] = ‘am-ET’;
$locales[] = ‘ar-AE’;
$locales[] = ‘ar-BH’;
$locales[] = ‘ar-DZ’;
$locales[] = ‘ar-EG’;
$locales[] = ‘ar-IQ’;
$locales[] = ‘ar-JO’;
$locales[] = ‘ar-KW’;
$locales[] = ‘ar-LB’;
$locales[] = ‘ar-LY’;
$locales[] = ‘ar-MA’;
$locales[] = ‘arn-CL’;
$locales[] = ‘ar-OM’;
$locales[] = ‘ar-QA’;
$locales[] = ‘ar-SA’;
$locales[] = ‘ar-SY’;
$locales[] = ‘ar-TN’;
$locales[] = ‘ar-YE’;
$locales[] = ‘as-IN’;
$locales[] = ‘az-Cyrl-AZ’;
$locales[] = ‘az-Latn-AZ’;
$locales[] = ‘ba-RU’;
$locales[] = ‘be-BY’;
$locales[] = ‘bg-BG’;
$locales[] = ‘bn-BD’;
$locales[] = ‘bn-IN’;
$locales[] = ‘bo-CN’;
$locales[] = ‘br-FR’;
$locales[] = ‘bs-Cyrl-BA’;
$locales[] = ‘bs-Latn-BA’;
$locales[] = ‘ca-ES’;
$locales[] = ‘co-FR’;
$locales[] = ‘cs-CZ’;
$locales[] = ‘cy-GB’;
$locales[] = ‘da-DK’;
$locales[] = ‘de-AT’;
$locales[] = ‘de-CH’;
$locales[] = ‘de-DE’;
$locales[] = ‘de-LI’;
$locales[] = ‘de-LU’;
$locales[] = ‘dsb-DE’;
$locales[] = ‘dv-MV’;
$locales[] = ‘el-GR’;
$locales[] = ‘en-029’;
$locales[] = ‘en-AU’;
$locales[] = ‘en-BZ’;
$locales[] = ‘en-CA’;
$locales[] = ‘en-GB’;
$locales[] = ‘en-IE’;
$locales[] = ‘en-IN’;
$locales[] = ‘en-JM’;
$locales[] = ‘en-MY’;
$locales[] = ‘en-NZ’;
$locales[] = ‘en-PH’;
$locales[] = ‘en-SG’;
$locales[] = ‘en-TT’;
$locales[] = ‘en-US’;
$locales[] = ‘en-ZA’;
$locales[] = ‘en-ZW’;
$locales[] = ‘es-AR’;
$locales[] = ‘es-BO’;
$locales[] = ‘es-CL’;
$locales[] = ‘es-CO’;
$locales[] = ‘es-CR’;
$locales[] = ‘es-DO’;
$locales[] = ‘es-EC’;
$locales[] = ‘es-ES’;
$locales[] = ‘es-GT’;
$locales[] = ‘es-HN’;
$locales[] = ‘es-MX’;
$locales[] = ‘es-NI’;
$locales[] = ‘es-PA’;
$locales[] = ‘es-PE’;
$locales[] = ‘es-PR’;
$locales[] = ‘es-PY’;
$locales[] = ‘es-SV’;
$locales[] = ‘es-US’;
$locales[] = ‘es-UY’;
$locales[] = ‘es-VE’;
$locales[] = ‘et-EE’;
$locales[] = ‘eu-ES’;
$locales[] = ‘fa-IR’;
$locales[] = ‘fi-FI’;
$locales[] = ‘fil-PH’;
$locales[] = ‘fo-FO’;
$locales[] = ‘fr-BE’;
$locales[] = ‘fr-CA’;
$locales[] = ‘fr-CH’;
$locales[] = ‘fr-FR’;
$locales[] = ‘fr-LU’;
$locales[] = ‘fr-MC’;
$locales[] = ‘fy-NL’;
$locales[] = ‘ga-IE’;
$locales[] = ‘gd-GB’;
$locales[] = ‘gl-ES’;
$locales[] = ‘gsw-FR’;
$locales[] = ‘gu-IN’;
$locales[] = ‘ha-Latn-NG’;
$locales[] = ‘he-IL’;
$locales[] = ‘hi-IN’;
$locales[] = ‘hr-BA’;
$locales[] = ‘hr-HR’;
$locales[] = ‘hsb-DE’;
$locales[] = ‘hu-HU’;
$locales[] = ‘hy-AM’;
$locales[] = ‘id-ID’;
$locales[] = ‘ig-NG’;
$locales[] = ‘ii-CN’;
$locales[] = ‘is-IS’;
$locales[] = ‘it-CH’;
$locales[] = ‘it-IT’;
$locales[] = ‘iu-Cans-CA’;
$locales[] = ‘iu-Latn-CA’;
$locales[] = ‘ja-JP’;
$locales[] = ‘ka-GE’;
$locales[] = ‘kk-KZ’;
$locales[] = ‘kl-GL’;
$locales[] = ‘km-KH’;
$locales[] = ‘kn-IN’;
$locales[] = ‘kok-IN’;
$locales[] = ‘ko-KR’;
$locales[] = ‘ky-KG’;
$locales[] = ‘lb-LU’;
$locales[] = ‘lo-LA’;
$locales[] = ‘lt-LT’;
$locales[] = ‘lv-LV’;
$locales[] = ‘mi-NZ’;
$locales[] = ‘mk-MK’;
$locales[] = ‘ml-IN’;
$locales[] = ‘mn-MN’;
$locales[] = ‘mn-Mong-CN’;
$locales[] = ‘moh-CA’;
$locales[] = ‘mr-IN’;
$locales[] = ‘ms-BN’;
$locales[] = ‘ms-MY’;
$locales[] = ‘mt-MT’;
$locales[] = ‘nb-NO’;
$locales[] = ‘ne-NP’;
$locales[] = ‘nl-BE’;
$locales[] = ‘nl-NL’;
$locales[] = ‘nn-NO’;
$locales[] = ‘nso-ZA’;
$locales[] = ‘oc-FR’;
$locales[] = ‘or-IN’;
$locales[] = ‘pa-IN’;
$locales[] = ‘pl-PL’;
$locales[] = ‘prs-AF’;
$locales[] = ‘ps-AF’;
$locales[] = ‘pt-BR’;
$locales[] = ‘pt-PT’;
$locales[] = ‘qut-GT’;
$locales[] = ‘quz-BO’;
$locales[] = ‘quz-EC’;
$locales[] = ‘quz-PE’;
$locales[] = ‘rm-CH’;
$locales[] = ‘ro-RO’;
$locales[] = ‘ru-RU’;
$locales[] = ‘rw-RW’;
$locales[] = ‘sah-RU’;
$locales[] = ‘sa-IN’;
$locales[] = ‘se-FI’;
$locales[] = ‘se-NO’;
$locales[] = ‘se-SE’;
$locales[] = ‘si-LK’;
$locales[] = ‘sk-SK’;
$locales[] = ‘sl-SI’;
$locales[] = ‘sma-NO’;
$locales[] = ‘sma-SE’;
$locales[] = ‘smj-NO’;
$locales[] = ‘smj-SE’;
$locales[] = ‘smn-FI’;
$locales[] = ‘sms-FI’;
$locales[] = ‘sq-AL’;
$locales[] = ‘sr-Cyrl-BA’;
$locales[] = ‘sr-Cyrl-CS’;
$locales[] = ‘sr-Cyrl-ME’;
$locales[] = ‘sr-Cyrl-RS’;
$locales[] = ‘sr-Latn-BA’;
$locales[] = ‘sr-Latn-CS’;
$locales[] = ‘sr-Latn-ME’;
$locales[] = ‘sr-Latn-RS’;
$locales[] = ‘sv-FI’;
$locales[] = ‘sv-SE’;
$locales[] = ‘sw-KE’;
$locales[] = ‘syr-SY’;
$locales[] = ‘ta-IN’;
$locales[] = ‘te-IN’;
$locales[] = ‘tg-Cyrl-TJ’;
$locales[] = ‘th-TH’;
$locales[] = ‘tk-TM’;
$locales[] = ‘tn-ZA’;
$locales[] = ‘tr-TR’;
$locales[] = ‘tt-RU’;
$locales[] = ‘tzm-Latn-DZ’;
$locales[] = ‘ug-CN’;
$locales[] = ‘uk-UA’;
$locales[] = ‘ur-PK’;
$locales[] = ‘uz-Cyrl-UZ’;
$locales[] = ‘uz-Latn-UZ’;
$locales[] = ‘vi-VN’;
$locales[] = ‘wo-SN’;
$locales[] = ‘xh-ZA’;
$locales[] = ‘yo-NG’;
$locales[] = ‘zh-CN’;
$locales[] = ‘zh-HK’;
$locales[] = ‘zh-MO’;
$locales[] = ‘zh-SG’;
$locales[] = ‘zh-TW’;
$locales[] = ‘zu-ZA’;

JSON Encoded Array of Locale Codes

var locales = {‘af-ZA’, ‘am-ET’, ‘ar-AE’, ‘ar-BH’, ‘ar-DZ’, ‘ar-EG’, ‘ar-IQ’, ‘ar-JO’, ‘ar-KW’, ‘ar-LB’, ‘ar-LY’, ‘ar-MA’, ‘arn-CL’, ‘ar-OM’, ‘ar-QA’, ‘ar-SA’, ‘ar-SY’, ‘ar-TN’, ‘ar-YE’, ‘as-IN’, ‘az-Cyrl-AZ’, ‘az-Latn-AZ’, ‘ba-RU’, ‘be-BY’, ‘bg-BG’, ‘bn-BD’, ‘bn-IN’, ‘bo-CN’, ‘br-FR’, ‘bs-Cyrl-BA’, ‘bs-Latn-BA’, ‘ca-ES’, ‘co-FR’, ‘cs-CZ’, ‘cy-GB’, ‘da-DK’, ‘de-AT’, ‘de-CH’, ‘de-DE’, ‘de-LI’, ‘de-LU’, ‘dsb-DE’, ‘dv-MV’, ‘el-GR’, ‘en-029’, ‘en-AU’, ‘en-BZ’, ‘en-CA’, ‘en-GB’, ‘en-IE’, ‘en-IN’, ‘en-JM’, ‘en-MY’, ‘en-NZ’, ‘en-PH’, ‘en-SG’, ‘en-TT’, ‘en-US’, ‘en-ZA’, ‘en-ZW’, ‘es-AR’, ‘es-BO’, ‘es-CL’, ‘es-CO’, ‘es-CR’, ‘es-DO’, ‘es-EC’, ‘es-ES’, ‘es-GT’, ‘es-HN’, ‘es-MX’, ‘es-NI’, ‘es-PA’, ‘es-PE’, ‘es-PR’, ‘es-PY’, ‘es-SV’, ‘es-US’, ‘es-UY’, ‘es-VE’, ‘et-EE’, ‘eu-ES’, ‘fa-IR’, ‘fi-FI’, ‘fil-PH’, ‘fo-FO’, ‘fr-BE’, ‘fr-CA’, ‘fr-CH’, ‘fr-FR’, ‘fr-LU’, ‘fr-MC’, ‘fy-NL’, ‘ga-IE’, ‘gd-GB’, ‘gl-ES’, ‘gsw-FR’, ‘gu-IN’, ‘ha-Latn-NG’, ‘he-IL’, ‘hi-IN’, ‘hr-BA’, ‘hr-HR’, ‘hsb-DE’, ‘hu-HU’, ‘hy-AM’, ‘id-ID’, ‘ig-NG’, ‘ii-CN’, ‘is-IS’, ‘it-CH’, ‘it-IT’, ‘iu-Cans-CA’, ‘iu-Latn-CA’, ‘ja-JP’, ‘ka-GE’, ‘kk-KZ’, ‘kl-GL’, ‘km-KH’, ‘kn-IN’, ‘kok-IN’, ‘ko-KR’, ‘ky-KG’, ‘lb-LU’, ‘lo-LA’, ‘lt-LT’, ‘lv-LV’, ‘mi-NZ’, ‘mk-MK’, ‘ml-IN’, ‘mn-MN’, ‘mn-Mong-CN’, ‘moh-CA’, ‘mr-IN’, ‘ms-BN’, ‘ms-MY’, ‘mt-MT’, ‘nb-NO’, ‘ne-NP’, ‘nl-BE’, ‘nl-NL’, ‘nn-NO’, ‘nso-ZA’, ‘oc-FR’, ‘or-IN’, ‘pa-IN’, ‘pl-PL’, ‘prs-AF’, ‘ps-AF’, ‘pt-BR’, ‘pt-PT’, ‘qut-GT’, ‘quz-BO’, ‘quz-EC’, ‘quz-PE’, ‘rm-CH’, ‘ro-RO’, ‘ru-RU’, ‘rw-RW’, ‘sah-RU’, ‘sa-IN’, ‘se-FI’, ‘se-NO’, ‘se-SE’, ‘si-LK’, ‘sk-SK’, ‘sl-SI’, ‘sma-NO’, ‘sma-SE’, ‘smj-NO’, ‘smj-SE’, ‘smn-FI’, ‘sms-FI’, ‘sq-AL’, ‘sr-Cyrl-BA’, ‘sr-Cyrl-CS’, ‘sr-Cyrl-ME’, ‘sr-Cyrl-RS’, ‘sr-Latn-BA’, ‘sr-Latn-CS’, ‘sr-Latn-ME’, ‘sr-Latn-RS’, ‘sv-FI’, ‘sv-SE’, ‘sw-KE’, ‘syr-SY’, ‘ta-IN’, ‘te-IN’, ‘tg-Cyrl-TJ’, ‘th-TH’, ‘tk-TM’, ‘tn-ZA’, ‘tr-TR’, ‘tt-RU’, ‘tzm-Latn-DZ’, ‘ug-CN’, ‘uk-UA’, ‘ur-PK’, ‘uz-Cyrl-UZ’, ‘uz-Latn-UZ’, ‘vi-VN’, ‘wo-SN’, ‘xh-ZA’, ‘yo-NG’, ‘zh-CN’, ‘zh-HK’, ‘zh-MO’, ‘zh-SG’, ‘zh-TW’, ‘zu-ZA’};

Comments

comments

Posted in and tagged , , .