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
27b986d1
Commit
27b986d1
authored
Feb 25, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve language aliases handling
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
c8b85314
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
17 deletions
+21
-17
weblate/lang/data.py
weblate/lang/data.py
+5
-2
weblate/lang/models.py
weblate/lang/models.py
+6
-5
weblate/lang/tests.py
weblate/lang/tests.py
+10
-10
No files found.
weblate/lang/data.py
View file @
27b986d1
...
...
@@ -405,6 +405,7 @@ EXTRALANGS = (
NO_CODE_LANGUAGES
=
frozenset
((
'zh_TW'
,
'zh_CN'
,
'zh_Hant'
,
'zh_Hans'
,
'sr_Latn'
,
'sr_Cyrl'
,
'de_AT'
,
'de_CH'
))
...
...
@@ -735,9 +736,11 @@ LOCALE_ALIASES = {
'in'
:
'id'
,
# Prefer new variants
'sr@latin'
:
'sr_Latn'
,
'sr_RS@latin'
:
'sr_Latn'
,
'sr@cyrillic'
:
'sr_Cyrl'
,
'zh_cn'
:
'zh_Hans'
,
'zh_tw'
:
'zh_Hant'
,
'sr_RS@cyrillic'
:
'sr_Cyrl'
,
'zh_CN'
:
'zh_Hans'
,
'zh_TW'
:
'zh_Hant'
,
}
# List of languages we do not want to import from translate-toolkit
...
...
weblate/lang/models.py
View file @
27b986d1
...
...
@@ -152,9 +152,10 @@ class LanguageManager(models.Manager):
return
ret
# Handle aliases
if
code
in
data
.
LOCALE_ALIASES
:
code
=
data
.
LOCALE_ALIASES
[
code
]
ret
=
self
.
try_get
(
name
=
code
)
for
newcode
in
(
code
,
code
.
replace
(
'-'
,
'_'
),
code
.
replace
(
'-r'
,
'_'
)):
if
newcode
in
data
.
LOCALE_ALIASES
:
newcode
=
data
.
LOCALE_ALIASES
[
newcode
]
ret
=
self
.
try_get
(
code
=
newcode
)
if
ret
is
not
None
:
return
ret
...
...
weblate/lang/tests.py
View file @
27b986d1
...
...
@@ -100,7 +100,7 @@ class LanguagesTest(TestCase):
),
(
'sr_RS@latin'
,
'sr_
RS@lati
n'
,
'sr_
Lat
n'
,
'ltr'
,
'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && '
'(n%100<10 || n%100>=20) ? 1 : 2'
,
...
...
@@ -108,15 +108,15 @@ class LanguagesTest(TestCase):
),
(
'sr-RS@latin'
,
'sr_
RS@lati
n'
,
'sr_
Lat
n'
,
'ltr'
,
'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && '
'(n%100<10 || n%100>=20) ? 1 : 2'
,
'Serbian (latin)'
,
),
(
'sr_RS_Latin'
,
'sr_RS@latin'
,
'sr_Latn'
,
'ltr'
,
'n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && '
'(n%100<10 || n%100>=20) ? 1 : 2'
,
...
...
@@ -138,31 +138,31 @@ class LanguagesTest(TestCase):
),
(
'zh_CN'
,
'zh_
CN
'
,
'zh_
Hans
'
,
'ltr'
,
'0'
,
'
Chinese (China)
'
,
'
Simplified Chinese
'
,
),
(
'zh-CN'
,
'zh_
CN
'
,
'zh_
Hans
'
,
'ltr'
,
'0'
,
'
Chinese (China)
'
,
'
Simplified Chinese
'
,
),
(
'zh-CN@test'
,
'zh_CN@test'
,
'ltr'
,
'0'
,
'Chinese (
China
)'
,
'Chinese (
zh_CN@test
)'
,
),
(
'zh-rCN'
,
'zh_
CN
'
,
'zh_
Hans
'
,
'ltr'
,
'0'
,
'
Chinese (China)
'
,
'
Simplified Chinese
'
,
),
(
'ar'
,
...
...
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