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
+100
-102
@@ -104,7 +104,7 @@ AppCore::AppCore(QObject* parent) : QObject(parent) {
|
||||
m_plugins = new PluginManager();
|
||||
m_plugins->registerBuiltin(
|
||||
{"pacman", "Pacman", "1.0.0",
|
||||
"Gestionnaire de paquets natif d'Arch Linux", "FWS"},
|
||||
tr("Gestionnaire de paquets natif d'Arch Linux").toStdString(), "FWS"},
|
||||
new PacmanManager());
|
||||
m_plugins->discoverExternal();
|
||||
|
||||
@@ -141,11 +141,11 @@ AppCore::AppCore(QObject* parent) : QObject(parent) {
|
||||
|
||||
qCInfo(pacmgrOp) << "core ready,"
|
||||
<< static_cast<int>(availableProviders().size())
|
||||
<< "provider(s) available";
|
||||
<< tr("provider(s) available");
|
||||
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("app"),
|
||||
QStringLiteral("PacManager %1 démarré — %2 gestionnaire(s) : %3")
|
||||
tr("PacManager %1 démarré — %2 gestionnaire(s) : %3")
|
||||
.arg(version())
|
||||
.arg(static_cast<int>(availableProviders().size()))
|
||||
.arg(providerLabel(availableProviders())));
|
||||
@@ -252,13 +252,13 @@ void AppCore::setCredentialMode(CredentialMode mode) {
|
||||
clearSudoPassword();
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("config"),
|
||||
QStringLiteral("identifiants sudo demandés à chaque opération"));
|
||||
emit statusMessage(QStringLiteral("Identifiants demandés à chaque opération."));
|
||||
tr("identifiants sudo demandés à chaque opération"));
|
||||
emit statusMessage(tr("Identifiants demandés à chaque opération."));
|
||||
} else {
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("config"),
|
||||
QStringLiteral("identifiants sudo demandés une fois par session"));
|
||||
emit statusMessage(QStringLiteral("Identifiants enregistrés pour la session."));
|
||||
tr("identifiants sudo demandés une fois par session"));
|
||||
emit statusMessage(tr("Identifiants enregistrés pour la session."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,15 +286,15 @@ AppCore::StartResult AppCore::credentialGate(
|
||||
if (!privileged) return accepted();
|
||||
|
||||
if (!m_pacman || !m_pacman->isAvailable()) {
|
||||
return refused(QStringLiteral("pacman est indisponible sur ce système."));
|
||||
return refused(tr("pacman est indisponible sur ce système."));
|
||||
}
|
||||
if (std::system("which sudo > /dev/null 2>&1") != 0) {
|
||||
return refused(QStringLiteral("sudo n'est pas installé sur ce système."));
|
||||
return refused(tr("sudo n'est pas installé sur ce système."));
|
||||
}
|
||||
if (m_pacman->hasPassword()) return accepted();
|
||||
|
||||
// The view prompts for the password and calls retryPendingRequest().
|
||||
return refused(QStringLiteral("Mot de passe administrateur (sudo) requis."),
|
||||
return refused(tr("Mot de passe administrateur (sudo) requis."),
|
||||
/*needsPassword=*/true);
|
||||
}
|
||||
|
||||
@@ -324,10 +324,10 @@ AppCore::StartResult AppCore::loadCounts() {
|
||||
|
||||
AppCore::StartResult AppCore::startList(ListMode mode) {
|
||||
if (!hasAvailableProvider()) {
|
||||
return refused(QStringLiteral("Aucun gestionnaire de paquets disponible sur ce système."));
|
||||
return refused(tr("Aucun gestionnaire de paquets disponible sur ce système."));
|
||||
}
|
||||
if (m_busy) {
|
||||
return refused(QStringLiteral("Une opération est en cours, chargement impossible."));
|
||||
return refused(tr("Une opération est en cours, chargement impossible."));
|
||||
}
|
||||
if (m_list) {
|
||||
m_queuedLists.append(mode);
|
||||
@@ -337,13 +337,13 @@ AppCore::StartResult AppCore::startList(ListMode mode) {
|
||||
QString listLabel;
|
||||
switch (mode) {
|
||||
case ListMode::Installed:
|
||||
listLabel = QStringLiteral("Chargement des paquets installés...");
|
||||
listLabel = tr("Chargement des paquets installés...");
|
||||
break;
|
||||
case ListMode::Updates:
|
||||
listLabel = QStringLiteral("Recherche des mises à jour...");
|
||||
listLabel = tr("Recherche des mises à jour...");
|
||||
break;
|
||||
case ListMode::Cleanup:
|
||||
listLabel = QStringLiteral("Analyse des paquets inutilisés et legacy...");
|
||||
listLabel = tr("Analyse des paquets inutilisés et legacy...");
|
||||
break;
|
||||
}
|
||||
LogManager::instance().logEvent(QStringLiteral("liste"), listLabel);
|
||||
@@ -362,11 +362,11 @@ AppCore::StartResult AppCore::startList(ListMode mode) {
|
||||
QString done;
|
||||
if (mode == ListMode::Installed) {
|
||||
m_installedPackages = results;
|
||||
done = QStringLiteral("%1 paquet(s) installé(s)")
|
||||
done = tr("%1 paquet(s) installé(s)")
|
||||
.arg(results.size());
|
||||
} else if (mode == ListMode::Updates) {
|
||||
m_updatePackages = results;
|
||||
done = QStringLiteral("%1 mise(s) à jour disponible(s)")
|
||||
done = tr("%1 mise(s) à jour disponible(s)")
|
||||
.arg(results.size());
|
||||
} else {
|
||||
m_cleanupCandidates = results;
|
||||
@@ -374,7 +374,7 @@ AppCore::StartResult AppCore::startList(ListMode mode) {
|
||||
for (const auto& pkg : results) {
|
||||
if (pkg.orphan) ++orphans;
|
||||
}
|
||||
done = QStringLiteral("%1 orphelin(s) et %2 paquet(s) legacy "
|
||||
done = tr("%1 orphelin(s) et %2 paquet(s) legacy "
|
||||
"détecté(s)")
|
||||
.arg(orphans)
|
||||
.arg(static_cast<int>(results.size()) - orphans);
|
||||
@@ -404,25 +404,25 @@ AppCore::StartResult AppCore::startList(ListMode mode) {
|
||||
|
||||
AppCore::StartResult AppCore::search(const QString& query) {
|
||||
if (m_busy) {
|
||||
return refused(QStringLiteral("Une opération est en cours, recherche impossible."));
|
||||
return refused(tr("Une opération est en cours, recherche impossible."));
|
||||
}
|
||||
if (m_search) return refused(QStringLiteral("Une recherche est déjà en cours."));
|
||||
if (m_search) return refused(tr("Une recherche est déjà en cours."));
|
||||
return startSearch(query);
|
||||
}
|
||||
|
||||
AppCore::StartResult AppCore::startSearch(const QString& query) {
|
||||
if (query.trimmed().isEmpty()) {
|
||||
return refused(QStringLiteral("Entrez un terme de recherche."));
|
||||
return refused(tr("Entrez un terme de recherche."));
|
||||
}
|
||||
auto providers = availableProviders();
|
||||
if (providers.empty()) {
|
||||
return refused(QStringLiteral("Aucun gestionnaire de paquets disponible sur ce système."));
|
||||
return refused(tr("Aucun gestionnaire de paquets disponible sur ce système."));
|
||||
}
|
||||
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("recherche"),
|
||||
QStringLiteral("\"%1\" via %2").arg(query.trimmed(), providerLabel(providers)));
|
||||
emit statusMessage(QStringLiteral("Recherche en cours..."));
|
||||
tr("\"%1\" via %2").arg(query.trimmed(), providerLabel(providers)));
|
||||
emit statusMessage(tr("Recherche en cours..."));
|
||||
|
||||
auto* worker = new SearchWorker(providers, query.trimmed().toStdString());
|
||||
m_search = worker;
|
||||
@@ -431,7 +431,7 @@ AppCore::StartResult AppCore::startSearch(const QString& query) {
|
||||
connect(worker, &SearchWorker::finished, this,
|
||||
[this](std::vector<PackageInfo> results) {
|
||||
m_search = nullptr;
|
||||
const QString done = QStringLiteral("%1 paquet(s) trouvé(s)")
|
||||
const QString done = tr("%1 paquet(s) trouvé(s)")
|
||||
.arg(results.size());
|
||||
LogManager::instance().logEvent(QStringLiteral("recherche"), done);
|
||||
emit statusMessage(done);
|
||||
@@ -544,15 +544,15 @@ AppCore::StartResult AppCore::installPluginTool(const std::string& pluginId) {
|
||||
}
|
||||
|
||||
AppCore::StartResult AppCore::releaseDatabaseLock() {
|
||||
if (m_busy) return refused(QStringLiteral("Une opération est déjà en cours, patientez..."));
|
||||
if (!m_pacman) return refused(QStringLiteral("pacman est indisponible sur ce système."));
|
||||
if (m_busy) return refused(tr("Une opération est déjà en cours, patientez..."));
|
||||
if (!m_pacman) return refused(tr("pacman est indisponible sur ce système."));
|
||||
|
||||
const PacmanManager::LockHolder holder = PacmanManager::detectLockHolder();
|
||||
const StartResult gate = credentialGate({m_pacman});
|
||||
if (!gate.started) return gate;
|
||||
|
||||
setBusy(true);
|
||||
emit statusMessage(QStringLiteral("Libération de la base de données pacman..."));
|
||||
emit statusMessage(tr("Libération de la base de données pacman..."));
|
||||
|
||||
LogManager::instance().beginCommand(
|
||||
QStringLiteral("pacman"), QStringLiteral("release-lock"),
|
||||
@@ -571,7 +571,7 @@ AppCore::StartResult AppCore::releaseDatabaseLock() {
|
||||
return;
|
||||
}
|
||||
if (!released) {
|
||||
emit statusMessage(QStringLiteral("Base pacman toujours verrouillée"));
|
||||
emit statusMessage(tr("Base pacman toujours verrouillée"));
|
||||
// The core is only asked to free the lock when it is actually held:
|
||||
// releasing is one, single, resume of the pending request.
|
||||
// Reported as a plain failure (not as another lock): the view
|
||||
@@ -585,7 +585,7 @@ AppCore::StartResult AppCore::releaseDatabaseLock() {
|
||||
return;
|
||||
}
|
||||
LogManager::instance().endCommand(true);
|
||||
emit statusMessage(QStringLiteral("Base libérée, reprise de l'opération..."));
|
||||
emit statusMessage(tr("Base libérée, reprise de l'opération..."));
|
||||
// Deferred so the status message paints before the replayed action
|
||||
// starts streaming its own progress.
|
||||
QTimer::singleShot(0, this, [this] { retryPendingRequest(); });
|
||||
@@ -597,7 +597,7 @@ AppCore::StartResult AppCore::releaseDatabaseLock() {
|
||||
}
|
||||
|
||||
AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
if (m_busy) return refused(QStringLiteral("Une opération est déjà en cours, patientez..."));
|
||||
if (m_busy) return refused(tr("Une opération est déjà en cours, patientez..."));
|
||||
|
||||
const QString action = request.action;
|
||||
std::vector<IPackageManager*> providers;
|
||||
@@ -609,21 +609,21 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
|| action == QLatin1String("update")) {
|
||||
IPackageManager* provider = providerFor(QString::fromStdString(request.package.provider));
|
||||
if (!provider) {
|
||||
return refused(QStringLiteral("Aucun gestionnaire de paquets disponible."));
|
||||
return refused(tr("Aucun gestionnaire de paquets disponible."));
|
||||
}
|
||||
if (request.package.name.empty()) {
|
||||
return refused(QStringLiteral("Nom de paquet manquant."));
|
||||
return refused(tr("Nom de paquet manquant."));
|
||||
}
|
||||
if (action == QLatin1String("install") && !provider->canInstall()) {
|
||||
return refused(QStringLiteral("%1 ne sait pas installer de paquets.")
|
||||
return refused(tr("%1 ne sait pas installer de paquets.")
|
||||
.arg(QString::fromStdString(provider->getName())));
|
||||
}
|
||||
if (action == QLatin1String("remove") && !provider->canRemove()) {
|
||||
return refused(QStringLiteral("%1 ne sait pas supprimer de paquets.")
|
||||
return refused(tr("%1 ne sait pas supprimer de paquets.")
|
||||
.arg(QString::fromStdString(provider->getName())));
|
||||
}
|
||||
if (action == QLatin1String("update") && !provider->canUpdate()) {
|
||||
return refused(QStringLiteral("%1 ne sait pas mettre à jour de paquets.")
|
||||
return refused(tr("%1 ne sait pas mettre à jour de paquets.")
|
||||
.arg(QString::fromStdString(provider->getName())));
|
||||
}
|
||||
|
||||
@@ -645,11 +645,11 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
}
|
||||
op = InstallWorker::Op::CleanCache;
|
||||
if (providers.empty()) {
|
||||
return refused(QStringLiteral("Aucun cache à nettoyer sur ce système."));
|
||||
return refused(tr("Aucun cache à nettoyer sur ce système."));
|
||||
}
|
||||
} else if (action == QLatin1String("install-file")) {
|
||||
if (request.path.isEmpty()) {
|
||||
return refused(QStringLiteral("Aucun fichier à installer."));
|
||||
return refused(tr("Aucun fichier à installer."));
|
||||
}
|
||||
// The provider owns the file formats it knows, so the routing is the
|
||||
// same kind of lookup as providerFor() is for package names.
|
||||
@@ -659,8 +659,7 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
break;
|
||||
}
|
||||
if (providers.empty()) {
|
||||
return refused(QStringLiteral(
|
||||
"Aucun gestionnaire de paquets ne sait installer ce fichier."));
|
||||
return refused(tr("Aucun gestionnaire de paquets ne sait installer ce fichier."));
|
||||
}
|
||||
op = InstallWorker::Op::InstallFile;
|
||||
// The package name is unknown until flatpak resolves the file: the file
|
||||
@@ -686,7 +685,7 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
}
|
||||
}
|
||||
if (m_pendingRemovals.empty()) {
|
||||
return refused(QStringLiteral("Aucun paquet sélectionné n'est supprimable."));
|
||||
return refused(tr("Aucun paquet sélectionné n'est supprimable."));
|
||||
}
|
||||
m_cleanupRemovalDescription = request.description;
|
||||
// The gate has to see who the groups belong to: a bulk removal of pacman
|
||||
@@ -697,7 +696,7 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
bulk = true;
|
||||
} else if (action == QLatin1String("install-plugin-tool")) {
|
||||
if (!m_pacman || !m_pacman->isAvailable()) {
|
||||
return refused(QStringLiteral("pacman est requis pour installer l'outil."));
|
||||
return refused(tr("pacman est requis pour installer l'outil."));
|
||||
}
|
||||
std::string hint;
|
||||
for (const auto& entry : m_plugins->plugins()) {
|
||||
@@ -707,17 +706,17 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
}
|
||||
}
|
||||
if (hint.empty()) {
|
||||
return refused(QStringLiteral("Aucun paquet système connu pour ce plugin."));
|
||||
return refused(tr("Aucun paquet système connu pour ce plugin."));
|
||||
}
|
||||
providers = {m_pacman};
|
||||
op = InstallWorker::Op::Install;
|
||||
label = QString::fromStdString(hint);
|
||||
} else {
|
||||
return refused(QStringLiteral("Action inconnue : %1").arg(action));
|
||||
return refused(tr("Action inconnue : %1").arg(action));
|
||||
}
|
||||
|
||||
if (providers.empty()) {
|
||||
return refused(QStringLiteral("Aucun gestionnaire de paquets disponible."));
|
||||
return refused(tr("Aucun gestionnaire de paquets disponible."));
|
||||
}
|
||||
|
||||
// Kept before the credential check: a request refused for a missing
|
||||
@@ -767,30 +766,30 @@ AppCore::StartResult AppCore::startRequest(Request request) {
|
||||
|
||||
QString AppCore::startMessage(const QString& action, const QString& label) const {
|
||||
if (action == QLatin1String("install")) {
|
||||
return QStringLiteral("Installation de %1...").arg(label);
|
||||
return tr("Installation de %1...").arg(label);
|
||||
}
|
||||
if (action == QLatin1String("remove")) {
|
||||
return QStringLiteral("Suppression de %1...").arg(label);
|
||||
return tr("Suppression de %1...").arg(label);
|
||||
}
|
||||
if (action == QLatin1String("update")) {
|
||||
return QStringLiteral("Mise à jour de %1...").arg(label);
|
||||
return tr("Mise à jour de %1...").arg(label);
|
||||
}
|
||||
if (action == QLatin1String("update-all")) {
|
||||
return QStringLiteral("Mise à jour de tous les paquets...");
|
||||
return tr("Mise à jour de tous les paquets...");
|
||||
}
|
||||
if (action == QLatin1String("refresh")) {
|
||||
return QStringLiteral("Rafraîchissement des sources...");
|
||||
return tr("Rafraîchissement des sources...");
|
||||
}
|
||||
if (action == QLatin1String("clean-caches")) {
|
||||
return QStringLiteral("Nettoyage des caches...");
|
||||
return tr("Nettoyage des caches...");
|
||||
}
|
||||
if (action == QLatin1String("install-file")) {
|
||||
return QStringLiteral("Installation depuis un fichier : %1...").arg(label);
|
||||
return tr("Installation depuis un fichier : %1...").arg(label);
|
||||
}
|
||||
if (action == QLatin1String("install-plugin-tool")) {
|
||||
return QStringLiteral("Installation de l'outil %1...").arg(label);
|
||||
return tr("Installation de l'outil %1...").arg(label);
|
||||
}
|
||||
return QStringLiteral("Opération en cours...");
|
||||
return tr("Opération en cours...");
|
||||
}
|
||||
|
||||
AppCore::StartResult AppCore::startAction(InstallWorker* worker, const Request& request,
|
||||
@@ -845,7 +844,7 @@ void AppCore::finishAction(const Request& request,
|
||||
|
||||
QString error = firstError(providers);
|
||||
if (!success && error.isEmpty()) {
|
||||
error = QStringLiteral("L'opération a échoué.");
|
||||
error = tr("L'opération a échoué.");
|
||||
}
|
||||
const bool locked = !success
|
||||
&& ((m_pacman && m_pacman->lastErrorWasLock())
|
||||
@@ -890,58 +889,58 @@ void AppCore::finishAction(const Request& request,
|
||||
|
||||
QString AppCore::successMessage(const QString& action, const QString& name) const {
|
||||
if (action == QLatin1String("install")) {
|
||||
return QStringLiteral("%1 installé avec succès").arg(name);
|
||||
return tr("%1 installé avec succès").arg(name);
|
||||
}
|
||||
if (action == QLatin1String("remove")) {
|
||||
return QStringLiteral("%1 supprimé avec succès").arg(name);
|
||||
return tr("%1 supprimé avec succès").arg(name);
|
||||
}
|
||||
if (action == QLatin1String("update")) {
|
||||
return QStringLiteral("Mise à jour terminée");
|
||||
return tr("Mise à jour terminée");
|
||||
}
|
||||
if (action == QLatin1String("update-all")) {
|
||||
return QStringLiteral("Tous les paquets sont à jour");
|
||||
return tr("Tous les paquets sont à jour");
|
||||
}
|
||||
if (action == QLatin1String("refresh")) {
|
||||
return QStringLiteral("Sources rafraîchies");
|
||||
return tr("Sources rafraîchies");
|
||||
}
|
||||
if (action == QLatin1String("clean-caches")) {
|
||||
return QStringLiteral("Caches nettoyés");
|
||||
return tr("Caches nettoyés");
|
||||
}
|
||||
if (action == QLatin1String("install-file")) {
|
||||
return QStringLiteral("%1 installé avec succès").arg(name);
|
||||
return tr("%1 installé avec succès").arg(name);
|
||||
}
|
||||
if (action == QLatin1String("install-plugin-tool")) {
|
||||
return QStringLiteral("Outil installé, plugin disponible.");
|
||||
return tr("Outil installé, plugin disponible.");
|
||||
}
|
||||
return QStringLiteral("Opération terminée");
|
||||
return tr("Opération terminée");
|
||||
}
|
||||
|
||||
QString AppCore::failureMessage(const QString& action, const QString& name) const {
|
||||
if (action == QLatin1String("install")) {
|
||||
return QStringLiteral("Échec de l'installation de %1").arg(name);
|
||||
return tr("Échec de l'installation de %1").arg(name);
|
||||
}
|
||||
if (action == QLatin1String("remove")) {
|
||||
return QStringLiteral("Échec de la suppression de %1").arg(name);
|
||||
return tr("Échec de la suppression de %1").arg(name);
|
||||
}
|
||||
if (action == QLatin1String("update")) {
|
||||
return QStringLiteral("Échec de la mise à jour");
|
||||
return tr("Échec de la mise à jour");
|
||||
}
|
||||
if (action == QLatin1String("update-all")) {
|
||||
return QStringLiteral("Erreur lors de la mise à jour globale");
|
||||
return tr("Erreur lors de la mise à jour globale");
|
||||
}
|
||||
if (action == QLatin1String("refresh")) {
|
||||
return QStringLiteral("Erreur lors du rafraîchissement");
|
||||
return tr("Erreur lors du rafraîchissement");
|
||||
}
|
||||
if (action == QLatin1String("clean-caches")) {
|
||||
return QStringLiteral("Échec du nettoyage des caches");
|
||||
return tr("Échec du nettoyage des caches");
|
||||
}
|
||||
if (action == QLatin1String("install-file")) {
|
||||
return QStringLiteral("Échec de l'installation de %1").arg(name);
|
||||
return tr("Échec de l'installation de %1").arg(name);
|
||||
}
|
||||
if (action == QLatin1String("install-plugin-tool")) {
|
||||
return QStringLiteral("Échec de l'installation de l'outil.");
|
||||
return tr("Échec de l'installation de l'outil.");
|
||||
}
|
||||
return QStringLiteral("Échec de l'opération");
|
||||
return tr("Échec de l'opération");
|
||||
}
|
||||
|
||||
void AppCore::recordHistory(const QString& action, const QString& name,
|
||||
@@ -981,7 +980,7 @@ void AppCore::startNextRemovalGroup() {
|
||||
IPackageManager* provider = job.first;
|
||||
const std::vector<std::string> packages = job.second;
|
||||
|
||||
const QString groupLabel = QStringLiteral("Suppression de %1 paquet(s) via %2...")
|
||||
const QString groupLabel = tr("Suppression de %1 paquet(s) via %2...")
|
||||
.arg(packages.size())
|
||||
.arg(QString::fromStdString(provider->getName()));
|
||||
LogManager::instance().appendOutput(groupLabel);
|
||||
@@ -1032,13 +1031,13 @@ void AppCore::startNextRemovalGroup() {
|
||||
const bool locked = (m_pacman && m_pacman->lastErrorWasLock())
|
||||
|| PacmanManager::dbLocked(provider->lastError());
|
||||
LogManager::instance().endCommand(false, error);
|
||||
emit statusMessage(QStringLiteral("Échec du nettoyage"));
|
||||
emit statusMessage(tr("Échec du nettoyage"));
|
||||
emit actionFinished(QStringLiteral("cleanup"), m_cleanupRemovalDescription,
|
||||
false, error, locked);
|
||||
return;
|
||||
}
|
||||
|
||||
emit actionProgress(QStringLiteral("%1 paquet(s) supprimé(s)")
|
||||
emit actionProgress(tr("%1 paquet(s) supprimé(s)")
|
||||
.arg(packages.size()), -1);
|
||||
startNextRemovalGroup();
|
||||
});
|
||||
@@ -1047,7 +1046,7 @@ void AppCore::startNextRemovalGroup() {
|
||||
}
|
||||
|
||||
AppCore::StartResult AppCore::retryPendingRequest() {
|
||||
if (!m_pending) return refused(QStringLiteral("Aucune opération en attente."));
|
||||
if (!m_pending) return refused(tr("Aucune opération en attente."));
|
||||
|
||||
const Request request = *m_pending;
|
||||
m_pending.reset();
|
||||
@@ -1081,42 +1080,42 @@ void AppCore::setPluginEnabled(const std::string& pluginId, bool enabled) {
|
||||
|
||||
void AppCore::reloadPlugins() {
|
||||
LogManager::instance().logEvent(QStringLiteral("plugin"),
|
||||
QStringLiteral("registre rechargé"));
|
||||
tr("registre rechargé"));
|
||||
m_plugins->reload();
|
||||
refreshProviderCache();
|
||||
emit pluginsChanged();
|
||||
emit statusMessage(QStringLiteral("Plugins rechargés."));
|
||||
emit statusMessage(tr("Plugins rechargés."));
|
||||
}
|
||||
|
||||
void AppCore::installPluginPackage(const QString& path) {
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("plugin"),
|
||||
QStringLiteral("installation du paquet : %1").arg(QFileInfo(path).fileName()));
|
||||
tr("installation du paquet : %1").arg(QFileInfo(path).fileName()));
|
||||
emit statusMessage(
|
||||
QStringLiteral("Installation du paquet %1...").arg(QFileInfo(path).fileName()));
|
||||
tr("Installation du paquet %1...").arg(QFileInfo(path).fileName()));
|
||||
m_packages->install(path);
|
||||
}
|
||||
|
||||
void AppCore::removePluginPackage(const QString& id) {
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("plugin"),
|
||||
QStringLiteral("suppression du paquet : %1").arg(id));
|
||||
tr("suppression du paquet : %1").arg(id));
|
||||
m_packages->remove(id);
|
||||
}
|
||||
|
||||
void AppCore::clearHistory() {
|
||||
LogManager::instance().logEvent(QStringLiteral("historique"),
|
||||
QStringLiteral("effacé"));
|
||||
tr("effacé"));
|
||||
m_history->clear();
|
||||
emit historyChanged();
|
||||
emit statusMessage(QStringLiteral("Historique effacé"));
|
||||
emit statusMessage(tr("Historique effacé"));
|
||||
}
|
||||
|
||||
QString AppCore::readPackageLog(QString* error) const {
|
||||
QFile logFile(QString::fromUtf8(kPacmanLogPath));
|
||||
if (!logFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
if (error) {
|
||||
*error = QStringLiteral("Impossible d'ouvrir %1.\n"
|
||||
*error = tr("Impossible d'ouvrir %1.\n"
|
||||
"Vérifiez que le fichier existe et que vous avez les "
|
||||
"droits de lecture.")
|
||||
.arg(QString::fromUtf8(kPacmanLogPath));
|
||||
@@ -1146,8 +1145,8 @@ QString AppCore::packageDetails(const PackageInfo& pkg) {
|
||||
if (cached != m_detailsCache.constEnd()) return cached.value();
|
||||
|
||||
LogManager::instance().logEvent(
|
||||
QStringLiteral("détails"),
|
||||
QStringLiteral("interrogation de %1 (%2)")
|
||||
tr("détails"),
|
||||
tr("interrogation de %1 (%2)")
|
||||
.arg(QString::fromStdString(pkg.name),
|
||||
QString::fromStdString(pkg.provider)));
|
||||
|
||||
@@ -1160,24 +1159,24 @@ QString AppCore::packageDetails(const PackageInfo& pkg) {
|
||||
}
|
||||
|
||||
std::string text;
|
||||
auto addRow = [&text](const char* label, const std::string& value) {
|
||||
auto addRow = [&text](const QString& label, const std::string& value) {
|
||||
if (value.empty() || value == "None" || value == "--") return;
|
||||
if (!text.empty()) text += "\n";
|
||||
text += std::string(label) + " : " + value;
|
||||
text += label.toStdString() + " : " + value;
|
||||
};
|
||||
if (!installed.empty()) {
|
||||
addRow("Taille installée", infoField(installed, "Installed Size"));
|
||||
addRow("Date d'installation", infoField(installed, "Install Date"));
|
||||
addRow("Dépend de", infoField(installed, "Depends On"));
|
||||
addRow("Requis par", infoField(installed, "Required By"));
|
||||
addRow(tr("Taille installée"), infoField(installed, "Installed Size"));
|
||||
addRow(tr("Date d'installation"), infoField(installed, "Install Date"));
|
||||
addRow(tr("Dépend de"), infoField(installed, "Depends On"));
|
||||
addRow(tr("Requis par"), infoField(installed, "Required By"));
|
||||
} else {
|
||||
// Only the sync database is queried when the package is not installed
|
||||
// here, halving the subprocess count on the Installed/Updates pages.
|
||||
const std::string sync = runCommand(querySync + pkg.name + " 2>/dev/null");
|
||||
if (!sync.empty()) {
|
||||
addRow("Taille du téléchargement", infoField(sync, "Download Size"));
|
||||
addRow("Taille installée", infoField(sync, "Installed Size"));
|
||||
addRow("Dépend de", infoField(sync, "Depends On"));
|
||||
addRow(tr("Taille du téléchargement"), infoField(sync, "Download Size"));
|
||||
addRow(tr("Taille installée"), infoField(sync, "Installed Size"));
|
||||
addRow(tr("Dépend de"), infoField(sync, "Depends On"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1208,8 +1207,7 @@ QString AppCore::appUpdateCheckRefusal() const {
|
||||
QDateTime::currentDateTime());
|
||||
}
|
||||
if (!preferences.autoUpdateCheckEnabled()) {
|
||||
return QStringLiteral(
|
||||
"La vérification automatique des mises à jour est désactivée dans "
|
||||
return tr("La vérification automatique des mises à jour est désactivée dans "
|
||||
"les paramètres.");
|
||||
}
|
||||
return QString();
|
||||
@@ -1224,8 +1222,8 @@ void AppCore::checkForAppUpdate() {
|
||||
}
|
||||
|
||||
LogManager::instance().logEvent(QStringLiteral("maj-app"),
|
||||
QStringLiteral("vérification de version"));
|
||||
emit statusMessage(QStringLiteral("Vérification des mises à jour..."));
|
||||
tr("vérification de version"));
|
||||
emit statusMessage(tr("Vérification des mises à jour..."));
|
||||
m_update->checkForUpdates();
|
||||
}
|
||||
|
||||
@@ -1256,13 +1254,13 @@ bool AppCore::binDirWritable() const {
|
||||
bool AppCore::applySelfUpdate(const QString& sudoPassword, QString* error) {
|
||||
if (!m_update->canSelfUpdate()) {
|
||||
if (error) {
|
||||
*error = QStringLiteral("Aucune mise à jour ne peut être appliquée localement.");
|
||||
*error = tr("Aucune mise à jour ne peut être appliquée localement.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (error) error->clear();
|
||||
LogManager::instance().logEvent(QStringLiteral("maj-app"),
|
||||
QStringLiteral("mise à jour appliquée"));
|
||||
tr("mise à jour appliquée"));
|
||||
m_update->performSelfUpdate(sudoPassword);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user