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
68d5eebd
Commit
68d5eebd
authored
Nov 23, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix editing monolingual Xliff files
Fixes #816 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
e2e8d6e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
weblate/trans/formats.py
weblate/trans/formats.py
+25
-7
No files found.
weblate/trans/formats.py
View file @
68d5eebd
...
...
@@ -496,16 +496,25 @@ class FileFormat(object):
self
.
template_store
is
not
None
)
def
_find_unit_template
(
self
,
context
):
# Need to create new unit based on template
template_ttkit_unit
=
self
.
template_store
.
findid
(
context
)
def
_find_unit_mono
(
self
,
context
,
store
):
# We search by ID when using template
ttkit_unit
=
self
.
store
.
findid
(
context
)
if
ttkit_unit
is
not
None
:
return
ttkit_unit
# Do not use findid as it does not work for empty translations
if
ttkit_unit
is
None
:
for
search_unit
in
self
.
store
.
units
:
if
search_unit
.
getid
()
==
context
:
ttkit_unit
=
search_unit
for
search_unit
in
self
.
store
.
units
:
if
search_unit
.
getid
()
==
context
:
return
search_unit
def
_find_unit_template
(
self
,
context
):
# Need to create new unit based on template
template_ttkit_unit
=
self
.
_find_unit_mono
(
context
,
self
.
template_store
)
# We search by ID when using template
ttkit_unit
=
self
.
_find_unit_mono
(
context
,
self
.
store
)
# We always need new unit to translate
if
ttkit_unit
is
None
:
ttkit_unit
=
template_ttkit_unit
...
...
@@ -953,6 +962,15 @@ class XliffFormat(FileFormat):
content
.
settargetlanguage
(
code
)
content
.
savefile
(
filename
)
def
_find_unit_mono
(
self
,
context
,
store
):
# Do not use findid as it does not work for empty translations
for
search_unit
in
self
.
store
.
units
:
loc
=
search_unit
.
getlocations
()
if
len
(
loc
)
>
0
:
loc
=
loc
[
0
]
if
loc
==
context
:
return
search_unit
@
register_fileformat
class
StringsFormat
(
FileFormat
):
...
...
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