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
9edb49e1
Commit
9edb49e1
authored
Oct 21, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factor out detection if we can add new language
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
8ca2286a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
weblate/trans/models/subproject.py
weblate/trans/models/subproject.py
+15
-6
No files found.
weblate/trans/models/subproject.py
View file @
9edb49e1
...
...
@@ -1487,20 +1487,29 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
)
return
self
.
_all_flags
def
add_new_language
(
self
,
language
,
request
):
'''
Creates new language file.
'''
def
can_add_new_language
(
self
):
"""Wrapper to check if we can add new language."""
if
self
.
new_lang
!=
'add'
:
r
aise
ValueError
(
'Not supported operation!'
)
r
eturn
False
if
not
self
.
file_format_cls
.
supports_new_language
():
r
aise
ValueError
(
'Not supported operation!'
)
r
eturn
False
base_filename
=
self
.
get_new_base_filename
()
if
not
self
.
file_format_cls
.
is_valid_base_for_new
(
base_filename
):
return
False
return
True
def
add_new_language
(
self
,
language
,
request
):
'''
Creates new language file.
'''
if
not
self
.
can_add_new_language
():
raise
ValueError
(
'Not supported operation!'
)
base_filename
=
self
.
get_new_base_filename
()
filename
=
self
.
file_format_cls
.
get_language_filename
(
self
.
filemask
,
language
.
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