Export Wagtail content to XLIFF and back
Project description
wagtail-xliff-translation
Wagtail XLIFF Translation is a Wagtail library for converting a Wagtail website to XLIFF (XML Localization Interchange File Format) and back. It allows translators to work with -XLIFF based- translation software.
Exporting and importing a sub-tree, or a single page is supported.
Explanation
After succesfully adding this package, new routes will be available (e.g. /admin/pages/<page_id>/xliff/download) and pages will have two extra buttons:
Pressing the download button will open the following page, where you can generate and download the XLIFF file:
This will generate an xliff file in the following format (page used only has a title):
<?xml version="1.0" encoding="utf-8"?>
<xliff srcLang="en-us" trgLang="fr" version="2.0"
xmlns="urn:oasis:names:tc:xliff:document:2.0"
xmlns:mda="urn:oasis:names:tc:xliff:metadata:2.0"
xmlns:slr="urn:oasis:names:tc:xliff:sizerestriction:2.0">
<file id="4_test_app_pagewithrichtext">
<mda:metadata>
<mda:metaGroup category="object_nesting">
<mda:meta type="child">no</mda:meta>
</mda:metaGroup>
</mda:metadata>
<unit canResegment="no" id="title" name="title" slr:sizeRestriction="255" translate="yes" type="local:CharField">
<segment>
<source>A simple page</source>
<target></target>
</segment>
</unit>
<unit canResegment="no" id="slug" name="slug" slr:sizeRestriction="255" translate="yes" type="local:SlugField">
<segment>
<source>a-simple-page</source>
<target></target>
</segment>
</unit>
</file>
</xliff>
Note: the source tags contain the content of the original page, the target tags is where the translations go.
Finally, this package provides an upload page with several options:
Uploading can result in errors, for example when the XLIFF file is missing content in the target tags. Wagtail page validation is also done and can also result in errors.
Editors
The XLIFF file is formatted in such a way it works with XLIFF editors as well, for example Poedit.
Documentation
https://fourdigits.github.io/wagtail-xliff-translation/
Tests
To run the tests, checkout the repository and run:
pytest
Release Process
Checklist:
- Update CONTRIBUTORS.rst if necessary
- Update CHANGELOG.txt
- Everything is commited, clean checkout
With an active virtual environment
pytest
git tag -a <MAJOR>.<MINOR>.<PATCH> -m "<message>"
git push --tags
python -m pip install --upgrade build
python -m build
python -m pip install --upgrade twine
python -m twine upload --repository pypi dist/*
Powered by Four Digits
We love code: https://fourdigits.nl/en/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for wagtail_xliff_translation-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50d8f69daf5aa66df071e88d8d4340809335751ea9004c0cb73536443aed83bd |
|
MD5 | 2d70bc64b0cf9a6309bf9267a4b33f1e |
|
BLAKE2b-256 | a46c883ae8d2e7d2963cfd8b7f7116c388ec1551a19ddee5973766eaa049de4d |
Hashes for wagtail_xliff_translation-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1200839fea53cfa122b842ebbe678893f9ad8ab196966b645507cb4340e2955 |
|
MD5 | fdb2bb65c3c4560aaa1fbea666d28621 |
|
BLAKE2b-256 | e26db44824b1d06dc92923ddcdea1ae2f8fbafe4765aeb90846661eed2a5446c |