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
01ea4957
Commit
01ea4957
authored
Mar 03, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added XLIFF export for dictionary.
Issue #810 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
88818f90
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
docs/changes.rst
docs/changes.rst
+1
-0
weblate/html/dictionary.html
weblate/html/dictionary.html
+1
-0
weblate/trans/tests/test_dictionary.py
weblate/trans/tests/test_dictionary.py
+20
-0
weblate/trans/views/dictionary.py
weblate/trans/views/dictionary.py
+11
-2
No files found.
docs/changes.rst
View file @
01ea4957
...
...
@@ -42,6 +42,7 @@ Released on ? 2015.
* Improved notifications on parse erorrs.
* Added option to import components with duplicate name to import_project.
* Improved support for translating PHP files
* Added XLIFF export for dictionary.
weblate 2.4
-----------
...
...
weblate/html/dictionary.html
View file @
01ea4957
...
...
@@ -100,6 +100,7 @@
<ul>
<li><a
href=
"{% url 'download_dictionary' project=project.slug lang=language.code %}?format=csv"
>
{% trans "Comma separated values (CSV)" %}
</a></li>
<li><a
href=
"{% url 'download_dictionary' project=project.slug lang=language.code %}?format=po"
>
{% trans "Gettext (PO)" %}
</a></li>
<li><a
href=
"{% url 'download_dictionary' project=project.slug lang=language.code %}?format=xliff"
>
{% trans "XML Localisation Interchange File Format (XLIFF)" %}
</a></li>
<li><a
href=
"{% url 'download_dictionary' project=project.slug lang=language.code %}?format=tbx"
>
{% trans "TermBase eXchange (TBX)" %}
</a></li>
</ul>
</div>
...
...
weblate/trans/tests/test_dictionary.py
View file @
01ea4957
...
...
@@ -218,6 +218,26 @@ class DictionaryTest(ViewTestCase):
'<term>webové stránky</term>'
)
def
test_download_xliff
(
self
):
'''
Test for downloading XLIFF file.
'''
# Import test data
self
.
import_file
(
TEST_TBX
)
response
=
self
.
client
.
get
(
self
.
get_url
(
'download_dictionary'
),
{
'format'
:
'xliff'
}
)
self
.
assertContains
(
response
,
'<source>website</source>'
)
self
.
assertContains
(
response
,
'<target state="translated">webové stránky</target>'
)
def
test_download_po
(
self
):
'''
Test for downloading PO file.
...
...
weblate/trans/views/dictionary.py
View file @
01ea4957
...
...
@@ -208,6 +208,15 @@ def download_dictionary_ttkit(export_format, prj, lang, words):
)),
)
)
elif
export_format
==
'xliff'
:
# Construct store
from
translate.storage.xliff
import
xlifffile
store
=
xlifffile
()
# Export parameters
content_type
=
'application/x-xliff+xml'
extension
=
'xlf'
has_lang
=
True
else
:
# Construct store
from
translate.storage.tbx
import
tbxfile
...
...
@@ -249,7 +258,7 @@ def download_dictionary(request, project, lang):
export_format
=
None
if
'format'
in
request
.
GET
:
export_format
=
request
.
GET
[
'format'
]
if
export_format
not
in
(
'csv'
,
'po'
,
'tbx'
):
if
export_format
not
in
(
'csv'
,
'po'
,
'tbx'
,
'xliff'
):
export_format
=
'csv'
# Grab all words
...
...
@@ -259,7 +268,7 @@ def download_dictionary(request, project, lang):
).
order_by
(
'source'
)
# Translate toolkit based export
if
export_format
in
(
'po'
,
'tbx'
):
if
export_format
in
(
'po'
,
'tbx'
,
'xliff'
):
return
download_dictionary_ttkit
(
export_format
,
prj
,
lang
,
words
)
# Manually create CSV file
...
...
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