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
ebbd7da8
Commit
ebbd7da8
authored
Mar 11, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use file format class loader instead of ttkit wrapper
parent
fc6bfdd3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
trans/models/translation.py
trans/models/translation.py
+13
-9
No files found.
trans/models/translation.py
View file @
ebbd7da8
...
...
@@ -37,7 +37,7 @@ from datetime import datetime, timedelta
import
weblate
from
lang.models
import
Language
from
trans.formats
import
ttki
t
from
trans.formats
import
AutoForma
t
from
trans.checks
import
CHECKS
from
trans.models.subproject
import
SubProject
from
trans.models.project
import
Project
...
...
@@ -141,7 +141,8 @@ class Translation(models.Model):
def
clean
(
self
):
'''
Validates that filename exists and can be opened using ttkit.
Validates that filename exists and can be opened using
translate-toolkit.
'''
if
not
os
.
path
.
exists
(
self
.
get_filename
()):
raise
ValidationError
(
...
...
@@ -392,9 +393,8 @@ class Translation(models.Model):
'''
Loads translate-toolkit storage from disk.
'''
return
ttkit
(
self
.
get_filename
(),
self
.
subproject
.
file_format
return
self
.
subproject
.
file_format_cls
.
load
(
self
.
get_filename
()
)
@
property
...
...
@@ -994,7 +994,7 @@ class Translation(models.Model):
def
merge_store
(
self
,
author
,
store2
,
overwrite
,
merge_header
,
add_fuzzy
):
'''
Merges t
t
kit store into current translation.
Merges t
ranslate-tool
kit store into current translation.
'''
# Merge with lock acquired
with
self
.
subproject
.
get_git_lock
():
...
...
@@ -1045,7 +1045,7 @@ class Translation(models.Model):
def
merge_suggestions
(
self
,
request
,
store
):
'''
Merges contect of t
t
kit store as a suggestions.
Merges contect of t
ranslate-tool
kit store as a suggestions.
'''
from
trans.models.unitdata
import
Suggestion
ret
=
False
...
...
@@ -1087,9 +1087,13 @@ class Translation(models.Model):
'''
# Load backend file
try
:
store
=
ttkit
(
fileobj
)
# First try using own loader
store
=
self
.
subproject
.
file_format_cls
.
load
(
fileobj
)
except
:
store
=
ttkit
(
fileobj
,
self
.
subproject
.
file_format
)
# Fallback to automatic detection
store
=
AutoFormat
.
load
(
fileobj
)
# Optionally set authorship
if
author
is
None
:
...
...
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