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:
11 files changed
+430
-423
No files matched your search
+26
-26
@@ -22,15 +22,15 @@ CleanupPage::CleanupPage(AppCore* core, QWidget* parent) : Page(core, parent) {
|
||||
hintLayout->setContentsMargins(18, 16, 18, 16);
|
||||
hintLayout->setSpacing(4);
|
||||
|
||||
QLabel* hintTitle = new QLabel("PAQUETS INUTILISÉS ET LEGACY");
|
||||
QLabel* hintTitle = new QLabel(tr("PAQUETS INUTILISÉS ET LEGACY"));
|
||||
hintTitle->setObjectName("cardTitle");
|
||||
hintLayout->addWidget(hintTitle);
|
||||
|
||||
QLabel* hint = new QLabel(
|
||||
"Les <b>orphelins</b> ont été installés comme dépendances et ne sont "
|
||||
tr("Les <b>orphelins</b> ont été installés comme dépendances et ne sont "
|
||||
"plus requis par aucun paquet : ils peuvent être supprimés sans risque. "
|
||||
"Les paquets <b>étrangers</b> viennent de l'AUR ou d'une compilation "
|
||||
"manuelle : vérifiez-les un par un avant de les supprimer.");
|
||||
"manuelle : vérifiez-les un par un avant de les supprimer."));
|
||||
hint->setTextFormat(Qt::RichText);
|
||||
hint->setWordWrap(true);
|
||||
hint->setStyleSheet("font-size: 12px; color: #94a3b8;");
|
||||
@@ -38,47 +38,47 @@ CleanupPage::CleanupPage(AppCore* core, QWidget* parent) : Page(core, parent) {
|
||||
|
||||
layout->addWidget(hintCard);
|
||||
|
||||
m_table = ui::table({"Paquet", "Version", "Type", "Fournisseur"});
|
||||
m_table = ui::table({tr("Paquet"), tr("Version"), tr("Type"), tr("Fournisseur")});
|
||||
connect(m_table, &QTableWidget::currentCellChanged, this,
|
||||
[this](int currentRow, int, int, int) { onSelectionChanged(currentRow); });
|
||||
m_tableStack = ui::withEmptyState(
|
||||
m_table,
|
||||
"Rien à nettoyer pour le moment.\nLancez une analyse pour vérifier.");
|
||||
tr("Rien à nettoyer pour le moment.\nLancez une analyse pour vérifier."));
|
||||
layout->addWidget(m_tableStack, 1);
|
||||
|
||||
QHBoxLayout* buttonBar = new QHBoxLayout();
|
||||
buttonBar->setSpacing(8);
|
||||
|
||||
QPushButton* scanButton = new QPushButton("Analyser");
|
||||
QPushButton* scanButton = new QPushButton(tr("Analyser"));
|
||||
scanButton->setProperty("variant", "primary");
|
||||
scanButton->setIcon(ui::icon("search"));
|
||||
scanButton->setToolTip("Rechercher les paquets inutilisés et legacy");
|
||||
scanButton->setToolTip(tr("Rechercher les paquets inutilisés et legacy"));
|
||||
connect(scanButton, &QPushButton::clicked, this, &CleanupPage::scan);
|
||||
buttonBar->addWidget(scanButton);
|
||||
|
||||
m_removeOrphansButton = new QPushButton("Supprimer les orphelins");
|
||||
m_removeOrphansButton = new QPushButton(tr("Supprimer les orphelins"));
|
||||
m_removeOrphansButton->setProperty("variant", "danger");
|
||||
m_removeOrphansButton->setIcon(ui::icon("trash"));
|
||||
m_removeOrphansButton->setEnabled(false);
|
||||
m_removeOrphansButton->setToolTip(
|
||||
"Supprimer tous les paquets que plus rien ne requiert");
|
||||
tr("Supprimer tous les paquets que plus rien ne requiert"));
|
||||
connect(m_removeOrphansButton, &QPushButton::clicked, this,
|
||||
&CleanupPage::removeOrphans);
|
||||
buttonBar->addWidget(m_removeOrphansButton);
|
||||
|
||||
m_removeSelectionButton = new QPushButton("Supprimer la sélection");
|
||||
m_removeSelectionButton = new QPushButton(tr("Supprimer la sélection"));
|
||||
m_removeSelectionButton->setIcon(ui::icon("trash"));
|
||||
m_removeSelectionButton->setEnabled(false);
|
||||
connect(m_removeSelectionButton, &QPushButton::clicked, this,
|
||||
&CleanupPage::removeSelection);
|
||||
buttonBar->addWidget(m_removeSelectionButton);
|
||||
|
||||
m_cacheButton = new QPushButton("Vider les caches");
|
||||
m_cacheButton = new QPushButton(tr("Vider les caches"));
|
||||
m_cacheButton->setProperty("variant", "warning");
|
||||
m_cacheButton->setIcon(ui::icon("broom"));
|
||||
m_cacheButton->setToolTip(
|
||||
"Purger le cache de paquets (paccache / pacman -Sc) et les runtimes "
|
||||
"Flatpak inutilisés");
|
||||
tr("Purger le cache de paquets (paccache / pacman -Sc) et les runtimes "
|
||||
"Flatpak inutilisés"));
|
||||
connect(m_cacheButton, &QPushButton::clicked, this, &CleanupPage::cleanCaches);
|
||||
buttonBar->addWidget(m_cacheButton);
|
||||
|
||||
@@ -141,13 +141,13 @@ void CleanupPage::populate(const std::vector<PackageInfo>& candidates) {
|
||||
}
|
||||
batch.release();
|
||||
|
||||
m_count->setText(QString("%1 orphelin(s) · %2 legacy")
|
||||
m_count->setText(QString(tr("%1 orphelin(s) · %2 legacy"))
|
||||
.arg(orphans)
|
||||
.arg(static_cast<int>(candidates.size()) - orphans));
|
||||
m_removeOrphansButton->setEnabled(orphans > 0);
|
||||
m_removeOrphansButton->setText(orphans > 0
|
||||
? QString("Supprimer les orphelins (%1)").arg(orphans)
|
||||
: QString("Supprimer les orphelins"));
|
||||
? QString(tr("Supprimer les orphelins (%1)")).arg(orphans)
|
||||
: QString(tr("Supprimer les orphelins")));
|
||||
|
||||
if (!candidates.empty()) m_table->selectRow(0);
|
||||
onSelectionChanged(m_table->currentRow());
|
||||
@@ -167,9 +167,9 @@ void CleanupPage::onSelectionChanged(int row) {
|
||||
// warning: nothing on the system proves it is unused.
|
||||
m_removeSelectionButton->setToolTip(
|
||||
pkg.orphan
|
||||
? QString("Supprimer « %1 » (orphelin)").arg(name)
|
||||
: QString("Supprimer « %1 » (%2) — à vérifier : rien ne prouve "
|
||||
"qu'il est inutilisé")
|
||||
? QString(tr("Supprimer « %1 » (orphelin)")).arg(name)
|
||||
: QString(tr("Supprimer « %1 » (%2) — à vérifier : rien ne prouve "
|
||||
"qu'il est inutilisé"))
|
||||
.arg(name, QString::fromStdString(pkg.cleanupReason)));
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void CleanupPage::removeOrphans() {
|
||||
emit message(tr("Aucun orphelin à supprimer."));
|
||||
return;
|
||||
}
|
||||
removePackages(orphans, QString("%1 orphelin(s)").arg(orphans.size()));
|
||||
removePackages(orphans, QString(tr("%1 orphelin(s)")).arg(orphans.size()));
|
||||
}
|
||||
|
||||
void CleanupPage::removeSelection() {
|
||||
@@ -191,7 +191,7 @@ void CleanupPage::removeSelection() {
|
||||
|
||||
// Copied: the candidate list is rebuilt once the removal completes.
|
||||
const PackageInfo pkg = m_candidates[row];
|
||||
removePackages({pkg}, QString("« %1 »").arg(QString::fromStdString(pkg.name)));
|
||||
removePackages({pkg}, QString(tr("« %1 »")).arg(QString::fromStdString(pkg.name)));
|
||||
}
|
||||
|
||||
void CleanupPage::removePackages(const std::vector<PackageInfo>& packages,
|
||||
@@ -201,8 +201,8 @@ void CleanupPage::removePackages(const std::vector<PackageInfo>& packages,
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this, "Nettoyage",
|
||||
QString("Supprimer %1 ?\n\nCette action est irréversible.").arg(description))
|
||||
if (QMessageBox::question(this, tr("Nettoyage"),
|
||||
QString(tr("Supprimer %1 ?\n\nCette action est irréversible.")).arg(description))
|
||||
!= QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
@@ -222,11 +222,11 @@ void CleanupPage::cleanCaches() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (QMessageBox::question(this, "Nettoyage",
|
||||
QString("Vider les caches de %1 ?\n\npacman ne conserve que la "
|
||||
if (QMessageBox::question(this, tr("Nettoyage"),
|
||||
QString(tr("Vider les caches de %1 ?\n\npacman ne conserve que la "
|
||||
"dernière version de chaque paquet téléchargé et Flatpak "
|
||||
"supprime les runtimes qu'aucune application n'utilise "
|
||||
"plus.").arg(names.join(", "))) != QMessageBox::Yes) {
|
||||
"plus.")).arg(names.join(", "))) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user