mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-23 06:25:27 -07:00
Add setting to change locale
This commit is contained in:
parent
abca48598b
commit
aee45c06bd
4 changed files with 33 additions and 2 deletions
|
@ -98,6 +98,19 @@
|
|||
<h3>Display Settings</h3>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="locale">Display Language</label>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<select class="form-control" id="locale" name="locale">
|
||||
% for lang_code, lang_name in common.LOCALES.items():
|
||||
<option value="${lang_code}" lang="${lang_code}" ${'selected' if config['locale'] == lang_code else ''}>${lang_name}</option>
|
||||
% endfor
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help-block">Change the display language of Tautulli. Help translate Tautulli on <a href="${anon_url('https://hosted.weblate.org/engage/tautulli')}" target="_blank">Weblate</a>.</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="date_format">Date Format</label>
|
||||
<div class="row">
|
||||
|
@ -2311,7 +2324,7 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
// Alert the user that their changes require a restart.
|
||||
function postSaveChecks() {
|
||||
function postSaveChecks(data) {
|
||||
if (authChanged || httpChanged || directoryChanged) {
|
||||
$('#restart-modal').modal('show');
|
||||
}
|
||||
|
@ -2325,6 +2338,9 @@ $(document).ready(function() {
|
|||
setBaseURLSuffix();
|
||||
toggleRevealTokens();
|
||||
settingsChanged = false;
|
||||
if (data.responseJSON.refresh) {
|
||||
location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
var configForm = $("#configUpdate");
|
||||
|
|
|
@ -258,6 +258,11 @@ SCHEDULER_LIST = [
|
|||
]
|
||||
SCHEDULER_LIST = OrderedDict(SCHEDULER_LIST)
|
||||
|
||||
LOCALES = {
|
||||
'en': 'English',
|
||||
'fr': 'French'
|
||||
}
|
||||
|
||||
DATE_TIME_FORMATS = [
|
||||
{
|
||||
'category': 'Year',
|
||||
|
|
|
@ -143,6 +143,7 @@ _CONFIG_DEFINITIONS = {
|
|||
'JOURNAL_MODE': (str, 'Advanced', 'WAL'),
|
||||
'LAUNCH_BROWSER': (int, 'General', 1),
|
||||
'LAUNCH_STARTUP': (int, 'General', 1),
|
||||
'LOCALE': (str, 'General', 'en'),
|
||||
'LOG_BLACKLIST': (int, 'General', 1),
|
||||
'LOG_DIR': (str, 'General', ''),
|
||||
'LOGGING_IGNORE_INTERVAL': (int, 'Monitoring', 120),
|
||||
|
|
|
@ -3185,6 +3185,7 @@ class WebInterface(object):
|
|||
"pms_web_url": plexpy.CONFIG.PMS_WEB_URL,
|
||||
"pms_name": plexpy.CONFIG.PMS_NAME,
|
||||
"pms_update_check_interval": plexpy.CONFIG.PMS_UPDATE_CHECK_INTERVAL,
|
||||
"locale": plexpy.CONFIG.LOCALE,
|
||||
"date_format": plexpy.CONFIG.DATE_FORMAT,
|
||||
"time_format": plexpy.CONFIG.TIME_FORMAT,
|
||||
"week_start_monday": checked(plexpy.CONFIG.WEEK_START_MONDAY),
|
||||
|
@ -3259,6 +3260,7 @@ class WebInterface(object):
|
|||
https_changed = False
|
||||
refresh_libraries = False
|
||||
refresh_users = False
|
||||
refresh_page = False
|
||||
|
||||
# First run from the setup wizard
|
||||
if kwargs.pop('first_run', None):
|
||||
|
@ -3321,6 +3323,10 @@ class WebInterface(object):
|
|||
kwargs.get('launch_browser') != plexpy.CONFIG.LAUNCH_BROWSER:
|
||||
startup_changed = True
|
||||
|
||||
# Refresh the page if locale changed
|
||||
if kwargs.get('locale') != plexpy.CONFIG.LOCALE:
|
||||
refresh_page = True
|
||||
|
||||
# If we change any monitoring settings, make sure we reschedule tasks.
|
||||
if kwargs.get('check_github') != plexpy.CONFIG.CHECK_GITHUB or \
|
||||
kwargs.get('check_github_interval') != str(plexpy.CONFIG.CHECK_GITHUB_INTERVAL) or \
|
||||
|
@ -3421,7 +3427,10 @@ class WebInterface(object):
|
|||
if refresh_users:
|
||||
threading.Thread(target=users.refresh_users).start()
|
||||
|
||||
return {'result': 'success', 'message': 'Settings saved.'}
|
||||
result = {'result': 'success', 'message': 'Settings saved.'}
|
||||
if refresh_page:
|
||||
result['refresh'] = refresh_page
|
||||
return result
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue