feat(i18n): translate the interface and the journal at runtime

The language setting was plumbing with nothing behind it: no catalogue
shipped, and every label was a bare QStringLiteral, so picking English
changed nothing.

A catalogue is now a JSON file read as it is, translations/<code>.json,
keyed by the French source string. No Linguist, no lrelease, no build
step: a new language costs one file. The catalogues the application
ships with are compiled into the binary, so the chosen language works
whatever the install layout is, while one dropped into a translations
folder still wins over it.

"System" reads what the FWS install left behind — LC_ALL, LC_MESSAGES,
LANG, then the LANG= line of /etc/locale.conf — so the interface follows
the language chosen at install time without the user configuring anything.

Fixes #16
This commit is contained in:
BlackAngelTV committed 2026-09-29 21:17:27 +02:00
1 parent b6f51a76ff
commit a26051795f
9 files changed
+882 -42

No files matched your search

+9 -5
View File
@@ -353,10 +353,14 @@ QFrame* SettingsPage::buildLanguageCard() {
layout->addWidget(question);
m_language = new QComboBox();
m_language->addItem(tr("Langue du système"), QStringLiteral("system"));
// "System" names the language it resolves to: a user who installed FWS in
// German and sees French wants to know which entry would change that.
m_language->addItem(
tr("Langue du système (%1)").arg(
AppSettings::languageName(LanguageManager::resolve(QStringLiteral("system")))),
QStringLiteral("system"));
for (const QString& code : AppSettings::knownLanguages()) {
m_language->addItem(code == QLatin1String("fr") ? tr("Français") : tr("English"),
code);
m_language->addItem(AppSettings::languageName(code), code);
}
connect(m_language, &QComboBox::currentIndexChanged, this, [this](int) {
const QString code = m_language->currentData().toString();
@@ -404,9 +408,9 @@ void SettingsPage::loadLanguageCard() {
m_languageHint->setText(
path.isEmpty()
? tr("Aucune traduction installée : l'interface reste dans la langue de "
"PacManager. Les catalogues .qm sont cherchés dans un dossier "
"PacManager. Les catalogues sont cherchés dans un dossier "
"« translations » à côté de la configuration ou de l'exécutable.")
: tr("Catalogues .qm : %1").arg(path));
: tr("Catalogues : %1").arg(path));
}
// ---------------------------------------------------------------------------