Skip to main content

Easier localization, so everyone can use your programs.

Project description

EzLocale is a language library that makes translation easier (hence the name).

Throw gettext in the trash, because you’ll never need to manually translate again.

Powered by Google Translate, with the googletrans module. https://github.com/ssut/py-googletrans

$ pip install ezlocale

Basic Usage

import ezlocale

# set default language to Spanish
ezlocale.DEST = ezlocale.language.ES

# easier translation
_ = ezlocale.gettext

name = input(_("What's your name? > "))

print(_("Hello, %s!" % name))

¿Cuál es tu nombre? > Patrick

¡Hola, Patrick!

To get a language by its name, just use ezlocale.get_language(name) (case insensitive)

You can also use a different language with each call.

>>> ezlocale.gettext("Hello!", dest=ezlocale.get_language("Latin"))
'Salve!'
>>> ezlocale.gettext("¡Hola!", dest=ezlocale.language.EN, src=ezlocale.language.AUTO)  # anything to english
'Hello!'

To

To clear the translation cache, use ezlocale.clear_cache()

EzLocale uses an LFU cache for each language to make sure resources aren’t wasted. http://github.com/reshanie/faste/

Project details


Release history Release notifications | RSS feed

This version

0.5

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezlocale-0.5.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file ezlocale-0.5.tar.gz.

File metadata

  • Download URL: ezlocale-0.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ezlocale-0.5.tar.gz
Algorithm Hash digest
SHA256 7c53064840a4d50fe66b0715f569293138335b3cbcedefdfa41e3ac5495bf26d
MD5 49106b93d075b4ab1c0e2a1c3d0bbea9
BLAKE2b-256 af57dc2d4b384d819b1529a7fde2c6c10e07715ca5bf8e828706752e18666417

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page