Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
44ce88e5
Commit
44ce88e5
authored
Apr 01, 2015
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
a2bcec86
942827ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
weblate/lang/models.py
weblate/lang/models.py
+10
-4
No files found.
weblate/lang/models.py
View file @
44ce88e5
...
...
@@ -107,6 +107,15 @@ class LanguageManager(models.Manager):
return
lang
,
country
def
sanitize_code
(
self
,
code
):
"""
Language code sanitization.
"""
code
=
code
.
replace
(
' '
,
''
).
replace
(
'('
,
''
).
replace
(
')'
,
''
)
while
code
[
-
1
].
isdigit
():
code
=
code
[:
-
1
]
return
code
def
auto_get_or_create
(
self
,
code
):
'''
Gets matching language for code (the code does not have to be exactly
...
...
@@ -114,10 +123,7 @@ class LanguageManager(models.Manager):
It also handles Android special naming of regional locales like pt-rBR
'''
code
=
code
.
replace
(
' '
,
''
).
replace
(
'('
,
''
).
replace
(
')'
,
''
)
while
code
[
-
1
].
isdigit
():
code
=
code
[:
-
1
]
code
=
self
.
sanitize_code
(
code
)
# First try getting langauge as is
ret
=
self
.
try_get
(
code
=
code
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment