← All notes

Python gettext: multilingual internationalization services

Answer: The gettext module provides multilingual internationalization services. The global API can change translation for the whole application. bindtextdomain binds a domain to a locale directory of binary .mo files.

Examples

import gettext
gettext.bindtextdomain('myapp', 'locales')

Notes

The global API is often what you want for a monolingual application whose language follows the user locale. The docs also describe a class-based API.

Reference list

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python docs, gettext — Multilingual internationalization services; CPython docs, gettext.rst. PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python docs, gettext — Multilingual internationalization services; CPython docs, gettext.rst. PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.

Cite this

Permanent ID: iil:note:j41se7pr

iinventedlight. 2026. "Python gettext: multilingual internationalization services." iinventedlight Library, iil:note:j41se7pr, version of 2026-11-18. https://iinventedlight.com/library/notes/python-gettext/. License: CC-BY-4.0.

@misc{iil_note_j41se7pr,
  author = {{iinventedlight}},
  title = {{Python gettext: multilingual internationalization services}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/python-gettext/},
  note = {Permanent ID iil:note:j41se7pr. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-gettext.md.