Skip to content

API turboframe.i18n_tools

rafageist edited this page Dec 4, 2026 · 4 revisions

turboframe.i18n_tools

Source: turboframe/i18n_tools.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.

An application's catalogues, with Babel (a development tool; the application itself needs only gettext).

python -m turboframe.i18n_tools --domain myapp --src src/myapp extract   # src/myapp/locale/myapp.pot
python -m turboframe.i18n_tools --domain myapp --src src/myapp update    # merge it into every .po
python -m turboframe.i18n_tools --domain myapp --src src/myapp init es   # start a new language
python -m turboframe.i18n_tools --domain myapp --src src/myapp compile   # .po -> .mo (shipped)
python -m turboframe.i18n_tools --domain myapp --src src/myapp all       # extract, update, compile
python -m turboframe.i18n_tools --domain myapp --src src/myapp check     # what is wrong, if anything

The locale folder is <src>/locale unless --locale says otherwise. The texts are the literal arguments of _(), N_() and ngettext(). Translate the .po files with any gettext editor (Poedit, Weblate...), keeping the ~hotkey~ marks (one letter, unique in its menu or dialog) and the {placeholders}; check (turboframe.testing.i18n) finds what is not.

Babel comes with the i18n extra: pip install "turboframe[i18n] @ git+...".

Contents

Catalogues, main

class Catalogues

class Catalogues
Catalogues(domain: str, src: Path, locale: Path | None = None, *, project: str | None = None, bugs: str | None = None)

The catalogues of domain: <locale>/<domain>.pot and <locale>/<lang>/LC_MESSAGES/<domain>.po, made from the texts marked in src.

  • pos() -> list[Path]
  • extract() -> None
  • update() -> None
  • init(language: str) -> None
  • compile() -> None
  • check() -> list[str]

main

def main(argv: list[str] | None = None) -> int

Clone this wiki locally