2017-05-22 11:24:21 +02:00
|
|
|
<?php
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// NagiosQL
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2019-04-17 11:40:50 +02:00
|
|
|
// (c) 2005-2018 by Martin Willisegger
|
2017-10-20 15:00:08 +02:00
|
|
|
//
|
2017-05-22 11:24:21 +02:00
|
|
|
// Project : NagiosQL
|
|
|
|
// Component : Translation Functions
|
2019-04-17 11:40:50 +02:00
|
|
|
// Website : https://sourceforge.net/projects/nagiosql/
|
|
|
|
// Version : 3.4.0
|
|
|
|
// GIT Repo : https://gitlab.com/wizonet/NagiosQL
|
2017-05-22 11:24:21 +02:00
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Translate given text
|
|
|
|
//
|
2019-04-17 11:40:50 +02:00
|
|
|
function translate($translation)
|
|
|
|
{
|
|
|
|
$translation = str_replace('"', '"', gettext($translation));
|
|
|
|
$translation = str_replace("'", ''', gettext($translation));
|
|
|
|
return $translation;
|
2017-05-22 11:24:21 +02:00
|
|
|
}
|
|
|
|
///
|
|
|
|
/// Internationalization and Localization utilities
|
|
|
|
///
|
2019-04-17 11:40:50 +02:00
|
|
|
function getLanguageCodefromLanguage($languagetosearch)
|
|
|
|
{
|
|
|
|
$strReturn = 'en_GB';
|
|
|
|
$detaillanguages = getLanguageData();
|
|
|
|
/** @noinspection ForeachSourceInspection */
|
|
|
|
foreach ($detaillanguages as $key2 => $languagename) {
|
|
|
|
if ($languagetosearch == $languagename['description']) {
|
|
|
|
$strReturn = $key2;
|
|
|
|
}
|
2017-05-22 11:24:21 +02:00
|
|
|
}
|
2019-04-17 11:40:50 +02:00
|
|
|
// else return default en code
|
|
|
|
return $strReturn;
|
2017-05-22 11:24:21 +02:00
|
|
|
}
|
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
function getLanguageNameFromCode($codetosearch, $withnative = true)
|
|
|
|
{
|
|
|
|
$strReturn = false;
|
|
|
|
$detaillanguages = getLanguageData();
|
|
|
|
if (isset($detaillanguages[$codetosearch]['description'])) {
|
|
|
|
if ($withnative) {
|
|
|
|
$strReturn = $detaillanguages[$codetosearch]['description'].' - '.
|
|
|
|
$detaillanguages[$codetosearch]['nativedescription'];
|
|
|
|
} else {
|
|
|
|
$strReturn = $detaillanguages[$codetosearch]['description'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $strReturn;
|
2017-05-22 11:24:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
function getLanguageData()
|
|
|
|
{
|
|
|
|
unset($supportedLanguages);
|
|
|
|
// English
|
|
|
|
$supportedLanguages['en_GB']['description'] = translate('English');
|
|
|
|
$supportedLanguages['en_GB']['nativedescription'] = 'English';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// German
|
|
|
|
$supportedLanguages['de_DE']['description'] = translate('German');
|
|
|
|
$supportedLanguages['de_DE']['nativedescription'] = 'Deutsch';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Chinese (Simplified)
|
|
|
|
$supportedLanguages['zh_CN']['description'] = translate('Chinese (Simplified)');
|
|
|
|
$supportedLanguages['zh_CN']['nativedescription'] = '简体中文';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Italian
|
|
|
|
$supportedLanguages['it_IT']['description'] = translate('Italian');
|
|
|
|
$supportedLanguages['it_IT']['nativedescription'] = 'Italiano';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// French
|
|
|
|
$supportedLanguages['fr_FR']['description'] = translate('French');
|
|
|
|
$supportedLanguages['fr_FR']['nativedescription'] = 'Français';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Russian
|
|
|
|
$supportedLanguages['ru_RU']['description'] = translate('Russian');
|
|
|
|
$supportedLanguages['ru_RU']['nativedescription'] = 'Русский';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Spanish
|
|
|
|
$supportedLanguages['es_ES']['description'] = translate('Spanish');
|
|
|
|
$supportedLanguages['es_ES']['nativedescription'] = 'Español';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Brazilian Portuguese
|
|
|
|
$supportedLanguages['pt_BR']['description'] = translate('Portuguese (Brazilian)');
|
|
|
|
$supportedLanguages['pt_BR']['nativedescription'] = 'Português do Brasil';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Dutch
|
|
|
|
$supportedLanguages['nl_NL']['description'] = translate('Dutch');
|
|
|
|
$supportedLanguages['nl_NL']['nativedescription'] = 'Nederlands';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// Danish
|
|
|
|
$supportedLanguages['da_DK']['description'] = translate('Danish');
|
|
|
|
$supportedLanguages['da_DK']['nativedescription'] = 'Dansk';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
// 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';
|
2017-05-22 11:24:21 +02:00
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
uasort($supportedLanguages, 'user_sort');
|
|
|
|
return $supportedLanguages;
|
2017-05-22 11:24:21 +02:00
|
|
|
}
|
|
|
|
|
2019-04-17 11:40:50 +02:00
|
|
|
function user_sort($intValue1, $intValue2)
|
|
|
|
{
|
|
|
|
$intReturn = -1;
|
|
|
|
// smarts is all-important, so sort it first
|
|
|
|
if ($intValue1['description'] > $intValue2['description']) {
|
|
|
|
$intReturn = 1;
|
|
|
|
}
|
|
|
|
return $intReturn;
|
2017-05-22 11:24:21 +02:00
|
|
|
}
|