As I work on subtitlecat.com, I continuously strive to make the translation service friendlier and easier to use. It seems natural to offer users their preferred language to make the experience more personal.

Surprisingly, I couldn’t find any associative list of standard language codes and human-readable language names. So I made one, here. It’s just a simple list, but it may save you time if you’re doing something similar.

You can test it by going to subtitlecat.com, your language will be displayed near the top. And this is what the code looks like:

$langs_accept_language = array("af"=>"Afrikaans", "hr"=>"Croatian", "el"=>"Greek", "pl"=>"Polish", "sx"=>"Sutu", "sq"=>"Albanian", "cs"=>"Czech", "gu"=>"Gujurati", "pt"=>"Portuguese", "sw"=>"Swahili", "ar"=>"Arabic (Standard)", "da"=>"Danish", "ht"=>"Haitian", "pt_br"=>"Portuguese (Brazil)", "sv"=>"Swedish", "ar_dz"=>"Arabic (Algeria)", "nl"=>"Dutch (Standard)", "he"=>"Hebrew", "pa"=>"Punjabi", "sv_fi"=>"Swedish (Finland)", "ar_bh"=>"Arabic (Bahrain)", "nl_be"=>"Dutch (Belgian)", "hi"=>"Hindi", "pa_in"=>"Punjabi (India)", "sv_sv"=>"Swedish (Sweden)", "ar_eg"=>"Arabic (Egypt)", "en"=>"English", "hu"=>"Hungarian", "pa_pk"=>"Punjabi (Pakistan)", "ta"=>"Tamil", "ar_iq"=>"Arabic (Iraq)", "en_au"=>"English (Australia)", "is"=>"Icelandic", "qu"=>"Quechua", "tt"=>"Tatar", "ar_jo"=>"Arabic (Jordan)", "en_bz"=>"English (Belize)", "id"=>"Indonesian", "rm"=>"Rhaeto-Romanic", "te"=>"Teluga", "ar_kw"=>"Arabic (Kuwait)", "en_ca"=>"English (Canada)", "iu"=>"Inuktitut", "ro"=>"Romanian", "th"=>"Thai", "ar_lb"=>"Arabic (Lebanon)", "en_ie"=>"English (Ireland)", "ga"=>"Irish", "ro_mo"=>"Romanian (Moldavia)", "tig"=>"Tigre", "ar_ly"=>"Arabic (Libya)", "en_jm"=>"English (Jamaica)", "it"=>"Italian (Standard)", "ru"=>"Russian", "ts"=>"Tsonga", "ar_ma"=>"Arabic (Morocco)", "en_nz"=>"English (New Zealand)", "it_ch"=>"Italian (Switzerland)", "ru_mo"=>"Russian (Moldavia)", "tn"=>"Tswana", "ar_om"=>"Arabic (Oman)", "en_ph"=>"English (Philippines)", "ja"=>"Japanese", "sz"=>"Sami (Lappish)", "tr"=>"Turkish", "ar_qa"=>"Arabic (Qatar)", "en_za"=>"English (South Africa)", "kn"=>"Kannada", "sg"=>"Sango", "tk"=>"Turkmen", "ar_sa"=>"Arabic (Saudi Arabia)", "en_tt"=>"English (Trinidad & Tobago)", "ks"=>"Kashmiri", "sa"=>"Sanskrit", "uk"=>"Ukrainian", "ar_sy"=>"Arabic (Syria)", "en_gb"=>"English (United Kingdom)", "kk"=>"Kazakh", "sc"=>"Sardinian", "hsb"=>"Upper Sorbian", "ar_tn"=>"Arabic (Tunisia)", "en_us"=>"English (United States)", "km"=>"Khmer", "gd"=>"Scots Gaelic", "ur"=>"Urdu", "ar_ae"=>"Arabic (U.A.E.)", "en_zw"=>"English (Zimbabwe)", "ky"=>"Kirghiz", "sd"=>"Sindhi", "ve"=>"Venda", "ar_ye"=>"Arabic (Yemen)", "eo"=>"Esperanto", "tlh"=>"Klingon", "si"=>"Singhalese", "vi"=>"Vietnamese", "ar"=>"Aragonese", "et"=>"Estonian", "ko"=>"Korean", "sr"=>"Serbian", "vo"=>"Volapuk", "hy"=>"Armenian", "fo"=>"Faeroese", "ko_kp"=>"Korean (North Korea)", "sk"=>"Slovak", "wa"=>"Walloon", "as"=>"Assamese", "fa"=>"Farsi", "ko_kr"=>"Korean (South Korea)", "sl"=>"Slovenian", "cy"=>"Welsh", "ast"=>"Asturian", "fj"=>"Fijian", "la"=>"Latin", "so"=>"Somani", "xh"=>"Xhosa", "az"=>"Azerbaijani", "fi"=>"Finnish", "lv"=>"Latvian", "sb"=>"Sorbian", "ji"=>"Yiddish", "eu"=>"Basque", "fr"=>"French (Standard)", "lt"=>"Lithuanian", "es"=>"Spanish", "zu"=>"Zulu", "bg"=>"Bulgarian", "fr_be"=>"French (Belgium)", "lb"=>"Luxembourgish", "es_ar"=>"Spanish (Argentina)", "be"=>"Belarusian", "fr_ca"=>"French (Canada)", "mk"=>"FYRO Macedonian", "es_bo"=>"Spanish (Bolivia)", "bn"=>"Bengali", "fr_fr"=>"French (France)", "ms"=>"Malay", "es_cl"=>"Spanish (Chile)", "bs"=>"Bosnian", "fr_lu"=>"French (Luxembourg)", "ml"=>"Malayalam", "es_co"=>"Spanish (Colombia)", "br"=>"Breton", "fr_mc"=>"French (Monaco)", "mt"=>"Maltese", "es_cr"=>"Spanish (Costa Rica)", "bg"=>"Bulgarian", "fr_ch"=>"French (Switzerland)", "mi"=>"Maori", "es_do"=>"Spanish (Dominican Republic)", "my"=>"Burmese", "fy"=>"Frisian", "mr"=>"Marathi", "es_ec"=>"Spanish (Ecuador)", "ca"=>"Catalan", "fur"=>"Friulian", "mo"=>"Moldavian", "es_sv"=>"Spanish (El Salvador)", "ch"=>"Chamorro", "gd"=>"Gaelic (Scots)", "nv"=>"Navajo", "es_gt"=>"Spanish (Guatemala)", "ce"=>"Chechen", "gd_ie"=>"Gaelic (Irish)", "ng"=>"Ndonga", "es_hn"=>"Spanish (Honduras)", "zh"=>"Chinese", "gl"=>"Galacian", "ne"=>"Nepali", "es_mx"=>"Spanish (Mexico)", "zh_hk"=>"Chinese (Hong Kong)", "ka"=>"Georgian", "no"=>"Norwegian", "es_ni"=>"Spanish (Nicaragua)", "zh_cn"=>"Chinese (PRC)", "de"=>"German (Standard)", "nb"=>"Norwegian (Bokmal)", "es_pa"=>"Spanish (Panama)", "zh_sg"=>"Chinese (Singapore)", "de_at"=>"German (Austria)", "nn"=>"Norwegian (Nynorsk)", "es_py"=>"Spanish (Paraguay)", "zh_tw"=>"Chinese (Taiwan)", "de_de"=>"German (Germany)", "oc"=>"Occitan", "es_pe"=>"Spanish (Peru)", "cv"=>"Chuvash", "de_li"=>"German (Liechtenstein)", "or"=>"Oriya", "es_pr"=>"Spanish (Puerto Rico)", "co"=>"Corsican", "de_lu"=>"German (Luxembourg)", "om"=>"Oromo", "es_es"=>"Spanish (Spain)", "cr"=>"Cree", "de_ch"=>"German (Switzerland)", "fa"=>"Persian", "es_uy"=>"Spanish (Uruguay)", "fa_ir"=>"Persian/Iran", "es_ve"=>"Spanish (Venezuela)");

#example usage
$locale = strtok(locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',');#first preferred language
if(is_null($locale)){
  echo "undefined language";
}else{
  echo $langs_accept_language[strtolower($locale)];
}