Search:     Advanced search

Locale language and Internationalization

Article ID: 100
Last updated: 04 Aug, 2012
Revision: 6
Export to PDF
Add comment
Views: 0
Comments: 0

Internationalization support is controlled by the LANG and LC_xxx environment variables. You can set all of them LANG_code_Territory, in this order, according to the POSIX standard. The content of these variables should follow the POSIX standard for a locale specifier. The correct form of a locale specifier is : 

lang.[CODE]_[TERRITORY]

"TERRITORY" is an uppercase two character string per ISO 3166, charset is one of a list of supported character sets.  Assume that you've set one of the aforementioned environment variables to some valid POSIX locale value, other than "C" and "POSIX". Assume further that you're living in Japan. You might want to use the language code "ja" and the territory "JP", thus setting, say, lang to "ja_JP". The final outcome will be lang.ja_JP.ini

  • For instance:

 
Locale Country Language
da_DK Denmark Danish
de_AT Austria German
de_CH Switzerland German
de_DE Germany German
el_GR Greece Greek
en_CA Canada English
en_GB United Kingdom English
en_IE Ireland English
en_US United States English
es_ES Spain Spanish
fi_FI Finland Finnish
fr_BE Belgium French
fr_CA Canada French
fr_CH Switzerland French
fr_FR France French
it_CH Switzerland Italian
it_IT Italy Italian
ja_JP Japan Japanese
ko_KR Korea Korean
nl_BE Belgium Dutch
nl_NL Netherlands Dutch
no_NO Norway Norwegian (Nynorsk)
no_NO_B Norway Norwegian (Bokmål)
pt_PT Portugal Portuguese
sv_SE Sweden Swedish
tr_TR Turkey Turkish
zh_CN China Chinese(Simplified)
zh_TW Taiwan Chinese (Traditional )

Visit http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_territory_information.html  

ISO-639 Language Codes

Language ISO Code Language ISO Code Language ISO Code
Abkhazian ab Hungarian hu Russian ru
Afar aa Icelandic is Samoan sm
Afrikaans af Indonesian in, id Sangro sg
Albanian sq Interlingua ia Sanskrit sa
Amharic am Interlingue ie Scots Gaelic gd
Arabic ar Inuktitut iu Serbian sr
Armenian hy Inupiak ik Serbo-Croatian sh
Assamese as Irish ga Sesotho st
Aymara ay Italian it Setswana tn
Azerbaijani az Japanese ja Shona sn
Bashkir ba Javanese jw Sindhi sd
Basque eu Kannada kn Singhalese si
Bengali (Bangla) bn Kashmiri ks Siswati ss
Bhutani dz Kazakh kk Slovak sk
Bihari bh Kinyarwanda rw Slovenian sl
Bislama bi Kirghiz ky Somali so
Breton br Kirundi rn Spanish es
Bulgarian bg Korean ko Sundanese su
Burmese my Kurdish ku Swahili sw
Byelorussian be Laotian lo Swedish sv
Cambodian km Latin la Tagalog tl
Catalan ca Latvian (Lettish) lv Tajik tg
Chinese zh Lingala ln Tamil ta
Corsican co Lithuanian lt Tatar tt
Croatian hr Macedonian mk Telugu te
Czech cs Malagasy mg Thai th
Danish da Malay ms Tibetan bo
Dutch nl Malayalam ml Tigrinya ti
English en Maltese mt Tonga to
Esperanto eo Manx Gaelic gv Tsonga ts
Estonian et Maori mi Turkish tr
Faeroese fo Marathi mr Turkmen tk
Farsi fa Moldavian mo Twi tw
Fiji fj Mongolian mn Uighur ug
Finnish fi Nauru na Ukrainian uk
French fr Nepali ne Urdu ur
Frisian fy Norwegian no Uzbek uz
Galician gl Occitan oc Vietnamese vi
Georgian ka Oriya or Volapuk vo
German de Oromo (Afan) om Welsh cy
Greek el Pashto (Pushto) ps Wolof wo
Greenlandic kl Polish pl Xhosa xh
Guarani gn Portuguese pt Yiddish ji,yi
Gujarati gu Punjabi pa Yoruba yo
Hausa ha Quechua qu Zulu zu
Hebrew iw, he Rhaeto-Romance rm
Hindi hi Romanian ro

Source: http://www.unicode.org/unicode/onlinedat/languages.html 

Territory Codes

Country ISO Code Country ISO Code
Afghanistan AF Liberia LR
Albania AL Libyan Arab Jamahiriya LY
Algeria DZ Liechtenstein LI
American Samoa AS Lithuania LT
Andorra AD Luxembourg LU
Angola AO Macao MO
Anguilla AI Macedonia MK
Antarctica AQ Madagascar MG
Antigua und Barbuda AG Malawi MW
Argentina AR Malaysia MY
Armenia AM Maldives MV
Aruba AW Mali ML
Australia AU Malta MT
Austria AT Marshall Islands MH
Azerbaijan AZ Martinique MQ
Bahamas BS Mauritania MR
Bahrain BH Mauritius MU
Bangladesh BD Mayotte YT
Barbados BB Mexico MX
Belarus BY Micronesia FM
Belgium BE Moldova MD
Belize BZ Monaco MC
Benin BJ Mongolia MN
Bermuda BM Montserrat MS
Bhutan BT Morocco MA
Bolivia BO Mozambique MZ
Bosnia and Herzogovina BA Myanmar MM
Botswana BW Namibia NA
Bouvet Island BV Nauru NR
Brazil BR Nepal NP
British Indian Ocean Territory IO Netherlands NL
Brunei Darussalam BN Netherlands Antilles AN
Bulgaria BG New Caledonia NC
Burkina Faso BF New Zealand NZ
Burundi BI Nicaragua NI
Cambodia KH Niger NE
Cameroon CM Nigeria NG
Canada CA Niue NU
Cape Verde CV Norfolk Island NF
Cayman Islands KY Northern Mariana Islands MP
Central African Republic CF Norway NO
Chad TD Oman OM
Chile CL Pakistan PK
China CN Palau PW
Christmas Island CX Panama PA
Cocos (Keeling) Islands CC Papua New Guinea PG
Colombia CO Paraguay PY
Comoros KM Peru PE
Congo CG Philippines PH
Cook Islands CK Pitcairn PN
Costa Rica CR Poland PL
Cote d'Ivoire CI Portugal PT
Croatia HR Puerto Rico PR
Cuba CU Qatar QA
Cyprus CY Reunion RE
Czech Republic CZ Romania RO
Denmark DK Russian Federation RU
Djibouti DJ Rwanda RW
Dominica DM Saint Kitts and Nevis KN
Dominican Republic DO Saint Lucia LC
East Timor TP Saint Vincent and the Grenadines VC
Ecuador EC Samoa WS
Egypt EG San Marino SM
El Salvador SV Sao Tome and Principe ST
Equatorial Guinea GQ Saudi Arabia SA
Eritrea ER Senegal SN
Estonia EE Seychelles SC
Ethiopia ET Sierra Leone SL
Falkland Islands FK Singapore SG
Faroe Islands FO Slovakia SK
Fiji FJ Slovenia SL
Finland FI Solomon Islands SB
France FR Somalia SO
France, Metropolitan FX South Africa ZA
French Guiana GF Spain ES
French Polynesia PF Sri Lanka LK
French Southern Territories TF St. Helena SH
Gabon GA St. Pierre and Miquelon PM
Gambia GM Sudan SD
Georgia GE Suriname SR
Germany DE Svalbard and Jan Mayen Islands SJ
Ghana GH Swaziland SZ
Gibraltar GI Sweden SE
Greece GR Switzerland CH
Greenland GL Syrian Arabic Republic SY
Grenada GD Taiwan TW
Guadeloupe GP Tajikistan TJ
Guam GU Tanzania TZ
Guatemala GT Thailand TH
Guinea GN Togo TG
Guinea-Bissau GW Tokelau TK
Guyana GY Tonga TO
Haiti HT Trinidad and Tobago TT
Heard and McDonald Islands HM Tunisia TN
Honduras HN Turkey TR
Hong Kong HK Turkmenistan TM
Hungary HU Turks and Caicos Islands TC
Iceland IS Tuvalu TV
India IN Uganda UG
Indonesia ID Ukraine UA
Iran IR United Arab Emirates AE
Iraq IQ United Kingdom GB
Ireland IE United States US
Isreal IL United States Minor Outlying Islands UM
Italy IT Uruquay UY
Jamaica JM Uzbekistan UZ
Japan JP Vanuatu VU
Jordan JO Vatican City State VA
Kazakhstan KZ Venezuela VE
Kenya KE Vietnam VN
Kiribati KI Virgin Islands (British) VG
Korea KP Virgin Islands (US) VI
Korea (North) KR Wallis and Futuna Islands WF
Kuwait KW Western Sahara EH
Kyrgystan KG Yemen YE
Lao LA Yugoslavia YU
Latvia LV Zaire ZR
Lebanon LB Zambia ZM
Lesotho LS Zimbabwe ZW
Source: http://www.unicode.org/unicode/onlinedat/countries.html third-party link

Locale Code Examples

Locale Description Locale Description
ar Arabic fi_FI_EURO Finnish (Finland,Euro)
ar_AE Arabic (United Arab Emirates) fr French
ar_BH Arabic (Bahrain) fr_BE French (Belgium)
ar_DZ Arabic (Algeria) fr_BE_EURO French (Belgium,Euro)
ar_EG Arabic (Egypt) fr_CA French (Canada)
ar_IQ Arabic (Iraq) fr_CH French (Switzerland)
ar_JO Arabic (Jordan) fr_FR French (France)
ar_KW Arabic (Kuwait) fr_FR_EURO French (France,Euro)
ar_LB Arabic (Lebanon) fr_LU French (Luxembourg)
ar_LY Arabic (Libya) fr_LU_EURO French (Luxembourg,Euro)
ar_MA Arabic (Morocco) hr Croatian
ar_OM Arabic (Oman) hr_HR Croatian (Croatia)
ar_QA Arabic (Qatar) hu Hungarian
ar_SA Arabic (Saudi Arabia) hu_HU Hungarian (Hungary)
ar_SD Arabic (Sudan) is Icelandic
ar_SY Arabic (Syria) is_IS Icelandic (Iceland)
ar_TN Arabic (Tunisia) it Italian
ar_YE Arabic (Yemen) it_CH Italian (Switzerland)
be Byelorussian it_IT Italian (Italy)
be_BY Byelorussian (Belarus) it_IT_EURO Italian (Italy,Euro)
bg Bulgarian iw Hebrew
bg_BG Bulgarian (Bulgaria) iw_IL Hebrew (Israel)
ca Catalan ja Japanese
ca_ES Catalan (Spain) ja_JP Japanese (Japan)
cs Czech ko Korean
cs_CZ Czech (Czech Republic) ko_KR Korean (South Korea)
da Danish lt Lithuanian
da_DK Danish (Denmark) lt_LT Lithuanian (Lithuania)
de German lv Latvian (Lettish)
de_AT German (Austria) lv_LV Latvian (Lettish) (Latvia)
de_AT_EURO German (Austria,Euro) mk Macedonian
de_CH German (Switzerland) mk_MK Macedonian (Macedonia)
de_DE German (Germany) nl Dutch
de_DE_EURO German (Germany,Euro) nl_BE Dutch (Belgium)
de_LU German (Luxembourg) nl_BE_EURO Dutch (Belgium,Euro)
de_LU_EURO German (Luxembourg,Euro) nl_NL Dutch (Netherlands)
el Greek nl_NL_EURO Dutch (Netherlands,Euro)
el_GR Greek (Greece) no Norwegian
en English no_NO Norwegian (Norway)
en_AU English (Australia) no_NO_NY Norwegian (Norway,Nynorsk)
en_CA English (Canada) pl Polish
en_GB English (United Kingdom) pl_PL Polish (Poland)
en_IE English (Ireland) pt Portuguese
en_IE_EURO English (Ireland,Euro) pt_BR Portuguese (Brazil)
en_NZ English (New Zealand) pt_PT Portuguese (Portugal)
en_US English (United States) pt_PT_EURO Portuguese (Portugal,Euro)
en_ZA English (South Africa) ro Romanian
es Spanish ro_RO Romanian (Romania)
es_BO Spanish (Bolivia) ru Russian
es_AR Spanish (Argentina) ru_RU Russian (Russia)
es_CL Spanish (Chile) sh Serbo-Croatian
es_CO Spanish (Colombia) sh_YU Serbo-Croatian (Yugoslavia)
es_CR Spanish (Costa Rica) sk Slovak
es_DO Spanish (Dominican Republic) sk_SK Slovak (Slovakia)
es_EC Spanish (Ecuador) sl Slovenian
es_ES Spanish (Spain) sl_SI Slovenian (Slovenia)
es_ES_EURO Spanish (Spain,Euro) sq Albanian
es_GT Spanish (Guatemala) sq_AL Albanian (Albania)
es_HN Spanish (Honduras) sr Serbian
es_MX Spanish (Mexico) sv Swedish
es_NI Spanish (Nicaragua) sr_YU Serbian (Yugoslavia)
es_PA Spanish (Panama) sv_SE Swedish (Sweden)
es_PE Spanish (Peru) th Thai
es_PR Spanish (Puerto Rico) th_TH Thai (Thailand)
es_PY Spanish (Paraguay) tr Turkish
es_SV Spanish (El Salvador) tr_TR Turkish (Turkey)
es_UY Spanish (Uruguay) uk Ukrainian
es_VE Spanish (Venezuela) uk_UA Ukrainian (Ukraine)
et Estonian zh Chinese
et_EE Estonian (Estonia) zh_CN Chinese (China)
fi Finnish zh_HK Chinese (Hong Kong)
fi_FI Finnish (Finland) zh_TW Chinese (Taiwan)

Set your default language from Admin => Sites => Global Settings as Arabic and translate the files in your local language. 

The global language file is responsible for translating frontend and backend both. It translates all core modules which installs by default. Language codes follow the convention of a two letter lowercase language name, followed by an underscore, followed by two upper-case latters signifying the country code which follows i18n localization standard. So for example the default english for the Arabic language would be: lang.[code]_[TERRITORY].ini

Please find the File called "lang.en_US.ini" located under the following Directory. Remain the file as lang.[code]_[TERRITORY].ini and translate in into your native language.

File Location :  application/languages/xx_YY/<$ModuleName>/lang.xx_YY.ini   (xx_YY represents lang.fr_FR.ini or lang.de_DE.ini etc convention) 

Example Translation :

Present value :
================

theme_template_new_install = "Upload New Template"

common_contact = "Contact Information"

common_appointment = "Book Appointment"

common_email_to_friend = "Email To Friend"

Change to :
================

theme_template_new_install = "Your Language"

common_contact = "Your Language"

common_appointment = "Your Language"

common_email_to_friend = "Your Language"

This article was:  
Also read
document Language architecture and it hierarchical overview
document Localize in a new language.

Also listed in
folder Modules Wise Documentation -> Multi-Language

Prev   Next
Customizing the position of Menu Group and it design layout.     Accessing to the subscribers list who are registered through...