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
6030d5b9
Commit
6030d5b9
authored
Jul 16, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move directory creation to file format object
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
74332bc4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
weblate/trans/formats.py
weblate/trans/formats.py
+14
-8
weblate/trans/models/subproject.py
weblate/trans/models/subproject.py
+0
-5
No files found.
weblate/trans/formats.py
View file @
6030d5b9
...
@@ -670,6 +670,16 @@ class FileFormat(object):
...
@@ -670,6 +670,16 @@ class FileFormat(object):
'''
'''
Adds new language file.
Adds new language file.
'''
'''
# Create directory for a translation
dirname
=
os
.
path
.
dirname
(
fullname
)
if
not
os
.
path
.
exists
(
dirname
):
os
.
makedirs
(
dirname
)
self
.
create_new_file
(
filename
,
code
,
base
)
@
classmethod
def
create_new_file
(
cls
,
filename
,
code
,
base
):
"""Handles creation of new translation file."""
if
cls
.
new_translation
is
None
:
if
cls
.
new_translation
is
None
:
raise
ValueError
(
'Not supported'
)
raise
ValueError
(
'Not supported'
)
...
@@ -794,10 +804,8 @@ class PoFormat(FileFormat):
...
@@ -794,10 +804,8 @@ class PoFormat(FileFormat):
return
False
return
False
@
classmethod
@
classmethod
def
add_language
(
cls
,
filename
,
code
,
base
):
def
create_new_file
(
cls
,
filename
,
code
,
base
):
'''
"""Handles creation of new translation file."""
Adds new language file.
'''
with
open
(
base
,
'r'
)
as
handle
:
with
open
(
base
,
'r'
)
as
handle
:
data
=
handle
.
read
()
data
=
handle
.
read
()
# Assume input is UTF-8 if not specified
# Assume input is UTF-8 if not specified
...
@@ -962,10 +970,8 @@ class JSONFormat(FileFormat):
...
@@ -962,10 +970,8 @@ class JSONFormat(FileFormat):
return
True
return
True
@
classmethod
@
classmethod
def
add_language
(
cls
,
filename
,
code
,
base
):
def
create_new_file
(
cls
,
filename
,
code
,
base
):
'''
"""Handles creation of new translation file."""
Adds new language file.
'''
content
=
'{}
\
n
'
content
=
'{}
\
n
'
if
base
:
if
base
:
with
open
(
base
,
'r'
)
as
handle
:
with
open
(
base
,
'r'
)
as
handle
:
...
...
weblate/trans/models/subproject.py
View file @
6030d5b9
...
@@ -1437,11 +1437,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
...
@@ -1437,11 +1437,6 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
)
)
fullname
=
os
.
path
.
join
(
self
.
get_path
(),
filename
)
fullname
=
os
.
path
.
join
(
self
.
get_path
(),
filename
)
# Create directory for a translation
dirname
=
os
.
path
.
dirname
(
fullname
)
if
not
os
.
path
.
exists
(
dirname
):
os
.
makedirs
(
dirname
)
self
.
file_format_cls
.
add_language
(
self
.
file_format_cls
.
add_language
(
fullname
,
fullname
,
language
.
code
,
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