mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Show used language, if nothing stored locally
This commit is contained in:
@@ -180,13 +180,44 @@ function updateHyperionInstanceListing()
|
||||
|
||||
function initLanguageSelection()
|
||||
{
|
||||
for (var i = 0; i < availLang.length; i++)
|
||||
{
|
||||
$("#language-select").append('<option value="'+i+'" selected="">'+availLangText[i]+'</option>');
|
||||
}
|
||||
// Initialise language selection list with languages supported
|
||||
for (var i = 0; i < availLang.length; i++)
|
||||
{
|
||||
$("#language-select").append('<option value="'+i+'" selected="">'+availLangText[i]+'</option>');
|
||||
}
|
||||
|
||||
$("#language-select").val(availLang.indexOf(storedLang));
|
||||
$("#language-select").selectpicker("refresh");
|
||||
var langLocale = storedLang;
|
||||
|
||||
// If no language has been set, resolve browser locale
|
||||
if ( langLocale === 'auto' )
|
||||
{
|
||||
langLocale = $.i18n().locale.substring(0,2);
|
||||
}
|
||||
|
||||
// Resolve text for language code
|
||||
var langText = 'Please Select';
|
||||
|
||||
//Test, if language is supported by hyperion
|
||||
langIdx = availLang.indexOf(langLocale)
|
||||
if ( langIdx > -1 )
|
||||
{
|
||||
langText = availLangText[langIdx];
|
||||
}
|
||||
else
|
||||
{
|
||||
// If language is not supported by hyperion, try fallback language
|
||||
langLocale = $.i18n().options.fallbackLocale.substring(0,2);
|
||||
langIdx = availLang.indexOf(langLocale)
|
||||
if ( langIdx > -1 )
|
||||
{
|
||||
langText = availLangText[langIdx];
|
||||
}
|
||||
}
|
||||
//console.log("langLocale: ", langLocale, "langText: ", langText);
|
||||
|
||||
$('#language-select').prop('title', langText);
|
||||
$("#language-select").val(langIdx);
|
||||
$("#language-select").selectpicker("refresh");
|
||||
}
|
||||
|
||||
function updateUiOnInstance(inst)
|
||||
|
Reference in New Issue
Block a user