Skip to content
/ pyglang Public

A python package for translating text with the 'Google AJAX Language API'

License

Notifications You must be signed in to change notification settings

kgn/pyglang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Willkommen - Üdvözlöm - ยินดีต้อนรับ

Welcome to PyGlang, a python package for translating text with the Google Translation API!

How to say 'Hello'

import PyGlang

for language in PyGlang.GetLanguages().iterkeys():
    try:
        print language, PyGlang.Translate('Hello', fromLang='English', toLang=language)
     except PyGlang.TranslationError:
        print ''

By David Keegan With contributions from John Burnett.

Documentation

PyGlang

Translate text with the Google AJAX Language API

PyGlang.Translate(text[, fromLang[, toLang]])

PyGlang.Detect(text)

PyGlang.GetLanguageCode(language)

  • Given a language name return the language code
  • language the language name

PyGlang.GetLanguages()

  • A dictionary of supported languages, where the language name is the key, and the language code is the value.
  • This dictionary comes from the Languages.json file, but it is cached so the file is only read once.

TranslateDotStrings

Translate a .strings file from one language to another.

This script is designed to be a command line tool, the user passes in two .strings files. The first is the file to read and translate, and the second is the file to write to.

python TranslateDotStrings.py fromFilepath toFilepath

TranslateDotStrings.Translate(fromFilepath, toFilepath)

  • Read a .strings file and localize it for the language of another .strings file.
  • The language of each file is determined by the what 'lproj' directory they reside in.
  • fromFilepath the file path of the .strings file to read and translate
  • toFilepath the file path of the .strings file to write

About

A python package for translating text with the 'Google AJAX Language API'

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages