feat(i18n): wrap the interface and the journal wording in tr()

Every label, tooltip, empty state and status message was a bare
QStringLiteral, so nothing could be translated. They now go through tr()
(QCoreApplication::translate from a free helper, QT_TRANSLATE_NOOP where
the code already had it), which is what the catalogues are keyed on.

The journal follows the same rule as the interface: an event, an error and
the two outcomes of a command read in the chosen language. What the tools
print themselves is left alone — that is their output, not our wording —
and so are the qC* developer traces, which keep their technical English.
This commit is contained in:
BlackAngelTV committed 2026-09-29 21:17:49 +02:00
1 parent a26051795f
commit 459a8f045e
11 files changed
+430 -423

No files matched your search

+17 -17
View File
@@ -23,13 +23,13 @@ HistoryPage::HistoryPage(AppCore* core, QWidget* parent) : Page(core, parent) {
QHBoxLayout* filterRow = new QHBoxLayout();
filterRow->setSpacing(10);
QLabel* filterLabel = new QLabel("Filtrer :");
QLabel* filterLabel = new QLabel(tr("Filtrer :"));
filterLabel->setStyleSheet("font-size: 13px; color: #94a3b8;");
filterRow->addWidget(filterLabel);
m_filter = new QComboBox();
m_filter->addItems({"Toutes les actions", "Installations", "Suppressions",
"Mises à jour", "Nettoyages"});
m_filter->addItems({tr("Toutes les actions"), tr("Installations"), tr("Suppressions"),
tr("Mises à jour"), tr("Nettoyages")});
connect(m_filter, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
[this](int) { refreshTable(); });
filterRow->addWidget(m_filter);
@@ -41,19 +41,19 @@ HistoryPage::HistoryPage(AppCore* core, QWidget* parent) : Page(core, parent) {
layout->addLayout(filterRow);
m_table = ui::table({"Date", "Action", "Paquet", "Gestionnaire", "Statut"},
m_table = ui::table({"Date", tr("Action"), tr("Paquet"), tr("Gestionnaire"), tr("Statut")},
/*allStretch=*/true);
layout->addWidget(m_table, 1);
QHBoxLayout* buttonBar = new QHBoxLayout();
buttonBar->addStretch();
QPushButton* exportButton = new QPushButton("Exporter (CSV)");
exportButton->setToolTip("Enregistrer l'historique affiché dans un fichier CSV");
QPushButton* exportButton = new QPushButton(tr("Exporter (CSV)"));
exportButton->setToolTip(tr("Enregistrer l'historique affiché dans un fichier CSV"));
connect(exportButton, &QPushButton::clicked, this, &HistoryPage::exportCsv);
buttonBar->addWidget(exportButton);
QPushButton* clearButton = new QPushButton("Effacer l'historique");
QPushButton* clearButton = new QPushButton(tr("Effacer l'historique"));
clearButton->setProperty("variant", "danger");
clearButton->setIcon(ui::icon("trash"));
connect(clearButton, &QPushButton::clicked, this, [this, core] {
@@ -87,7 +87,7 @@ void HistoryPage::refreshTable() {
if (match) entries.push_back(entry);
}
m_count->setText(QString("%1 action(s)").arg(entries.size()));
m_count->setText(QString(tr("%1 action(s)")).arg(entries.size()));
ui::TableFillBatch batch(m_table);
m_table->setRowCount(static_cast<int>(entries.size()));
@@ -98,13 +98,13 @@ void HistoryPage::refreshTable() {
// The site's status colours, one per action kind.
QString actionText, actionColor;
if (entry.action == "install") {
actionText = "Installation"; actionColor = "#34d399";
actionText = tr("Installation"); actionColor = "#34d399";
} else if (entry.action == "remove") {
actionText = "Suppression"; actionColor = "#f87171";
actionText = tr("Suppression"); actionColor = "#f87171";
} else if (entry.action == "cleanup") {
actionText = "Nettoyage"; actionColor = "#7dd3fc";
actionText = tr("Nettoyage"); actionColor = "#7dd3fc";
} else {
actionText = "Mise à jour"; actionColor = "#fbbf24";
actionText = tr("Mise à jour"); actionColor = "#fbbf24";
}
m_table->setItem(i, 0,
@@ -114,7 +114,7 @@ void HistoryPage::refreshTable() {
m_table->setItem(i, 2, new QTableWidgetItem(QString::fromStdString(entry.package)));
m_table->setItem(i, 3, new QTableWidgetItem(QString::fromStdString(entry.plugin)));
QTableWidgetItem* statusItem =
new QTableWidgetItem(entry.success ? "Succès" : "Échec");
new QTableWidgetItem(entry.success ? tr("Succès") : tr("Échec"));
statusItem->setIcon(ui::icon(entry.success ? "check" : "close"));
m_table->setItem(i, 4, statusItem);
}
@@ -128,14 +128,14 @@ void HistoryPage::exportCsv() {
}
const QString path = QFileDialog::getSaveFileName(
this, "Exporter l'historique",
this, tr("Exporter l'historique"),
QDir::homePath() + "/pacmanager-historique.csv", "CSV (*.csv)");
if (path.isEmpty()) return;
QFile file(path);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QMessageBox::warning(this, "Export",
QString("Impossible d'écrire dans %1").arg(path));
QMessageBox::warning(this, tr("Export"),
QString(tr("Impossible d'écrire dans %1")).arg(path));
return;
}
QTextStream out(&file);
@@ -147,5 +147,5 @@ void HistoryPage::exportCsv() {
<< ui::csvField(QString::fromStdString(entry.plugin)) << ';'
<< (entry.success ? "Succes" : "Echec") << '\n';
}
emit message(QString("Historique exporté vers %1").arg(path));
emit message(QString(tr("Historique exporté vers %1")).arg(path));
}