add user display lang setting

This commit is contained in:
Luke Pulverenti 2015-08-04 14:14:16 -04:00
parent bbf0b4d402
commit a2fe57466c
7 changed files with 84 additions and 5 deletions

View File

@ -10,6 +10,59 @@
<div data-role="content">
<form class="displayPreferencesForm userProfileSettingsForm" style="margin: 0 auto;">
<div class="detailSection languageSection">
<h1>
${HeaderLanguage}
</h1>
<div class="detailSectionContent">
<br />
<div>
<label for="selectLanguage">${LabelPreferredDisplayLanguage}</label>
<select id="selectLanguage" data-mini="true">
<option value="ar">Arabic</option>
<option value="bg-BG">Bulgarian (Bulgaria)</option>
<option value="ca">Catalan</option>
<option value="zh-CN">Chinese Simplified</option>
<option value="zh-TW">Chinese Traditional</option>
<option value="hr">Croatian</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option value="en-GB">English (United Kingdom)</option>
<option value="en-US">English (United States)</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="he">Hebrew</option>
<option value="hu">Hungarian</option>
<option value="it">Italian</option>
<option value="kk">Kazakh</option>
<option value="nb">Norwegian Bokmål</option>
<option value="pl">Polish</option>
<option value="pt-BR">Portuguese (Brazil)</option>
<option value="pt-PT">Portuguese (Portugal)</option>
<option value="ru">Russian</option>
<option value="sl-SI">Slovenian (Slovenia)</option>
<option value="es-ES">Spanish</option>
<option value="es-MX">Spanish (Mexico)</option>
<option value="sv">Swedish</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="vi">Vietnamese</option>
</select>
<div class="fieldDescription">
<div>${LabelPreferredDisplayLanguageHelp}</div>
<div style="margin-top: .25em;">
<a href="http://emby.media/community/index.php?/topic/5727-join-our-translation-team/" target="_blank">${LabelReadHowYouCanContribute}</a>
</div>
</div>
</div>
</div>
</div>
<div class="detailSection">
<h1>
${HeaderNavigation}

View File

@ -65,7 +65,16 @@
return appStorage.getItem('enableSyncToExternalStorage') != 'false';
},
displayPreferencesKey: function() {
displayLanguage: function (val) {
if (val != null) {
update('displayLanguage', val);
}
return appStorage.getItem('displayLanguage') || 'en-US';
},
displayPreferencesKey: function () {
if (AppInfo.isNativeApp) {
return 'Emby Mobile';
}

View File

@ -75,6 +75,13 @@
deferred.resolveWith(null, [null]);
});
} else if (AppInfo.supportsUserDisplayLanguageSetting) {
Logger.log('AppInfo.supportsUserDisplayLanguageSetting is true');
culture = document.documentElement.getAttribute('data-culture');
deferred.resolveWith(null, [culture]);
} else {
Logger.log('navigator.globalization.getLocaleName is unavailable');

View File

@ -10,6 +10,8 @@
$('#selectThemeSong', page).val(appStorage.getItem('enableThemeSongs-' + user.Id) || '').selectmenu("refresh");
$('#selectBackdrop', page).val(appStorage.getItem('enableBackdrops-' + user.Id) || '').selectmenu("refresh");
$('#selectLanguage', page).val(AppSettings.displayLanguage()).selectmenu("refresh");
page.querySelector('.chkEnableFullScreen').checked = AppSettings.enableFullScreen();
Dashboard.hideLoadingMsg();
@ -23,6 +25,7 @@
user.Configuration.GroupMoviesIntoBoxSets = page.querySelector('.chkGroupMoviesIntoCollections').checked;
AppSettings.enableFullScreen(page.querySelector('.chkEnableFullScreen').checked);
AppSettings.displayLanguage(page.querySelector('#selectLanguage').value);
appStorage.setItem('enableThemeSongs-' + user.Id, $('#selectThemeSong', page).val());
appStorage.setItem('enableBackdrops-' + user.Id, $('#selectBackdrop', page).val());
@ -84,6 +87,12 @@
} else {
$('.fldFullscreen', page).hide();
}
if (AppInfo.supportsUserDisplayLanguageSetting) {
$('.languageSection', page).show();
} else {
$('.languageSection', page).hide();
}
});
})(jQuery, window, document);

View File

@ -1729,6 +1729,7 @@ var AppInfo = {};
AppInfo.supportsFullScreen = isCordova && isAndroid;
AppInfo.supportsSyncPathSetting = isCordova && isAndroid;
AppInfo.supportsUserDisplayLanguageSetting = Dashboard.isConnectMode() && !isCordova;
if (isCordova && isAndroid) {
AppInfo.directPlayAudioContainers = "flac,aac,mp3,mpa,wav,wma,mp2,ogg,oga,webma,ape,opus".split(',');

View File

@ -544,8 +544,8 @@
"LabelFriendlyServerName": "Friendly server name:",
"LabelFriendlyServerNameHelp": "This name will be used to identify this server. If left blank, the computer name will be used.",
"LabelPreferredDisplayLanguage": "Preferred display language:",
"LabelPreferredDisplayLanguageHelp": "Translating Emby is an ongoing project and is not yet complete.",
"LabelReadHowYouCanContribute": "Read about how you can contribute.",
"LabelPreferredDisplayLanguageHelp": "Translating Emby is an ongoing project.",
"LabelReadHowYouCanContribute": "Learn how you can contribute.",
"HeaderNewCollection": "New Collection",
"ButtonSubmit": "Submit",
"ButtonCreate": "Create",

View File

@ -341,12 +341,12 @@
function showCommand(result) {
if (result.category == 'tvguide') {
Dashboard.navigate('livetv.html');
Dashboard.navigate('livetv.html?tab=1');
return;
}
if (result.category == 'recordings') {
Dashboard.navigate('livetv.html');
Dashboard.navigate('livetv.html?tab=3');
return;
}
}