multilingual page

Discussion in 'PHP' started by steyr, Aug 2, 2007.

  1. #1
    Hy!

    I want to create a multilingual website where the language settings of the browser are checked and based on that I want to derive the text for the page from a database!
    Can somebody tell me how to check the language of the users browser, or give me a literature hint about that!

    Thanks a lot for help!
     
    steyr, Aug 2, 2007 IP
  2. Will.Spencer

    Will.Spencer NetBuilder

    Messages:
    14,789
    Likes Received:
    1,040
    Best Answers:
    0
    Trophy Points:
    375
  3. steyr

    steyr Guest

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for reply!

    For some reasons I do not want to use Java Skript! I have tried the following, but it does not work out:

    <?php
    $language = $_SERVER["HTTP_ACCEPT_LANGUAGE"];

    if($language == 'en'){
    echo 'english';
    }
    else if ($language == 'de') {

    echo 'deutsch';
    }
    else
    {
    echo 'damn';
    }
    ?>
     
    steyr, Aug 3, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Try:
    
    $language = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
    
    PHP:
     
    nico_swd, Aug 3, 2007 IP
  5. steyr

    steyr Guest

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks a lot, it works!
     
    steyr, Aug 3, 2007 IP