Skip to content
Command line tool for translate Gettext with Google Translator API
Branch: master
Clone or download
Roman Ožana
Roman Ožana Merge pull request #6 from leonardcj/patch-1
Latest commit 3690ab8 May 20, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Initial commit Mar 21, 2014
src caching based on output file and misc changes Apr 23, 2015
.gitignore Update Mar 22, 2014
composer.json Initial commit Mar 21, 2014
composer.lock Update Mar 22, 2014


Potrans it's PHP command line tool for automatic translation of Gettext PO file with Google Translator API.

Google Translator API

Google Translate API pricing is based on usage. Translation usage is calculated in millions of characters (M), where 1 M = 10^6 characters. For more information, see the Pricing FAQ.

For more information about Google Translate API visit

See supported languages:

Getting API Key

  1. Go to the Google Cloud Console.
  2. Select a project.
  3. In the sidebar on the left, select APIs & auth. In the displayed list of APIs, make sure the Google Translate API status is set to ON.
  4. In the sidebar on the left, select Registered apps.
  5. Select an application.

See full Getting Started guide:


  • Install composer curl -s | php then run composer install for install all dependencies. For more information about Composer visit:
  • Install PHP Curl extension (php5-curl)


Follow example will translate whole content of members-cs_CZ.po from English (default) to Czech language (default)

potrans -k 123456789 -i members-cs_CZ.po -v

Another example it's about output.

potrans -k 123456789 -i example_RU.po -o path/to/output_EN.po -f ru -t en


PO translator parametters
  --verbose, -v  Turn on verbose output
  --help, -h     Show help

  --apikey, -k  Google Translate API Key
  --input, -i   Path to input PO file
  --output, -o  Path to output PO file (default: ./tmp/*.po)
  --from, -f    Source language (default: en) [default: en]
  --to, -t      Target language (default: cs) [default: cs]

  potrans -k 123456789 -i members-cs_CZ.po -v
You can’t perform that action at this time.