2017-05-22 11:24:21 +02:00
|
|
|
<?php
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// NagiosQL
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2017-10-20 15:00:08 +02:00
|
|
|
// (c) 2005-2017 by Martin Willisegger
|
|
|
|
//
|
2017-05-22 11:24:21 +02:00
|
|
|
// Project : NagiosQL
|
|
|
|
// Component : Translation Functions
|
|
|
|
// Website : http://www.nagiosql.org
|
2017-10-20 15:00:08 +02:00
|
|
|
// Date : $LastChangedDate: 2017-06-22 09:29:35 +0200 (Thu, 22 Jun 2017) $
|
2017-05-22 11:24:21 +02:00
|
|
|
// Author : $LastChangedBy: martin $
|
2017-10-20 15:00:08 +02:00
|
|
|
// Version : 3.3.0
|
|
|
|
// Revision : $LastChangedRevision: 2 $
|
2017-05-22 11:24:21 +02:00
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Translate given text
|
|
|
|
//
|
|
|
|
function translate($translation) {
|
|
|
|
$translation = str_replace('"','"',gettext($translation));
|
|
|
|
$translation = str_replace("'",''',gettext($translation));
|
|
|
|
return $translation;
|
|
|
|
}
|
|
|
|
///
|
|
|
|
/// Internationalization and Localization utilities
|
|
|
|
///
|
|
|
|
function getLanguageCodefromLanguage($languagetosearch) {
|
|
|
|
$detaillanguages = getLanguageData();
|
|
|
|
foreach ($detaillanguages as $key2=>$languagename) {
|
|
|
|
if ($languagetosearch==$languagename['description']) {
|
|
|
|
return $key2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// else return default en code
|
|
|
|
return "en_GB";
|
|
|
|
}
|
|
|
|
|
|
|
|
function getLanguageNameFromCode($codetosearch, $withnative=true) {
|
|
|
|
$detaillanguages = getLanguageData();
|
|
|
|
if (isset($detaillanguages[$codetosearch]['description'])) {
|
|
|
|
if ($withnative) {
|
|
|
|
return $detaillanguages[$codetosearch]['description'].' - '.$detaillanguages[$codetosearch]['nativedescription'];
|
|
|
|
} else {
|
|
|
|
return $detaillanguages[$codetosearch]['description'];}
|
|
|
|
} else {
|
|
|
|
// else return false
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getLanguageData() {
|
|
|
|
unset($supportedLanguages);
|
|
|
|
// English
|
|
|
|
$supportedLanguages['en_GB']['description'] = translate('English');
|
|
|
|
$supportedLanguages['en_GB']['nativedescription'] = 'English';
|
|
|
|
|
|
|
|
// German
|
|
|
|
$supportedLanguages['de_DE']['description'] = translate('German');
|
|
|
|
$supportedLanguages['de_DE']['nativedescription'] = 'Deutsch';
|
|
|
|
|
|
|
|
// Chinese (Simplified)
|
|
|
|
$supportedLanguages['zh_CN']['description'] = translate('Chinese (Simplified)');
|
|
|
|
$supportedLanguages['zh_CN']['nativedescription'] = '简体中文';
|
|
|
|
|
|
|
|
// Italian
|
|
|
|
$supportedLanguages['it_IT']['description'] = translate('Italian');
|
|
|
|
$supportedLanguages['it_IT']['nativedescription'] = 'Italiano';
|
|
|
|
|
|
|
|
// French
|
|
|
|
$supportedLanguages['fr_FR']['description'] = translate('French');
|
|
|
|
$supportedLanguages['fr_FR']['nativedescription'] = 'Français';
|
|
|
|
|
|
|
|
// Russian
|
|
|
|
$supportedLanguages['ru_RU']['description'] = translate('Russian');
|
|
|
|
$supportedLanguages['ru_RU']['nativedescription'] = 'Русский';
|
|
|
|
|
|
|
|
// Spanish
|
|
|
|
$supportedLanguages['es_ES']['description'] = translate('Spanish');
|
|
|
|
$supportedLanguages['es_ES']['nativedescription'] = 'Español';
|
|
|
|
|
|
|
|
// Brazilian Portuguese
|
|
|
|
$supportedLanguages['pt_BR']['description'] = translate('Portuguese (Brazilian)');
|
|
|
|
$supportedLanguages['pt_BR']['nativedescription'] = 'Português do Brasil';
|
|
|
|
|
|
|
|
// Dutch
|
|
|
|
$supportedLanguages['nl_NL']['description'] = translate('Dutch');
|
|
|
|
$supportedLanguages['nl_NL']['nativedescription'] = 'Nederlands';
|
|
|
|
|
|
|
|
// Danish
|
|
|
|
$supportedLanguages['da_DK']['description'] = translate('Danish');
|
|
|
|
$supportedLanguages['da_DK']['nativedescription'] = 'Dansk';
|
|
|
|
|
|
|
|
// No longer supported language because of missing translators
|
|
|
|
//
|
|
|
|
// // Japanese
|
|
|
|
// $supportedLanguages['ja_JP']['description'] = translate('Japanese');
|
|
|
|
// $supportedLanguages['ja_JP']['nativedescription'] = '日本語';
|
|
|
|
//
|
|
|
|
// // Polish
|
|
|
|
// $supportedLanguages['pl_PL']['description'] = translate('Polish');
|
|
|
|
// $supportedLanguages['pl_PL']['nativedescription'] = 'Polski';
|
|
|
|
//
|
|
|
|
// // Spanish (Argentina)
|
|
|
|
// $supportedLanguages['es_AR']['description'] = translate('Spanish (Argentina)');
|
|
|
|
// $supportedLanguages['es_AR']['nativedescription'] = 'Español Argentina';
|
|
|
|
///
|
|
|
|
/// Currently not supported languages
|
|
|
|
//
|
|
|
|
// // Albanian
|
|
|
|
// $supportedLanguages['sq']['description'] = $clang->translate('Albanian');
|
|
|
|
// $supportedLanguages['sq']['nativedescription'] = 'Shqipe';
|
|
|
|
//
|
|
|
|
// // Basque
|
|
|
|
// $supportedLanguages['eu']['description'] = translate('Basque');
|
|
|
|
// $supportedLanguages['eu']['nativedescription'] = 'Euskara';
|
|
|
|
//
|
|
|
|
// // Bosnian
|
|
|
|
// $supportedLanguages['bs']['description'] = translate('Bosnian');
|
|
|
|
// $supportedLanguages['bs']['nativedescription'] = 'Български';
|
|
|
|
//
|
|
|
|
// // Bulgarian
|
|
|
|
// $supportedLanguages['bg']['description'] = translate('Bulgarian');
|
|
|
|
// $supportedLanguages['bg']['nativedescription'] = 'Български';
|
|
|
|
//
|
|
|
|
// // Catalan
|
|
|
|
// $supportedLanguages['ca']['description'] = translate('Catalan');
|
|
|
|
// $supportedLanguages['ca']['nativedescription'] = 'Catalά';
|
|
|
|
//
|
|
|
|
// // Welsh
|
|
|
|
// $supportedLanguages['cy']['description'] = translate('Welsh');
|
|
|
|
// $supportedLanguages['cy']['nativedescription'] = 'Cymraeg';
|
|
|
|
//
|
|
|
|
// // Chinese (Traditional - Hong Kong)
|
|
|
|
// $supportedLanguages['zh-Hant-HK']['description'] = translate('Chinese (Traditional - Hong Kong)');
|
|
|
|
// $supportedLanguages['zh-Hant-HK']['nativedescription'] = '繁體中文語系';
|
|
|
|
//
|
|
|
|
// // Chinese (Traditional - Taiwan)
|
|
|
|
// $supportedLanguages['zh-Hant-TW']['description'] = translate('Chinese (Traditional - Taiwan)');
|
|
|
|
// $supportedLanguages['zh-Hant-TW']['nativedescription'] = 'Chinese (Traditional - Taiwan)';
|
|
|
|
//
|
|
|
|
// // Croatian
|
|
|
|
// $supportedLanguages['hr']['description'] = translate('Croatian');
|
|
|
|
// $supportedLanguages['hr']['nativedescription'] = 'Hrvatski';
|
|
|
|
//
|
|
|
|
// // Czech
|
|
|
|
// $supportedLanguages['cs']['description'] = translate('Czech');
|
|
|
|
// $supportedLanguages['cs']['nativedescription'] = 'Česky';
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// // Estonian
|
|
|
|
// $supportedLanguages['et']['description'] = translate('Estonian');
|
|
|
|
// $supportedLanguages['et']['nativedescription'] = 'Eesti';
|
|
|
|
//
|
|
|
|
// // Finnish
|
|
|
|
// $supportedLanguages['fi']['description'] = translate('Finnish');
|
|
|
|
// $supportedLanguages['fi']['nativedescription'] = 'Suomi';
|
|
|
|
//
|
|
|
|
// // Galician
|
|
|
|
// $supportedLanguages['gl']['description'] = translate('Galician');
|
|
|
|
// $supportedLanguages['gl']['nativedescription'] = 'Galego';
|
|
|
|
//
|
|
|
|
// // German informal
|
|
|
|
// $supportedLanguages['de-informal']['description'] = translate('German informal');
|
|
|
|
// $supportedLanguages['de-informal']['nativedescription'] = 'Deutsch (Du)';
|
|
|
|
//
|
|
|
|
// // Greek
|
|
|
|
// $supportedLanguages['el']['description'] = translate('Greek');
|
|
|
|
// $supportedLanguages['el']['nativedescription'] = 'ελληνικά';
|
|
|
|
//
|
|
|
|
// // Hebrew
|
|
|
|
// $supportedLanguages['he']['description'] = translate('Hebrew');
|
|
|
|
// $supportedLanguages['he']['nativedescription'] = ' עברית';
|
|
|
|
//
|
|
|
|
// // Hungarian
|
|
|
|
// $supportedLanguages['hu']['description'] = translate('Hungarian');
|
|
|
|
// $supportedLanguages['hu']['nativedescription'] = 'Magyar';
|
|
|
|
//
|
|
|
|
// // Indonesian
|
|
|
|
// $supportedLanguages['id']['description'] = translate('Indonesian');
|
|
|
|
// $supportedLanguages['id']['nativedescription'] = 'Bahasa Indonesia';
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// // Lithuanian
|
|
|
|
// $supportedLanguages['lt']['description'] = translate('Lithuanian');
|
|
|
|
// $supportedLanguages['lt']['nativedescription'] = 'Lietuvių';
|
|
|
|
//
|
|
|
|
// // Macedonian
|
|
|
|
// $supportedLanguages['mk']['description'] = translate('Macedonian');
|
|
|
|
// $supportedLanguages['mk']['nativedescription'] = 'Македонски';
|
|
|
|
//
|
|
|
|
// // Norwegian Bokml
|
|
|
|
// $supportedLanguages['nb']['description'] = translate('Norwegian (Bokmal)');
|
|
|
|
// $supportedLanguages['nb']['nativedescription'] = 'Norsk Bokmål';
|
|
|
|
//
|
|
|
|
// // Norwegian Nynorsk
|
|
|
|
// $supportedLanguages['nn']['description'] = translate('Norwegian (Nynorsk)');
|
|
|
|
// $supportedLanguages['nn']['nativedescription'] = 'Norsk Nynorsk';
|
|
|
|
//
|
|
|
|
// // Portuguese
|
|
|
|
// $supportedLanguages['pt']['description'] = translate('Portuguese');
|
|
|
|
// $supportedLanguages['pt']['nativedescription'] = 'Português';
|
|
|
|
//
|
|
|
|
// // Romanian
|
|
|
|
// $supportedLanguages['ro']['description'] = translate('Romanian');
|
|
|
|
// $supportedLanguages['ro']['nativedescription'] = 'Românesc';
|
|
|
|
//
|
|
|
|
// // Slovak
|
|
|
|
// $supportedLanguages['sk']['description'] = translate('Slovak');
|
|
|
|
// $supportedLanguages['sk']['nativedescription'] = 'Slovák';
|
|
|
|
//
|
|
|
|
// // Slovenian
|
|
|
|
// $supportedLanguages['sl']['description'] = translate('Slovenian');
|
|
|
|
// $supportedLanguages['sl']['nativedescription'] = 'Slovenščina';
|
|
|
|
//
|
|
|
|
// // Serbian
|
|
|
|
// $supportedLanguages['sr']['description'] = translate('Serbian');
|
|
|
|
// $supportedLanguages['sr']['nativedescription'] = 'Srpski';
|
|
|
|
//
|
|
|
|
// // Spanish (Mexico)
|
|
|
|
// $supportedLanguages['es-MX']['description'] = translate('Spanish (Mexico)');
|
|
|
|
// $supportedLanguages['es-MX']['nativedescription'] = 'Español Mejicano';
|
|
|
|
//
|
|
|
|
// // Swedish
|
|
|
|
// $supportedLanguages['sv']['description'] = translate('Swedish');
|
|
|
|
// $supportedLanguages['sv']['nativedescription'] = 'Svenska';
|
|
|
|
//
|
|
|
|
// // Turkish
|
|
|
|
// $supportedLanguages['tr']['description'] = translate('Turkish');
|
|
|
|
// $supportedLanguages['tr']['nativedescription'] = 'Türkçe';
|
|
|
|
//
|
|
|
|
// // Thai
|
|
|
|
// $supportedLanguages['th']['description'] = translate('Thai');
|
|
|
|
// $supportedLanguages['th']['nativedescription'] = 'ภาษาไทย';
|
|
|
|
//
|
|
|
|
// // Vietnamese
|
|
|
|
// $supportedLanguages['vi']['description'] = translate('Vietnamese');
|
|
|
|
// $supportedLanguages['vi']['nativedescription'] = 'Tiếng Việt';
|
|
|
|
|
|
|
|
uasort($supportedLanguages,"user_sort");
|
|
|
|
Return $supportedLanguages;
|
|
|
|
}
|
|
|
|
|
|
|
|
function user_sort($a, $b) {
|
|
|
|
// smarts is all-important, so sort it first
|
|
|
|
if($a['description'] >$b['description']) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|