Jump to content

abcabc

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

abcabc's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Let me ask the question differently: Is there someone who has English as a secondary language installed on their machine, and with one of the other listed languages as their primary. If yes, can you copy and paste the code into a .php file, run it, and let me know if your default language is indicated or is "en" indicated. thanks. [!--quoteo(post=353849:date=Mar 11 2006, 12:20 AM:name=txmedic03)--][div class=\'quotetop\']QUOTE(txmedic03 @ Mar 11 2006, 12:20 AM) [snapback]353849[/snapback][/div][div class=\'quotemain\'][!--quotec--] Well, if you comment out session_start() then there is no session to use $_SESSION. [/quote] Yes, you are correct, session-start should be uncommented. thanks.
  2. [!--quoteo(post=353801:date=Mar 10 2006, 08:37 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 10 2006, 08:37 PM) [snapback]353801[/snapback][/div][div class=\'quotemain\'][!--quotec--] According to the manual, $_SERVER['HTTP_ACCEPT_LANGUAGE'] is not one of the predefined variables available. Refer to [a href=\"http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.server\" target=\"_blank\"]http://us2.php.net/manual/en/reserved.vari...ariables.server[/a] to see which variables are available by default. [/quote] I did refer to that manual beforehand, and used it to put together this code. Also, look at [a href=\"http://www.developershome.com/wap/detection/detection.asp?page=readHeader\" target=\"_blank\"]http://www.developershome.com/wap/detectio...page=readHeader[/a] and scroll down to header "Retrieving HTTP Headers with PHP" and you will see it listed as OK.
  3. I would like to know if this code works. I am trying to determine the language the user is using, but I don't know of a way to check this. For example, if a user is using French, will the variable $lang receive the value of 'fr'? Thanks in advance. <?php // session_start(); error_reporting(E_ALL);// can be removed later if (isset($_GET['lang'])) { $lang = $_GET['lang']; $_SESSION['Language'] = $lang; } else { if (isset($_SESSION['Language'])) { $lang = $_SESSION['Language']; } } if (!isset($lang)) { switch (substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2)) { case 'fr': $lang = 'fr'; break; case 'de': $lang = 'de'; break; case 'ko': $lang = 'ko'; break; case 'es': $lang = 'es'; break; case 'it': $lang = 'it'; break; case 'ja': $lang = 'ja'; break; case 'pt': $lang = 'pt'; break; case 'zh-CN': $lang = 'zh-CN'; break; default: $lang = 'en'; } } echo $lang; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.