language code to language name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    language code to language name

    this function detects users language name from browsers language code

    PHP Code:
    function gum_lc2ln()
    {
        $lc = strtolower(substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2));
        $language_arr = array(
        "en"=>"English",
        "de"=>"German",
        "ru"=>"Russian",
        "ja"=>"Japanese",
        "es"=>"Spanish",
        "zh"=>"Chinese",
        "fr"=>"French",
        "it"=>"Italian",
        "pt"=>"Portuguese",
        "pl"=>"Polish",
        "ar"=>"Arabic",
        "nl"=>"Dutch",
        "tr"=>"Turkish",
        "sv"=>"Swedish",
        "fa"=>"Persian",
        "cs"=>"Czech",
        "ro"=>"Romanian",
        "ko"=>"Korean",
        "el"=>"Greek",
        "hu"=>"Hungarian",
        "th"=>"Thai",
        "vi"=>"Vietnamese",
        "da"=>"Danish",
        "hi"=>"Hindi",
        "id"=>"Indonesian",
        "fi"=>"Finnish",
        "no"=>"Norwegian",
        "bg"=>"Bulgarian",
        "sk"=>"Slovak",
        "he"=>"Hebrew",
        "hr"=>"Croatian",
        "lt"=>"Lithuanian",
        "sr"=>"Serbian",
        "ca"=>"Catalan",
        "sl"=>"Slovenian",
        "uk"=>"Ukrainian",
        "ms"=>"Malay",
        "ml"=>"Malayalam"
        );
        if(!empty($language_arr[$lc])) return $language_arr[$lc];
        else return 'Unknown';
    } 
    
    Advertise your mobile site for FREE with AdTwirl


    #2
    simple and easy to code but tnx , other users would find it usefull cheers
    This is ten percent luck, twenty percent skill
    Fifteen percent concentrated power of will
    Five percent pleasure, fifty percent pain

    And a hundred percent reason to remember the name!

    Comment


      #3
      Originally posted by just_m3. View Post
      simple and easy to code but tnx , other users would find it usefull cheers
      sometimes its easier to copy and paste a ready simple code than to code it.
      Advertise your mobile site for FREE with AdTwirl

      Comment

      Working...
      X