[PYTHON] Convert translation resource files (.po) to XLIFF format (.xlf)

【environment】

Mac OS X 10.8

【procedure】

  1. Install python, virtualenv

Install Python 2.7

$ brew install python

Installation of virtualenv and virtualenvwrapper

$ pip install virtualenv virtualenvwrapper

Add the following to .zshrc or .bashrc to pass the path to virtualenvwrapper

source /usr/local/bin/virtualenvwrapper.sh

  1. Download the Translate Toolkit When downloading a file

$ wget https://github.com/translate/translate/archive/1.11.0.tar.gz $ tar xzvf translate-toolkit-1.11.0.tar.bz2 $ cd translate-1.11.0

For git

$ git clone https://github.com/translate/translate.git $ cd translate

  1. Set up a virtual environment and pip install the package

$ mkvirtualenv translate --python /usr/local/bin/python $ workon translate $ pip install -r requirements/recommended.txt $ easy_install lxml $ ./setup.py install

  1. Convert files with po2liff

$ po2xliff --version po2xliff 1.11.0 $ po2xliff en_US.po en_US.xlf processing 1 files... [###########################################] 100%

Now you can convert the file.

Recommended Posts

Convert translation resource files (.po) to XLIFF format (.xlf)
Linux script to convert Markdown files from JupyterLab format to Qiita format
I made a script in python to convert .md files to Scrapbox format
Convert xml format data to txt format data (yolov3)
How to easily convert format from Markdown
Convert matplotlib graphs to emf file format
Rename YYYYMMDD format files to serial numbers
Convert PDF attached to email to text format
Convert PDF files to PNG files with GIMP
Convert Python date types to RFC822 format
How to convert DateTimeField format in Django
[Tensorflowjs_converter] How to convert Tensorflow model to Tensorflow.js format
Convert FBX files to ASCII <-> BINARY in Python
Convert UTF-8 CSV files to read in Excel
Convert multiple jpg files to one PDF file
Convert json format data to txt (using yolo)
Convert binary packages for windows to wheel format
Convert strings to character-by-character list format with python