gettext

The gettext module provides an interface to the GNU gettext library, which is used to provide support for internationalization (i18n). The primary use of gettext is to provide translation of selected program text in a way that’s easy to extend and that’s mostly transparent to the programmer. For example, if you’re writing a program that prompts a user for a password, you might want it to print password in English, passwort in German, contraseña in Spanish, and so forth.

gettext works by making simple string substitutions of selected program text. To do this, it consults a specially constructed locale database that contains mappings of the original program text to translated versions in various languages. This database is application-specific ...

Get Python: Essential Reference, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.