Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.77 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.77 KB

Introduction:

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.

Setup

  • 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"

To run:

  • Use command python main.py
  • Input file path like sample/wiki.po or folder path like sample
  • Input language or languages for example ur for urdu and en for english.
  • 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

Useful links