Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
w2pext
plugin_dbui
Commits
83683246
Commit
83683246
authored
13 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/plugin_dbui/helper.py
+7
-4
7 additions, 4 deletions
modules/plugin_dbui/helper.py
with
7 additions
and
4 deletions
modules/plugin_dbui/helper.py
+
7
−
4
View file @
83683246
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment