Browse documentation
DocsStart
Quickstart
Install Lokit, parse a localization file, inspect its typed units, and write another format.
01
Install the package
The distribution name on PyPI is lokit-python; the import name is lokit. Lokit currently requires Python 3.10 or newer and is classified as beta, so pin the version used by production integrations.
Terminal
python -m pip install lokit-python==0.5.002
Parse, inspect, and write
Materialized parsers return BaseStructure. Every supported input converges on the same unit model, so the write step does not depend on the original file type.
convert.py
import lokit
document = lokit.parse.tmx( "messages.tmx", source_language="en", target_language="fr",)
for unit_id, unit in document.data.items(): print(unit_id, unit.source, unit.target)
lokit.write.xliff(document, "messages.fr.xliff")03
Use auto-detection when defaults are enough
lokit.parse.file(path) detects supported inputs from content and extension. Use a format-specific parser when you need target selection, locale mapping, parse modes, inline-tag controls, spreadsheet columns, or progress settings.
detect.py
import lokit
document = lokit.parse.file("messages.xliff")document.export.lokit("messages.lokit")