b
Download translate.py
This is a module I wrote for Python, intended to be used primarily within an interactive interpreter, which translates a string between human languages. It relies on the google translation service.

Documentation

translate(string, string, string)
Takes a string, a first language, and a second language, and returns the string translated from the first language into the second language. This is done by utilizing Google's translation service.

Ex:
translate('wie gehts?', 'German', 'English') -> 'how are you?'

Valid languages at present are (case insensitive):
arabic, bulgarian, chinese, croatian, czech, danish, dutch, english,
finnish, french, german, greek, hindi, italian, japanese, korean,
norwegian, polish, portugese, romanian, russian, spanish, swedish

These can be modified by altering the content of the langCode variable.

Examples

In [1]: from translate import * In [2]: translate('wo bist du?', 'german', 'english') Out[2]: 'where are you?'