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
d7a3b094
Commit
d7a3b094
authored
Jul 08, 2015
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
fbd008ec
5889ed4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
weblate/trans/models/subproject.py
weblate/trans/models/subproject.py
+4
-0
weblate/trans/tests/test_models.py
weblate/trans/tests/test_models.py
+26
-0
No files found.
weblate/trans/models/subproject.py
View file @
d7a3b094
...
...
@@ -1039,6 +1039,10 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
translated_langs
=
set
()
for
match
in
matches
:
code
=
self
.
get_lang_code
(
match
)
if
not
code
:
raise
ValidationError
(
_
(
'Got empty language code for %s, please check filemask!'
)
%
match
)
lang
=
Language
.
objects
.
auto_get_or_create
(
code
=
code
)
if
code
in
langs
:
raise
ValidationError
(
_
(
...
...
weblate/trans/tests/test_models.py
View file @
d7a3b094
...
...
@@ -689,6 +689,32 @@ class SubProjectTest(RepoTestCase):
subproject
.
run_hook
(
'true'
)
)
def
test_lang_code
(
self
):
subproject
=
SubProject
()
subproject
.
filemask
=
'Solution/Project/Resources*.resx'
self
.
assertEqual
(
subproject
.
get_lang_code
(
'Solution/Project/Resources.es-mx.resx'
),
'.es-mx'
)
self
.
assertEqual
(
subproject
.
get_lang_code
(
'Solution/Project/Resources.resx'
),
''
)
self
.
assertRaisesMessage
(
ValidationError
,
'Got empty language code for '
'Solution/Project/Resources.resx, please check filemask!'
,
subproject
.
clean_lang_codes
,
[
'Solution/Project/Resources.resx'
,
'Solution/Project/Resources.de.resx'
,
'Solution/Project/Resources.es.resx'
,
'Solution/Project/Resources.es-mx.resx'
,
'Solution/Project/Resources.fr.resx'
,
'Solution/Project/Resources.fr-fr.resx'
,
]
)
class
TranslationTest
(
RepoTestCase
):
"""
...
...
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