From e76ae88edc14ce31dc3acabd6902cd1fa8cbf288 Mon Sep 17 00:00:00 2001 From: Robin van Genderen Date: Mon, 4 Mar 2019 11:27:28 +0100 Subject: [PATCH] add userdefined value to get the language value from PR_LANGAUGE with en_GB as fallback --- webapp_admin/webapp_admin.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webapp_admin/webapp_admin.py b/webapp_admin/webapp_admin.py index 826bb08..e0e0668 100755 --- a/webapp_admin/webapp_admin.py +++ b/webapp_admin/webapp_admin.py @@ -173,10 +173,18 @@ Change the language """ def language(user, language): settings = read_settings(user) + # Get language from PR_LANGUAGE + if language == 'userdefined': + try: + language = user.prop(PR_LANGUAGE).value + except: + print('User language is not defined using en_GB as fallback' + language = 'en_GB' + if not settings['settings']['zarafa']['v1'].get('main'): settings['settings']['zarafa']['v1']['main'] = {} - settings['settings']['zarafa']['v1']['main']['language'] = locale - print('Setting locale to: {}'.format(locale)) + settings['settings']['zarafa']['v1']['main']['language'] = language + print('Setting locale to: {}'.format(language)) write_settings(user, json.dumps(settings))