xpfreund: Systemsprache abfragen (Lösung für eine Sprachauswahl)

Beitrag lesen

Hallo,

<code lang=php>
$languages = array("English" => "en",  //array mit benötigten Sprachen
"Deutsch" => "de",
"Andorran" => "ad",
"Brazilian" => "br",
"Catalan" => "ct",
"China,P.R.C.(GB)" => "zh",
"Czech" => "cz",
"Danish" => "da",
"Dutch" => "nl",
"Espanol" => "es",
"Finnish" => "fi",
"Français" => "fr",
"Greek" => "gr",
"Hungarian" => "hu",
"Italiano" => "it",
"Icelandic" => "is",
"Korean" => "ko",
"Norwegian" => "no",
"Portugues" => "pt",
"Polish" => "pl",
"Romanian" => "ro",
"Russian" => "ru",
"Slovenian" => "si",
"Slovak" => "sk",
"Svenska" => "se",
"Turkish" => "tr",
"Taiwan,R.O.C.(TW)" => "tw");
$lang=$_SERVER["HTTP_ACCEPT_LANGUAGE"]; //Headerabfrage
echo "<br><tr><td>Language:</td><td><select name='setting_langua'>\n"; //Auswahlliste
foreach ($languages as $l_long => $l_short) {
  echo "<option value='$l_short'";
  $lang=substr($lang,0,2);
  if ($lang==$l_short) { echo " selected"; }
  echo ">$l_long-$l_short\n";
}
echo "</select><br><br></td></tr>\n";

Bitte keine Kommentare über Tabellen und Abstände, die nicht über CSS definiert wurden.

gruß aus Senftenberg am See