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
5b1adfe3
Commit
5b1adfe3
authored
Feb 25, 2016
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
952fccb5
da0167e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
17 deletions
+33
-17
weblate/lang/data.py
weblate/lang/data.py
+5
-2
weblate/lang/models.py
weblate/lang/models.py
+18
-5
weblate/lang/tests.py
weblate/lang/tests.py
+10
-10
No files found.
weblate/lang/data.py
View file @
5b1adfe3
...
...
@@ -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'
))
...
...
@@ -725,9 +726,9 @@ LOCALE_ALIASES = {
'german'
:
'de'
,
'french'
:
'fr'
,
# Android
'be-r
BY
'
:
'be@latin'
,
'be-r
by
'
:
'be@latin'
,
# Misc invalid codes
'val
-ES
'
:
'ca@valencia'
,
'val
_es
'
:
'ca@valencia'
,
'jp'
:
'ja'
,
# Old locale codes
'iw'
:
'he'
,
...
...
@@ -735,7 +736,9 @@ LOCALE_ALIASES = {
'in'
:
'id'
,
# Prefer new variants
'sr@latin'
:
'sr_Latn'
,
'sr_rs@latin'
:
'sr_Latn'
,
'sr@cyrillic'
:
'sr_Cyrl'
,
'sr_rs@cyrillic'
:
'sr_Cyrl'
,
'zh_cn'
:
'zh_Hans'
,
'zh_tw'
:
'zh_Hant'
,
}
...
...
weblate/lang/models.py
View file @
5b1adfe3
...
...
@@ -132,6 +132,21 @@ class LanguageManager(models.Manager):
code
=
code
[:
-
1
]
return
code
def
aliases_get
(
self
,
code
):
code
=
code
.
lower
()
codes
=
(
code
,
code
.
replace
(
'-'
,
'_'
),
code
.
replace
(
'-r'
,
'_'
)
)
for
newcode
in
codes
:
if
newcode
in
data
.
LOCALE_ALIASES
:
newcode
=
data
.
LOCALE_ALIASES
[
newcode
]
ret
=
self
.
try_get
(
code
=
newcode
)
if
ret
is
not
None
:
return
ret
return
None
def
fuzzy_get
(
self
,
code
):
'''
Gets matching language for code (the code does not have to be exactly
...
...
@@ -152,11 +167,9 @@ 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
)
if
ret
is
not
None
:
return
ret
ret
=
self
.
aliases_get
(
code
)
if
ret
is
not
None
:
return
ret
# Parse the string
lang
,
country
=
self
.
parse_lang_country
(
code
)
...
...
weblate/lang/tests.py
View file @
5b1adfe3
...
...
@@ -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