. require_once("../inc/util.inc"); require_once("../inc/translation.inc"); check_get_args(array("set_lang")); $languages = get_supported_languages(); if (!is_array($languages)) { error_page("Language selection not enabled. Project admins must run the update_translations.php script."); } $prefs = ""; if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { $prefs = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; $prefs = sanitize_tags($prefs); } $set_lang = get_str("set_lang", true); if ($set_lang){ if (!in_array($set_lang, $languages) && $set_lang!="auto"){ error_page("Language not supported"); } else { send_cookie('lang', $set_lang, true); header("Location: index.php"); exit; } } page_head(tra("Language selection")); function language_name($code) { if ($code == 'en') { return "en (English)"; } else { $lname = tr_specific("LANG_NAME_NATIVE", $code); if ($lname == 'English' || $lname == '') { return "$code"; } else { return "$code (" .tr_specific("LANG_NAME_INTERNATIONAL", $code) ."/$lname)" ; } } } if (count($languages_in_use)) { $cur_lang_name = language_name($languages_in_use[0]); } else { $cur_lang_name = language_name('en'); } echo "

", tra( "This web site is available in several languages. The currently selected language is %1.", $cur_lang_name ), "

", tra( "Normally the choice of language is determined by your browser's language setting, which is: %1. You can change this setting using:", "$prefs" ), "

", "

", tra( "Or you can select a language by clicking on one of the links. This will send your browser a cookie; make sure your browser accepts cookies from our domain." ), "

" ; start_table(); row1(tra("Language name (click to select)")); row1("" .tra("Use browser language setting") ."", 1, "row1" ); sort($languages); $i = 0; foreach ($languages as $language) { $name = language_name($language); row1( "$name", 1, "row$i" ); $i = 1-$i; } end_table(); echo "

", tra("Translations are done by volunteers. If your native language is not here, %1you can provide a translation%2.", '', ''), "

" ; page_tail(); ?>