Makes localizing or translating your web app as simple as print _('Hello World')
Brian McConnell email@example.com
A cloud based translation and localization utility for Python which combines human and machine translation.
This is a simple but very useful utility that automates the process of localizing a web application or translating dynamic content. It is as simple to use as gettext, but there are no translation files or prompt databases to worry about.
See a helpful how-to article that explains how to mimic this functionality in your development environment or framework of choice: https://github.com/myGengo/avalon/blob/master/howto.md
Note: global variables are defined in config.py to facilitate cross-module usage
sl = 'en'
tl = 'es'
gengo_public_key = 'foo'
gengo_private_key = 'bar'
google_apikey = 'foobar'
translation_order = ['gengo', 'google']
print _('Hello World!')
print _('Hello World!', tm='gengo', tier='pro')
print _('Hello World!', tm='google')
This utility treats translation resources (translation memory, machine translation and human translation APIs) as services that can be queried whenever new texts are encountered. The utility can be somewhat slow when rendering a page with many new source texts, so there are a number of things you can do to improve performance, including:
That said, this tool is very easy to use, and reduces or eliminates the need to deal with static translation files (e.g. PO files), that are both a hassle to manage, and quickly become out of sync with the source material. If you're interested in extending the utility, just start your own fork and let us know.
This module was initially developed as a proof of concept on App Engine. It would be great if developers extended this to support other environments (AWS, Django, etc) and added connectors to additional translation memories (such as TAUS).
Developers should observe the following guidelines when adding to this utility:
I recently wrote a how-to article for O'Reilly Media as a companion to this library. The article describes the basic design pattern and how to mimic this approach in your preferred language or framework. The idea is simple enough, and when done right, swats a bunch of flies in one go. If you decide to implement this in Java, Ruby, Erlang or whatever, be sure to let us know.
Questions, suggestions, email firstname.lastname@example.org