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))