diff --git a/modules/plugin_dbui/helper.py b/modules/plugin_dbui/helper.py index 8cbea4fe7c0c7616cc3cc6f2b401970678c61e70..0d128eb018aa50572edd37ab8976eaf7efb369fc 100644 --- a/modules/plugin_dbui/helper.py +++ b/modules/plugin_dbui/helper.py @@ -100,8 +100,8 @@ def get_js_files(server_path, client_path, directory): def get_language(environment): - """Helper method returning the application language. - The result is compliant with the ExtJS file name. + """Helper method returning the application language compliant with + the ExtJS local file name. The dictionary environment contains the keys request, response, session, plugins, .... @@ -109,8 +109,11 @@ def get_language(environment): """ lg = environment['T'].accepted_language - if len(lg) == 5 and lg[0:2] == lg[3:5]: - lg = lg[0:2] + # HTML tag for language: primary-dialect + # Extract the primary language and ignore dialect + m = re.match('([a-z]+)(\-([a-zA-Z]*))?', lg) + if m: + return m.group(1) return lg