Translations (i18n)
mdgreet natively supports multiple languages using gettext.
Strings are marked for translation in both Rust (gettext("...")) and Slint (@tr("...")).
Managing Translations
We provide Nix-based shell scripts to easily extract and update translations. These are available in your nix develop shell.
1. Extracting Strings
If you add a new string to the code, update the template file (po/mdgreet.pot):
i18n-extract
2. Updating an Existing Language
Merge the new strings from the .pot template into a specific language file (e.g., Russian - ru.po):
i18n-update ru
Then, open po/ru.po in a text editor or a tool like Poedit to translate the empty strings.
3. Adding a New Language
Initialize a new .po file for a language (e.g., French - fr):
i18n-init fr
Testing Translations Locally
You can test translations without changing your system language by prefixing the cargo run command with the LANG environment variable:
LANG=ru_RU.UTF-8 cargo run -- --demo