Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Retrieve Language

    I'm writing a web page using PHP and javascript and I need a way using either to retrieve the language being used on the users P.C. be that English, German, etc.

    Thanks,

    Tom
    laphotoimage2 Guest

  2. Similar Questions and Discussions

    1. Retrieve URL from DB
      Does anyone know how to pull a URL from a DB? Here's my example: I have a database with training records in it. Inside the DB people fall under...
    2. Dictionary language switches language during spellcheck
      During a spellcheck of a complete document, the language mysteriously switches from English USA (which in Canada isn't quite right, but that's...
    3. #25051 [Opn->WFx]: translating between gettext language identifiers and 'Accept-Language' ones
      ID: 25051 Updated by: sniper@php.net Reported By: wouter at grep dot be -Status: Open +Status: Wont...
    4. #25051 [NEW]: translating between gettext language identifiers and 'Accept-Language' ones
      From: wouter at grep dot be Operating system: irrelevant PHP version: Irrelevant PHP Bug Type: Feature/Change Request Bug...
    5. How to prevent the language icon from disappearing and a language switching delay?
      What is wrong with my question since nobody answers it? How to improve the question? "Dmitriy Kopnichev" <kopn@hotbox.ru> wrote in message...
  3. #2

    Default Re: Retrieve Language

    On Thu 28 Apr 2005 04:22:42p, laphotoimage2 wrote in
    macromedia.dreamweaver.appdev:
    > I'm writing a web page using PHP and javascript and I need a way using
    > either to retrieve the language being used on the users P.C. be that
    > English, German, etc.
    /Assuming/ the browser gives you correct information, you can access it in
    HTTP_ACCEPT_LANGUAGE or accept-language header. Using this script:

    <SCRIPT LANGUAGE="javascript1.2">
    var nav_lng="peed-jahn_brah"; //default language string
    if(navigator.language)nav_lng="navigator.language" ;
    if(navigator.browserLanguage)nav_lng="navigator.us erLanguage";
    if(navigator.systemLanguage)nav_lng="navigator.sys temLanguage";
    if(navigator.browserLanguage)nav_lng="navigator.br owserLanguage";
    if(navigator.userLanguage)nav_lng="navigator.userL anguage";
    if(window.navigator.language)nav_lng="window.navig ator.language";
    alert(nav_lng);
    </script>

    (adapted from [url]http://www.webmasterworld.com/forum91/2476-2-10.htm[/url])

    It turns out that FireFox returns the value in window.navigator.language;
    IE6/Win returns it in navigator.userLanguage.

    In PHP, you can snag the value in $_SERVER['HTTP_ACCEPT_LANGUAGE']
    See: [url]http://www.php.net/reserved.variables[/url]
    Joe Makowiec Guest

  4. #3

    Default Re: Retrieve Language

    laphotoimage2 wrote:
    > I'm writing a web page using PHP and javascript and I need a way using either to retrieve the language being used on the users P.C. be that English, German, etc.
    Think very, very carefully what you do with that information. Not
    everybody working on a computer running on a specific language will be a
    native speaker of that language. An American accessing the internet in
    the business centre of a hotel in Germany will not thank you for serving
    up a page in German. I have one computer that uses Japanese as its base
    language. I can read Japanese, but if my brother were to use my
    computer, he'd be completely lost if you "kindly" served him a page in
    Japanese.

    Try to serve the most appropriate content by all means, but make sure
    you give the user a clear option to change the language of the content.

    --
    David Powers
    Author, "Foundation PHP 5 for Flash" (friends of ED)
    Co-author "PHP Web Development with DW MX 2004" (Apress)
    [url]http://computerbookshelf.com[/url]
    David Powers Guest

  5. #4

    Default Re: Retrieve Language

    Thanks for the help!
    laphotoimage2 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139