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
83d7cfda
Commit
83d7cfda
authored
Apr 25, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure the downloaded files keep context
Fixes #1076 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
e2aaf97f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
weblate/trans/exporters.py
weblate/trans/exporters.py
+1
-1
weblate/trans/tests/test_exporters.py
weblate/trans/tests/test_exporters.py
+20
-1
No files found.
weblate/trans/exporters.py
View file @
83d7cfda
...
...
@@ -112,7 +112,7 @@ class BaseExporter(object):
output
.
target
=
multistring
(
self
.
handle_plurals
(
unit
.
get_target_plurals
())
)
output
.
context
=
self
.
string_filter
(
unit
.
context
)
output
.
setcontext
(
self
.
string_filter
(
unit
.
context
)
)
for
location
in
unit
.
location
.
split
():
if
location
:
output
.
addlocation
(
location
)
...
...
weblate/trans/tests/test_exporters.py
View file @
83d7cfda
...
...
@@ -31,6 +31,7 @@ from weblate.trans.models import (
class
PoExporterTest
(
TestCase
):
_class
=
PoExporter
_has_context
=
True
def
get_exporter
(
self
):
return
self
.
_class
(
...
...
@@ -41,6 +42,7 @@ class PoExporterTest(TestCase):
def
check_export
(
self
,
exporter
):
output
=
exporter
.
serialize
()
self
.
assertIsNotNone
(
output
)
return
output
def
check_dict
(
self
,
word
):
exporter
=
self
.
get_exporter
()
...
...
@@ -72,7 +74,7 @@ class PoExporterTest(TestCase):
)
exporter
=
self
.
get_exporter
()
exporter
.
add_unit
(
unit
)
self
.
check_export
(
exporter
)
return
self
.
check_export
(
exporter
)
def
test_unit
(
self
):
self
.
check_unit
(
...
...
@@ -93,18 +95,35 @@ class PoExporterTest(TestCase):
target
=
'yyy'
,
)
def
test_context
(
self
):
result
=
self
.
check_unit
(
source
=
'foo'
,
target
=
'bar'
,
context
=
'context'
,
translated
=
True
,
)
if
self
.
_has_context
:
self
.
assertIn
(
'context'
,
result
)
elif
self
.
_has_context
is
not
None
:
self
.
assertNotIn
(
'context'
,
result
)
class
PoXliffExporterTest
(
PoExporterTest
):
_class
=
PoXliffExporter
_has_context
=
False
class
XliffExporterTest
(
PoExporterTest
):
_class
=
XliffExporter
_has_context
=
False
class
TBXExporterTest
(
PoExporterTest
):
_class
=
TBXExporter
_has_context
=
False
class
MoExporterTest
(
PoExporterTest
):
_class
=
MoExporter
# Not supported in current translate-toolkit, but PR submitted
_has_context
=
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