Skip to main content

EzLocale

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/

Metadata

Release files for ezlocale 0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezlocale 0.5
File Size Uploaded Provenance Actions
ezlocale-0.5.tar.gz 4.6 kB Without provenance Details for ezlocale-0.5.tar.gz

Release files / ezlocale-0.5.tar.gz

Download URL ezlocale-0.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7c53064840a4d50fe66b0715f569293138335b3cbcedefdfa41e3ac5495bf26d
BLAKE2b-256 checksum
How to use checksums
af57dc2d4b384d819b1529a7fde2c6c10e07715ca5bf8e828706752e18666417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for ezlocale 0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page