This tool uses google translator to translate msgid(s) in django PO file. You can supply a target language and folder or .PO file absolute location in the input and tool will provide you translated file(s) in dest folder.
I used this tool to translate edX strings in urdu language.
- Python 2 is used.
- Tutorial for osx or linux only.
-
Install requirements by running command on console.
pip install -r requirements.txt
-
Setup google service account key.
-
Enable google translator api on your project from google cloud console.
-
Export google service account key variable on console.
export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"
- Use command
python main.py
- Input file path like
sample/wiki.po
or folder path likesample
- Input language or languages for example
ur
forurdu
anden
forenglish
. - For single language input like:
ur
- For multi language input like:
zh-CN,ur,ar
. You can add as much languages you want. Add comma to separate them without spaces. - You can find list of supported languages here.
(ven) amir$ python main.py
Please input file or folder full path: sample # whole folder
Please input target language(s) comma separated i.e en for english: ur,ar # language codes urdu, arabic