Skip to content
Snippets Groups Projects
Commit 83683246 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Modify the algorithm of get_language to extract only the primary language.

parent 48ebe0b3
No related branches found
No related tags found
No related merge requests found
...@@ -100,8 +100,8 @@ def get_js_files(server_path, client_path, directory): ...@@ -100,8 +100,8 @@ def get_js_files(server_path, client_path, directory):
def get_language(environment): def get_language(environment):
"""Helper method returning the application language. """Helper method returning the application language compliant with
The result is compliant with the ExtJS file name. the ExtJS local file name.
The dictionary environment contains the keys request, response, The dictionary environment contains the keys request, response,
session, plugins, .... session, plugins, ....
...@@ -109,8 +109,11 @@ def get_language(environment): ...@@ -109,8 +109,11 @@ def get_language(environment):
""" """
lg = environment['T'].accepted_language lg = environment['T'].accepted_language
if len(lg) == 5 and lg[0:2] == lg[3:5]: # HTML tag for language: primary-dialect
lg = lg[0:2] # Extract the primary language and ignore dialect
m = re.match('([a-z]+)(\-([a-zA-Z]*))?', lg)
if m:
return m.group(1)
return lg return lg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment