Skip to content

Internationalization

Aglaïa is localized with Qt Linguist (PySide6), not gettext. English (en_US) and French (fr_FR) ship today.

Layout

lib/i18n/
__init__.py install_translator(app, lang_pref) — loads a .qm at startup
aglaia_en_US.ts source catalogue (Qt Linguist XML)
aglaia_fr_FR.ts source catalogue
qm/ compiled .qm binaries (generated; loaded at runtime)

User-facing strings are wrapped in self.tr("…") (or QCoreApplication.translate). The active locale comes from the language config key (KEY_LANGUAGE: "" = follow QLocale.system(), else "en_US" / "fr_FR"), applied before the first widget is built.

Workflow

  1. Extract / update after wrapping new strings:

    Terminal window
    scripts/i18n_extract.sh # pyside6-lupdate → updates the .ts catalogues
  2. Translate — edit the .ts files in Qt Linguist (pyside6-linguist) or by hand; fill each <translation> and drop the type="unfinished".

  3. Compile to the binaries the runtime loads:

    Terminal window
    scripts/i18n_compile.sh # pyside6-lrelease → lib/i18n/qm/*.qm

The .qm files are bundled into the macOS app by Aglaia.spec. To add a locale, add its .ts to scripts/i18n_extract.sh’s TS_FILES, translate, and compile.