/xliff-to-JSON-ttag

Convert XLIFF files from crowdin to ttag JSON (compact)

Primary LanguagePython

Convert XLIFF to ttag JSON (compact format)

Based on https://ttag.js.org/

requirements

  • python 3.x (3.9 during this dev)
  • lxml
  • pipenv optional

CLI

usage: convert.py [-h] --input INPUT --output OUTPUT --locale LOCALE

convert xliff to ttag JSON (compact)

optional arguments:
  -h, --help       show this help message and exit
  --input INPUT    input xliff file
  --output OUTPUT  output JSON file
  --locale LOCALE  locale from crowdin you're using

ex: $ python convert.py --input demo/webapp.xliff --output monique.json --locale fr

for [--locale] you can open the file lib/config/gettext-plurals.json to see all the options you have

How to get the xliff from crowdin?

You need to download the translations from the download button here when you open your language.

download

⚠️ Do not pick the 2 options export xxx xliff as crowdin has an issue and breaks the plurals inside these files.