How to change display languages by selecting from dropdown menu like friendster.com

Discussion in 'PHP' started by ketting00, Dec 8, 2009.

  1. #1
    Hi all,

    I want to make a multi languages website that allows users to choose their prefered languages like the features on friendster.com.


    Is it possible to achieve this goal with PHP.

    Here's the code I've noticed so far on friendster:

    <script>
    function switchLanguage(langType) {
    var langType = document.getElementById('langSelecter')[document.getElementById('langSelecter').selectedIndex].value;
    var rUrl = document.location.href;
    url = 'http://www.friendster.com/setlang.php?lang='+langType+'&updatelang=1&next='+escape(rUrl);
    document.location.href = url;
    }
    </script><select name="languagepref" id="langSelecter" onChange="switchLanguage()"><option value="" disabled>Please Select</option>
    <option value="en-US" title="" selected>English</option>
    <option value="zh-TW" title="Traditional Chinese">繁體中文</option>
    <option value="zh-CN" title="Simplified Chinese">简体中文</option>
    <option value="es-MX" title="Spanish">Español</option>
    <option value="ja-JP" title="Japanese">日本語</option>
    <option value="ko-KR" title="Korean">한국어</option>
    <option value="id-ID" title="Bahasa Indonesia">Bahasa</option>
    <option value="vi-VN" title="Vietnamese">Tiếng Việt</option>
    <option value="ms-MY" title="Bahasa Malaysia">Malay</option>
    <option value="th-TH" title="Thai">ภาษาไทย</option>
    <option value="tl-PH" title="Tagalog">Tagalog</option></select>


    Please can anyone help point me out to the right direction.

    Additionally, I've followed this thread for a week and still not yet figured out how to get it working:

    http://www.hotscripts.com/forums/php/24930-select-language.html

    Thanks
     
    ketting00, Dec 8, 2009 IP
  2. tguillea

    tguillea Active Member

    Messages:
    229
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #2
    the drop down menu is only a part of it... basically the drop down just tells the script to load a different language - PHP won't translate anything.

    the script friendster.com/setlang.php probably just sets a cookie / session variable for the language, and then a header file chooses which language to load.

    Do you have a translated version of all your text?
     
    tguillea, Dec 9, 2009 IP