A framework to allow im and export of xliff files for translations
Project description
Code repository: https://github.com/collective/slc.xliff
Questions and comments to info (at) syslab (dot) com
Overview
XLIFF (XML Localization Interchange File Format) is an XML-based format created to standardize localization. slc.xliff is a framework to allow export of Plone content to XLIFF files for translation and also to import the translated XLIFF files.
Translating content using XLIFF
Export
Most content objects in Plone can be exported to XLIFF. On any page in a portal you can select Actions->XLIFF Export. Here you have the following options:
Recursive subtree export?
Generate a single file?
Download as zip?
HTML compatibility mode (recommended)
These options are mostly self explanatory.
If your translator is able to read XLIFF natively (e.g. the translation program Trados is able to do that), send the native xliff version, otherwise make sure you have checked the HTML compatibility option. That generates an HTMLized XLIFF version which can be edited and translated using a common HTML editor.
The XLIFF file contains a reference to the id of the object translated as well as the path. This means it will still work correctly even if the path to the item has changed.
Import
When the translations have been returned they can be imported via the Actions->Import Xliff menu. Select HTML compatibility mode if the XLIFF file also used that option, or if an XML version was mistakenly edited in an HTML editor and converted by the translator.
A single .xliff file can be uploaded which contains multiple translations. Alternatively a .zip file can be uploaded which contains many .xliff files. If the filenames are prefixed with the language code then that code will be used to determine the language, even if the target-language attribute is not set correctly e.g. my-test-file_de.xliff will be treated as the German translation of my-test-file.
XLIFF format overview
Some sample XLIFF:
<file original="/osha/portal/Members/test-user/a-very-interesting-report" oid="6c4858d40cdcb7bce24aacead4er6a26" source-language="en" target-language="en"> <body> <group> <trans-unit id="title"> <source xml:lang='en'> <!-- A interesting report --> </source> <target xml:lang='en'> A interesting report </target> </trans-unit> <trans-unit id="description"> <source xml:lang='en'> <!-- A report on a wide variety of topics. --> </source> <target xml:lang='en'> A report on a wide variety of topics. </target> </trans-unit>
Note that the oid refers to the unique ID of the item. The translator will edit the content inside the target entities.
HTML Compatibility
Unfortunately some translators still only can translate using html editors. For this case we supply an htmlized form of the xliff file which adds an html header. It also hides the source tags and adds the source language into the target tag so that it can be translated by replacing it. There is a flag to use compatibility mode.
There is a log output which explicitly states which languages have been uploaded and where parsing problems have occured. Note that in html compatibility mode you are responsible yourself to check if the results are good.
Credits
Copyright European Agency for Health and Safety at Work and Syslab.com GmbH.
slc.xliff development was funded by the European Agency for Health and Safety at Work.
License
slc.xliff is licensed under the GNU Lesser Generic Public License, version 2 or later and EUPL version 1.1 only. The complete license texts can be found in docs/LICENSE.GPL and docs/LICENSE.EUPL.
slc.xliff Changelog
4.0 (2022-06-06)
Test only Plone 5.2 and 6.0 [erral]
Setup github actions [erral]
Allow language variants (pt-br) when importing files [erral]
3.0 (2020-04-29)
No changes. [erral]
3.0b1 (2019-07-11)
Changes to support python3 and Plone 5.2 [erral]
Convert doctests to standard tests [erral]
Remove Archetypes support [erral]
Remove slc.shoppinglist support [erral]
2.0b2 (2014-10-20)
Bugfix in _guessLanguage
2.0b1 (2014-07-10)
This release drops support for LinguaPlone and switches to plone.app.multilingual.
Todo:
get rid of all references to slc.shoppinglist
1.3.3 (2012-11-05)
Bugfix in the way HTML entities were converted [thomasw]
1.3.2 (2012-09-21)
Typo [thomasw]
1.3.1 (2012-09-21)
Don’t do intermediate transaction.commit() when importing, to avoid ConflictErrors #5685 [thomasw]
1.3 (2012-09-17)
Plone 4
1.2.2 (unreleased)
Set a document’s text_format (e.g. text/html) based on the source’s setting (thomasw)
1.2.1 (2009-12-13)
Bugfix, wrong dummy interface definition (thomasw)
1.2 (2009-12-13)
Added EUPL license (deroiste)
When exporting by path, sort results by pyth (shortest first), to make sure top-level objects come first. (thomasw)
Enabled epoxrt of slc.seminarportal’s Seminar (thomasw)
1.1 (2009-06-19)
code cleanup (gerken)
fixed tests (gerken)
1.0 (2008-03-31)
packaged egg
1.0b1
Added export support for IObjectManager
Added browser views, actions
1.0a1
port from eITXliffTool to slc.xliff plone3 compatible
Contributors
Patrick Gerken (Syslab.com GmbH)
Wolfgang Thomas (Syslab.com GmbH)
Alexander Pilz (Syslab.com GmbH)
Mikel Larreategi (CodeSyntax)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file slc.xliff-4.0.tar.gz
.
File metadata
- Download URL: slc.xliff-4.0.tar.gz
- Upload date:
- Size: 44.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.27.1 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae89891974e25c17fbe8279d10ae7c294aef5bf16a57a068dc15182556906f27 |
|
MD5 | e709473a0a57e556dbc6dd70944f39c4 |
|
BLAKE2b-256 | 9c49d6a6a3f518100edea56ecac01a5647777d2b1b4df41d16635364476e36c4 |