TransKit : A New Translation SDK For Software and Web Developers

By Brian McConnell
November 16, 2009

If you've had to build a multilingual website, or worse retrofit an existing website to be multilingual, you know this can be a time consuming and expensive process. The Worldwide Lexicon open source translation platform is now beginning to ship simple libraries that make translated or translatable apps and web services easy to build. This toolset, called TransKit, wraps the existing web API with libraries that also provide services like local caching, support for other localization systems like gettext, and so on.

TransKit will be available in most popular programming languages, including: Python (stand alone and App Engine), PHP, C and C variants, Java and Ruby. Python is available now, C and PHP are due out any time. If you'd like to add your favorite language to the list, see our web API. It's easy to build around.

Hello World

We'll start with the classic "Hello World" example, using the Python library to show how easy this is.

translation = wwl.get(source_lang, target_lang, source_text)

Wherever you want to insert a translation, just call wwl.get() with an optional list of parameters to tell it what translations to use and how to filter them. You can set switches to allow or hide machine translations, anonymous translations, and so forth. It returns the best available translation or the original text if none is available.

Hello World (Translated By Professionals)

Requesting professional translations is as easy as a regular WWL query. You simply add a few extra parameters to provide your credentials for the language service provider you'd like to have translate your texts:

translation = wwl.get(source_lang, target_lang, source_text, lsp='speaklike', lspusername='foo', lsppw='bar')

In this case, WWL looks to see if a professional translation is already in memory and if so, it uses that. If not it returns the best available volunteer or machine translation while also calling out to request a professional translation which is submitted back to the translation memory, typically within minutes.

Submitting A Translation

To submit a translation or edit from a user, simply call:


The edit will be stored in the global translation memory and will become visible to users, typically within a few minutes.

Translation Lookup Process

The TransKit libraries typically look for translations in the following order:

  1. memcached or local memory/disk cache

  2. gettext, if it is supported in that environment

  3. professional translations (from SpeakLike, ProZ and others)

  4. user translations

  5. machine translations from several sources (Google, Apertium, Moses, Language Weaver)

Use Cases

TransKit can be used to embed best effort translation in any application, not just web apps. The C library (several variants are in the works) makes it similarly easy to add translation to desktop, mobile and embedded applications, both to translate a user interface, as well as content. This will make it easy to incorporate translation in new ways into a wide range of applications, for example to make translation a basic feature in web browsers, email clients, etc. Libraries for other languages enable developers to embed translation in websites and web applications, for example to create user translatable websites and web services.

In addition to translating content, TransKit offers a convenient way to dynamically localize applications and web services. Using on demand professional translation, you can cheaply but reliably translate your user interface prompts, and deliver the translations via a web service. This eliminates the need to bundle configuration files with your applications. They simply call the translation service as needed to request and cache translations locally. This allows you to manage translations from a central location and to deliver updates automatically to all of your users.

Well, that's all there is to it, so if you'd like to start experimenting with adding translation to your apps, you can find the code here.

You might also be interested in:

News Topics

Recommended for You

Got a Question?