Python XLIFF Converter
This package provides a set of utilities for converting rich-text markup files to OASIS XLIFF translatable format. Currently only HTML <=> XLIFF 1.2 conversion is supported.
Installation
Python XLIFF Converter can be installed using pip:
pip install py-xliff-converter
Usage
HTML => XLIFF
Command line:
html2xliff <myfile>.html
This command will create <myfile>.xlf file that can be translated using most common online and offline CAT tools: Trados, memoQ, Transifex etc.
API:
from xliff_converter.html_parser import convert_html
...
with open(html_filename, 'r', encoding='utf-8') as fo:
html = fo.read()
xliff = convert_html(html, html_filename)
...
The convert_html(...) function returns translatable XLIFF document as bytes string encoded in UTF-8.
XLIFF => HTML
Command line:
xliff2html <myfile>.xlf
This command will create <myfile>_<lang>.html file containing translated content of the source HTML file. <lang> is the language code of a target language.
API:
from xliff_converter.html_rebuilder import rebuild_html
...
with open(xliff_filename, 'r', encoding='utf-8') as fo:
xliff = fo.read()
filename, html = rebuild_html(xliff)
The rebuild_html(...) function returns a tuple (named tuple) containing the name of a translated HTML file and its contents as str.
Notes
Currently Python XLIFF Converter supports only English as a source language.
Translatable text is segmented by sentences using NLTK sentence tokenizer.
The HTML converter accepts partial HTML markup, e.g. <body> tag contents and even plain text.
<br> tags are treated as translation segment delimiters.
<pre><code>...</code></pre> blocks are ignored.
To do
More file formats.
XLIFF 2.0 support.
Metadata
Release files for py-xliff-converter 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py-xliff-converter-0.0.1.tar.gz | 8.3 kB | Without provenance | Details for py-xliff-converter-0.0.1.tar.gz |
Release files / py-xliff-converter-0.0.1.tar.gz
| Download URL | py-xliff-converter-0.0.1.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
deb46a207f9c69bfae32c7aaaddbdc5798e334fd4c7151a759283d843ceda514
|
|
BLAKE2b-256 checksum How to use checksums |
47a311d1f99446fc9b6f3f4c9bc43bb6bde7aad414cd532259408ca53ad7b622
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Python-urllib/3.5
|
Security for py-xliff-converter 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.