boinc/html/inc/language_names.inc

111 lines
3.9 KiB
PHP
Raw Normal View History

2013-10-24 01:32:30 +00:00
<?php
// This file is part of BOINC.
// http://boinc.berkeley.edu
2014-04-30 22:39:10 +00:00
// Copyright (C) 2014 University of California
2013-10-24 01:32:30 +00:00
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
2013-10-23 22:57:10 +00:00
$language_names = array(
2013-10-29 07:09:27 +00:00
array("ar", "العربية", "Arabic"),
array("az", "Азәрбајҹан дили", "Azerbaijani"),
2013-10-29 07:09:27 +00:00
array("be", "Беларускі", "Belarusian"),
array("bg", "Български", "Bulgarian"),
array("ca", "Català", "Catalan"),
array("cs", "Čeština ", "Czech"),
array("cy", "Cymraeg", "Welsh"),
array("da", "Dansk", "Danish"),
array("de", "Deutsch ", "German"),
array("el", "Ελληνικά", "Greek"),
array("en", "English", "English"),
array("es", "Espa&ntilde;ol", "Spanish"),
array("eu", "Basque", "Basque"),
2013-10-29 07:09:27 +00:00
array("fi", "Suomi", "Finnish"),
array("fr", "Fran&ccedil;ais", "French"),
array("gl", "Galego", "Galician"),
array("he", "עִבְרִית", "Hebrew"),
array("hr", "Hrvatski", "Croatian"),
array("hu", "Magyar", "Hungarian"),
array("it_IT", "Italiano", "Italian"),
2013-10-29 07:09:27 +00:00
array("ja", "日本語", "Japanese"),
array("ko", "한국어", "Korean"),
array("lt", "Lietuvių", "Lithuanian"),
array("lv", "Latviešu", "Latvian"),
array("ms", "بهاس ملايو", "Malay"),
array("nb", "Norsk", "Norwegian"),
2013-10-29 07:09:27 +00:00
array("nl", "Nederlands", "Dutch"),
array("pl", "Polski", "Polish"),
array("pt_BR", "Portugu&ecirc;s - Brasil", "Portuguese - Brazil"),
array("pt_PT", "Portugu&ecirc;s", "Portuguese"),
array("ro", "Română", "Romanian"),
array("ru", "Русский", "Russian"),
array("sa", "فارسی", "Persian"),
2013-10-29 07:09:27 +00:00
array("sk", "Slovenčina", "Slovakian"),
array("sl", "Slovenščina", "Slovenian"),
array("sv", "Svenska", "Swedish"),
array("tr", "Türkçe", "Turkish"),
array("uk", "Українська", "Ukrainian"),
2013-10-29 07:09:27 +00:00
array("zh_CN", "简体中文", "Chinese"),
array("zh_TW", "繁體中文", "Chinese (Taiwan)"),
2013-10-23 22:57:10 +00:00
);
2016-12-06 18:07:12 +00:00
function language_select($cur_lang_name) {
2013-10-29 07:09:27 +00:00
global $language_names;
2013-12-04 18:22:11 +00:00
$supported_languages = get_supported_languages();
2013-10-29 07:09:27 +00:00
$supported_languages[] = "en";
2016-12-06 18:07:12 +00:00
$sel = $cur_lang_name?"":"selected";
2013-10-29 07:09:27 +00:00
echo "
<option $sel value=auto>Language: default
2013-10-29 07:09:27 +00:00
";
foreach ($language_names as $lang) {
if (!in_array($lang[0], $supported_languages)) continue;
2016-12-06 18:07:12 +00:00
$sel = ($cur_lang_name == $lang[0])?"selected":"";
2013-10-29 07:09:27 +00:00
if ($lang[0] == "en") {
2016-12-06 18:07:12 +00:00
echo "<option $sel value=".$lang[0].">".$lang[1];
2013-10-29 07:09:27 +00:00
} else {
2016-12-06 18:07:12 +00:00
echo "<option $sel value=".$lang[0].">".$lang[1]." (".$lang[2].")";
2013-10-29 07:09:27 +00:00
}
echo "\n";
2013-10-29 07:09:27 +00:00
}
}
// show a menu of supported languages
//
2016-12-06 18:07:12 +00:00
function language_form($cur_lang_name=null) {
echo '
<form name="language" method="get" action="set_language.php">
<select class="selectbox form-control" name="lang" onchange="javascript: submit()">
';
language_select($cur_lang_name);
echo '</select>
2013-10-29 07:09:27 +00:00
</form>
2016-12-06 18:07:12 +00:00
';
2013-10-29 07:09:27 +00:00
}
// given a language code, return a string of the form "(int-name/native-name)"
//
function language_desc($code) {
global $language_names;
if ($code == 'en') {
return '(English)';
}
foreach ($language_names as $lang) {
if ($code == $lang[0]) {
return "'$code'".' ('.$lang[1].'/'.$lang[2].')';
}
}
return "'$code'";
}
2013-10-23 22:57:10 +00:00
?>