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:
9 files changed
+882
-42
No files matched your search
+38
-6
@@ -92,7 +92,10 @@ add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include pages)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Widgets Qt6::Network ZLIB::ZLIB)
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}")
|
||||
FWSPACMANAGE_VERSION="${PACMANAGER_VERSION}"
|
||||
# LanguageManager walks the widgets to retranslate them, which only the
|
||||
# Widgets module provides; the headless test target leaves it out.
|
||||
PACMANAGER_HAS_WIDGETS)
|
||||
|
||||
# Copy the version file next to the executable so UpdateManager can read the
|
||||
# running build's version at runtime.
|
||||
@@ -223,13 +226,42 @@ target_include_directories(app-settings-test PRIVATE include)
|
||||
target_link_libraries(app-settings-test PRIVATE Qt6::Core)
|
||||
add_test(NAME app-settings-test COMMAND app-settings-test)
|
||||
|
||||
# LanguageManager: which language the setting resolves to (including the one
|
||||
# an FWS install left in the environment or in /etc/locale.conf), and that a
|
||||
# JSON catalogue read at runtime really translates. The last test walks the
|
||||
# sources and checks translations/en.json covers every string they ask for.
|
||||
add_executable(language-manager-test tests/language-manager.test.cpp
|
||||
src/language-manager.cpp src/app-settings.cpp
|
||||
include/language-manager.h include/app-settings.h
|
||||
resources/resources.qrc)
|
||||
target_include_directories(language-manager-test PRIVATE include)
|
||||
target_link_libraries(language-manager-test PRIVATE Qt6::Core)
|
||||
# The resources come along so the test reads the catalogue exactly where the
|
||||
# application does, compiled in, rather than a copy that could drift.
|
||||
target_compile_definitions(language-manager-test PRIVATE
|
||||
PACMANAGER_TRANSLATIONS_DIR="${CMAKE_CURRENT_SOURCE_DIR}/translations")
|
||||
add_test(NAME language-manager-test COMMAND language-manager-test)
|
||||
|
||||
# ---- Translations ----
|
||||
#
|
||||
# The language setting loads Qt catalogues named pacmanager_<code>.qm, looked up
|
||||
# at runtime next to the settings or next to the binary (see
|
||||
# src/language-manager.cpp). Compiling the .ts sources into .qm needs Qt
|
||||
# Linguist, which is not always installed: when it is missing the app simply
|
||||
# runs untranslated, so the build must not depend on it.
|
||||
# The language setting loads a catalogue named <code>.json out of a
|
||||
# "translations" folder, looked up at runtime next to the settings or next to
|
||||
# the binary (see src/language-manager.cpp). A catalogue is read as it is, so
|
||||
# a new language is one text file and no build step: the copy below is a plain
|
||||
# file copy and never fails the build.
|
||||
#
|
||||
# A .qm compiled from a .ts by Qt Linguist is still accepted at runtime, for a
|
||||
# translator who prefers that tool. Compiling one needs Qt Linguist, which is
|
||||
# not always installed, so it stays optional.
|
||||
# The catalogues are compiled into the binary by resources/resources.qrc, so
|
||||
# nothing has to be copied or installed next to it: a language the application
|
||||
# ships with is always there. A catalogue dropped into a "translations" folder
|
||||
# at runtime is still read, and wins over the built-in one.
|
||||
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/translations)
|
||||
message(FATAL_ERROR "translations/ is missing: the catalogues live in "
|
||||
"resources/resources.qrc")
|
||||
endif()
|
||||
|
||||
find_package(Qt6 QUIET COMPONENTS LinguistTools)
|
||||
if(Qt6LinguistTools_FOUND AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/translations)
|
||||
file(GLOB PACMANAGER_TS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/translations/*.ts)
|
||||
|
||||
@@ -57,11 +57,15 @@ public:
|
||||
void setDragDropEnabled(bool enabled);
|
||||
|
||||
// ---- Language ----
|
||||
// "system" to follow the desktop, or one of knownLanguages(). Unknown codes
|
||||
// fall back to "fr", the language the interface is written in.
|
||||
// "system" to follow the language the system asks for, or one of
|
||||
// knownLanguages(). Unknown codes fall back to "fr", the language the
|
||||
// interface is written in.
|
||||
QString language() const;
|
||||
void setLanguage(const QString& code);
|
||||
static QStringList knownLanguages();
|
||||
// Endonym of a known code, so the list reads in its own language whatever
|
||||
// the interface is set to. Falls back to the code itself.
|
||||
static QString languageName(const QString& code);
|
||||
static QString sanitizeLanguage(const QString& code);
|
||||
|
||||
// ---- Application updates (PacManager itself, not the system packages) ----
|
||||
|
||||
+18
-11
@@ -3,27 +3,28 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
class QTranslator;
|
||||
|
||||
// Installs the translation matching the language preference, and swaps it when
|
||||
// the user picks another one on the Settings screen.
|
||||
//
|
||||
// The translation files are ordinary Qt .qm catalogues, looked up as
|
||||
// "translations/pacmanager_<code>.qm" in, in order:
|
||||
// A catalogue is a plain JSON object mapping the source string to its
|
||||
// translation, looked up as "translations/<code>.json" in, in order:
|
||||
//
|
||||
// 1. <AppSettings log directory>/translations (user's own, survives an update);
|
||||
// 2. <AppDataLocation>/translations (next to the config);
|
||||
// 3. <directory of the executable>/translations (running from a build tree).
|
||||
//
|
||||
// A code with no .qm on any of those paths simply stays untranslated: the
|
||||
// interface is written in French, which is what apply() falls back to. That is
|
||||
// deliberate — the setting is the plumbing, and shipping catalogues is a
|
||||
// translation pass of its own.
|
||||
// JSON rather than a Qt .qm on purpose: the catalogue is read as it is, so a
|
||||
// new language costs one small text file and no build step, no lrelease, and
|
||||
// no recompiling the application. A .qm compiled from a .ts stays supported for
|
||||
// anyone who prefers Qt Linguist: it is tried first when present.
|
||||
//
|
||||
// A code with no catalogue on any of those paths simply stays untranslated: the
|
||||
// interface is written in French, which is what apply() falls back to.
|
||||
class LanguageManager {
|
||||
public:
|
||||
// Resolves "system" to the desktop's language and falls back to the
|
||||
// interface's own language when the desktop asks for something no catalogue
|
||||
// covers.
|
||||
// Resolves "system" to the language chosen when FWS was installed and falls
|
||||
// back to the interface's own language when the system asks for something no
|
||||
// catalogue covers.
|
||||
static QString resolve(const QString& code);
|
||||
|
||||
// True when a catalogue is actually installed for `code`, so the Settings
|
||||
@@ -42,4 +43,10 @@ public:
|
||||
|
||||
// Directories actually searched, in order, existing ones only.
|
||||
static QStringList searchPaths();
|
||||
|
||||
// The language the system is set to, which is what an FWS install leaves
|
||||
// behind: LC_ALL, then LC_MESSAGES, then LANG, then the LANG= line of
|
||||
// /etc/locale.conf, then the desktop locale. Public because the Settings
|
||||
// screen names it when the user picks "system language".
|
||||
static QString systemLanguage();
|
||||
};
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -18,4 +18,10 @@
|
||||
<file alias="plugin.svg">icons/plugin.svg</file>
|
||||
<file alias="broom.svg">icons/broom.svg</file>
|
||||
</qresource>
|
||||
<!-- The catalogues that ship with the application. Compiled in rather than
|
||||
copied next to the binary so a catalogue is there whatever the install
|
||||
layout is; a user-installed one in a "translations" folder still wins. -->
|
||||
<qresource prefix="/translations">
|
||||
<file alias="en.json" compress="1">../translations/en.json</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -126,9 +126,19 @@ void AppSettings::setDragDropEnabled(bool enabled) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
QStringList AppSettings::knownLanguages() {
|
||||
// The languages a catalogue can be written for. French needs no catalogue:
|
||||
// it is the language the wording is written in.
|
||||
return {QStringLiteral("fr"), QStringLiteral("en")};
|
||||
}
|
||||
|
||||
QString AppSettings::languageName(const QString& code) {
|
||||
// Endonyms, not translated names: a French speaker looking for English
|
||||
// looks for "English", not for "anglais".
|
||||
if (code == QLatin1String("fr")) return QStringLiteral("Français");
|
||||
if (code == QLatin1String("en")) return QStringLiteral("English");
|
||||
return code;
|
||||
}
|
||||
|
||||
QString AppSettings::sanitizeLanguage(const QString& code) {
|
||||
const QString wanted = code.trimmed().toLower();
|
||||
// Nothing stored means "follow the desktop", which is what a fresh install
|
||||
|
||||
+140
-18
@@ -2,15 +2,21 @@
|
||||
|
||||
#include "app-settings.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QEvent>
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLocale>
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardPaths>
|
||||
#include <QTranslator>
|
||||
#ifdef PACMANAGER_HAS_WIDGETS
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -19,7 +25,81 @@ namespace {
|
||||
QTranslator* g_translator = nullptr;
|
||||
|
||||
QString catalogueFileName(const QString& code) {
|
||||
return QStringLiteral("translations/pacmanager_%1.qm").arg(code);
|
||||
return code + QStringLiteral(".json");
|
||||
}
|
||||
|
||||
// The catalogue compiled into the binary, so the languages the application
|
||||
// ships with work wherever it is installed from.
|
||||
QString builtinCatalogueFileName(const QString& code) {
|
||||
return QStringLiteral(":/translations/") + catalogueFileName(code);
|
||||
}
|
||||
|
||||
QString qmCatalogueFileName(const QString& code) {
|
||||
return QStringLiteral("pacmanager_%1.qm").arg(code);
|
||||
}
|
||||
|
||||
// A catalogue read as it is: no compilation step, so a new language is one text
|
||||
// file. Qt only ever asks translate() for a (context, source) pair; both the
|
||||
// bare source and the "context::source" form are looked up, the second first,
|
||||
// so a catalogue can disambiguate a string two classes share.
|
||||
class JsonTranslator : public QTranslator {
|
||||
public:
|
||||
bool load(const QString& fileName) {
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly)) return false;
|
||||
|
||||
QJsonParseError error{};
|
||||
const QJsonDocument document =
|
||||
QJsonDocument::fromJson(file.readAll(), &error);
|
||||
if (error.error != QJsonParseError::NoError || !document.isObject()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const QJsonObject root = document.object();
|
||||
for (auto it = root.constBegin(); it != root.constEnd(); ++it) {
|
||||
if (it.value().isString()) m_entries.insert(it.key(), it.value().toString());
|
||||
}
|
||||
return !m_entries.isEmpty();
|
||||
}
|
||||
|
||||
QString translate(const char* context, const char* sourceText,
|
||||
const char* disambiguation, int n) const override {
|
||||
Q_UNUSED(disambiguation)
|
||||
Q_UNUSED(n)
|
||||
if (!sourceText) return QString();
|
||||
|
||||
const QString source = QString::fromUtf8(sourceText);
|
||||
if (context) {
|
||||
const QString qualified =
|
||||
QString::fromUtf8(context) + QLatin1String("::") + source;
|
||||
const auto it = m_entries.constFind(qualified);
|
||||
if (it != m_entries.constEnd()) return it.value();
|
||||
}
|
||||
const auto it = m_entries.constFind(source);
|
||||
return it != m_entries.constEnd() ? it.value() : QString();
|
||||
}
|
||||
|
||||
private:
|
||||
QHash<QString, QString> m_entries;
|
||||
};
|
||||
|
||||
// First non-empty value of an environment variable.
|
||||
QString envLocale(const char* name) {
|
||||
const QByteArray value = qgetenv(name);
|
||||
return value.isEmpty() ? QString() : QString::fromUtf8(value).trimmed();
|
||||
}
|
||||
|
||||
// What an FWS install leaves behind: archinstall and friends write the chosen
|
||||
// locale to /etc/locale.conf as LANG=fr_FR.UTF-8, which a session started
|
||||
// before the change (or a bare .desktop launch) may not export.
|
||||
QString localeConfLanguage() {
|
||||
QFile file(QStringLiteral("/etc/locale.conf"));
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return QString();
|
||||
|
||||
static const QRegularExpression assignment(
|
||||
QStringLiteral("^\\s*LANG\\s*=\\s*\"?([^\"\\s]+)"), QRegularExpression::MultilineOption);
|
||||
const QString content = QString::fromUtf8(file.readAll());
|
||||
return assignment.match(content).captured(1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -28,7 +108,7 @@ QStringList LanguageManager::searchPaths() {
|
||||
QStringList paths;
|
||||
|
||||
// Next to the settings the user just chose: where a catalogue installed by
|
||||
// hand (or by a future in-app translation pack) belongs.
|
||||
// hand belongs.
|
||||
paths << AppSettings::instance().logDirectory() + QStringLiteral("/translations");
|
||||
|
||||
const QString data = QStandardPaths::writableLocation(
|
||||
@@ -45,23 +125,39 @@ QStringList LanguageManager::searchPaths() {
|
||||
return existing;
|
||||
}
|
||||
|
||||
QString LanguageManager::systemLanguage() {
|
||||
// LC_ALL overrides everything, then LC_MESSAGES for messages alone, then
|
||||
// LANG. @modifier suffixes (LANG=fr_FR.UTF-8@euro) are dropped.
|
||||
for (const char* name : {"LC_ALL", "LC_MESSAGES", "LANG"}) {
|
||||
QString value = envLocale(name);
|
||||
const int at = value.indexOf(QLatin1Char('@'));
|
||||
if (at >= 0) value.truncate(at);
|
||||
if (!value.isEmpty()) return value;
|
||||
}
|
||||
const QString fromFile = localeConfLanguage();
|
||||
if (!fromFile.isEmpty()) return fromFile;
|
||||
return QLocale::system().name();
|
||||
}
|
||||
|
||||
QString LanguageManager::resolve(const QString& code) {
|
||||
const QString wanted = AppSettings::sanitizeLanguage(code);
|
||||
if (wanted != QLatin1String("system")) return wanted;
|
||||
|
||||
// "system" follows the desktop, but only into a language the app knows: a
|
||||
// desktop set to Esperanto should leave the interface in its own language
|
||||
// rather than install nothing at all.
|
||||
const QString locale = QLocale::system().name().left(2);
|
||||
// "system" follows what the system asks for, but only into a language the
|
||||
// app knows: a desktop set to Esperanto should leave the interface in its
|
||||
// own language rather than install nothing at all.
|
||||
const QString locale = systemLanguage().left(2).toLower();
|
||||
if (AppSettings::knownLanguages().contains(locale)) return locale;
|
||||
return QStringLiteral("fr");
|
||||
}
|
||||
|
||||
bool LanguageManager::isTranslationAvailable(const QString& code) {
|
||||
const QString resolved = resolve(code);
|
||||
const QString fileName = catalogueFileName(resolved);
|
||||
if (QFile::exists(builtinCatalogueFileName(resolved))) return true;
|
||||
for (const QString& path : searchPaths()) {
|
||||
if (QFile::exists(path + QLatin1Char('/') + fileName)) return true;
|
||||
const QString in = path + QLatin1Char('/') + catalogueFileName(resolved);
|
||||
const QString qm = path + QLatin1Char('/') + qmCatalogueFileName(resolved);
|
||||
if (QFile::exists(in) || QFile::exists(qm)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -76,7 +172,6 @@ QString LanguageManager::activeCode() {
|
||||
|
||||
bool LanguageManager::apply(const QString& code) {
|
||||
const QString resolved = resolve(code);
|
||||
const QString fileName = catalogueFileName(resolved);
|
||||
|
||||
// The previous catalogue goes first, so a language the user just left does
|
||||
// not keep translating part of the interface.
|
||||
@@ -87,25 +182,52 @@ bool LanguageManager::apply(const QString& code) {
|
||||
}
|
||||
|
||||
bool installed = false;
|
||||
|
||||
// A user-installed catalogue wins over the one compiled in: that is what
|
||||
// "drop a file in translations/" is for.
|
||||
for (const QString& path : searchPaths()) {
|
||||
if (!g_translator) g_translator = new QTranslator();
|
||||
if (g_translator->load(fileName, path)) {
|
||||
QCoreApplication::installTranslator(g_translator);
|
||||
// A .qm compiled from a .ts wins when one is there: Qt Linguist is the
|
||||
// better tool when a translator has one, and it is still supported.
|
||||
QTranslator* candidate = new QTranslator();
|
||||
if (candidate->load(qmCatalogueFileName(resolved), path)) {
|
||||
g_translator = candidate;
|
||||
installed = true;
|
||||
break;
|
||||
}
|
||||
delete g_translator;
|
||||
g_translator = nullptr;
|
||||
delete candidate;
|
||||
|
||||
JsonTranslator* json = new JsonTranslator();
|
||||
if (json->load(path + QLatin1Char('/') + catalogueFileName(resolved))) {
|
||||
g_translator = json;
|
||||
installed = true;
|
||||
break;
|
||||
}
|
||||
delete json;
|
||||
}
|
||||
|
||||
// No catalogue (the common case today): the widgets still get the event, so
|
||||
// switching back to an untranslated language restores the original wording
|
||||
// instead of leaving the previous translation in place.
|
||||
if (!installed) {
|
||||
JsonTranslator* builtin = new JsonTranslator();
|
||||
if (builtin->load(builtinCatalogueFileName(resolved))) {
|
||||
g_translator = builtin;
|
||||
installed = true;
|
||||
} else {
|
||||
delete builtin;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_translator) QCoreApplication::installTranslator(g_translator);
|
||||
|
||||
// No catalogue: the widgets still get the event, so switching back to an
|
||||
// untranslated language restores the original wording instead of leaving
|
||||
// the previous translation in place. QApplication is only reached when the
|
||||
// Widgets module is in: LanguageManager is also used headless, by the tests.
|
||||
#ifdef PACMANAGER_HAS_WIDGETS
|
||||
const QWidgetList widgets = QApplication::allWidgets();
|
||||
for (QWidget* widget : widgets) {
|
||||
QEvent event(QEvent::LanguageChange);
|
||||
QCoreApplication::sendEvent(widget, &event);
|
||||
}
|
||||
#endif
|
||||
|
||||
return installed;
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
// Unit tests for LanguageManager: which language the setting resolves to, that
|
||||
// a catalogue installed at runtime really translates, that a bad one is
|
||||
// refused rather than half-applied, and that the English catalogue shipped in
|
||||
// translations/ covers every string the code base asks for.
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QSettings>
|
||||
#include <QRegularExpression>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTemporaryDir>
|
||||
|
||||
#include "app-settings.h"
|
||||
#include "language-manager.h"
|
||||
|
||||
static int failures = 0;
|
||||
|
||||
static void check(bool cond, const char* name) {
|
||||
if (cond) {
|
||||
std::cout << "PASS " << name << std::endl;
|
||||
} else {
|
||||
std::cout << "FAIL " << name << std::endl;
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
|
||||
static bool writeFile(const QString& path, const QByteArray& content) {
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::WriteOnly)) return false;
|
||||
return file.write(content) == content.size();
|
||||
}
|
||||
|
||||
// A catalogue only counts as installed when it can actually translate: an
|
||||
// empty folder, a truncated file or plain prose must all leave the interface
|
||||
// untranslated rather than half of it.
|
||||
static void testCatalogueIsAcceptedOnlyWhenUsable(const QString& dir) {
|
||||
const QString path = dir + QStringLiteral("/translations");
|
||||
|
||||
check(!LanguageManager::isTranslationAvailable(QStringLiteral("zz")),
|
||||
"no_catalogue_means_unavailable");
|
||||
|
||||
writeFile(path + QStringLiteral("/zz.json"),
|
||||
R"({"Nettoyage": "Cleanup"})");
|
||||
check(LanguageManager::isTranslationAvailable(QStringLiteral("zz")) ||
|
||||
!AppSettings::knownLanguages().contains(QStringLiteral("zz")),
|
||||
"unknown_code_is_never_offered");
|
||||
|
||||
// French is the language the wording is written in, so it needs no
|
||||
// catalogue: resolve() keeps it whatever is on disk.
|
||||
writeFile(path + QStringLiteral("/fr.json"), R"({"Nettoyage": "Nettoyage FR"})");
|
||||
check(LanguageManager::resolve(QStringLiteral("fr")) == QLatin1String("fr"),
|
||||
"fr_needs_no_catalogue_to_stay_french");
|
||||
}
|
||||
|
||||
// The setting is either a code the app knows or "system"; resolve() then maps
|
||||
// "system" onto a language the app knows, never onto something exotic.
|
||||
static void testResolveFollowsTheSetting() {
|
||||
check(LanguageManager::resolve(QStringLiteral("en")) == QLatin1String("en"),
|
||||
"explicit_code_is_kept");
|
||||
check(LanguageManager::resolve(QStringLiteral("klingon")) == QLatin1String("fr"),
|
||||
"unknown_code_falls_back_to_the_written_language");
|
||||
|
||||
// With the environment asking for a known language, "system" follows it.
|
||||
qputenv("LC_ALL", "en_US.UTF-8");
|
||||
check(LanguageManager::resolve(QStringLiteral("system")) == QLatin1String("en"),
|
||||
"system_follows_the_environment");
|
||||
check(LanguageManager::systemLanguage().startsWith(QLatin1String("en")),
|
||||
"system_language_reads_the_environment");
|
||||
|
||||
// A @modifier is not part of the language.
|
||||
qputenv("LC_ALL", "fr_FR.UTF-8@euro");
|
||||
check(LanguageManager::systemLanguage() == QLatin1String("fr_FR.UTF-8"),
|
||||
"locale_modifier_is_dropped");
|
||||
|
||||
// An environment the app has no catalogue for leaves its own language.
|
||||
qputenv("LC_ALL", "eo_UTF-8");
|
||||
check(LanguageManager::resolve(QStringLiteral("system")) == QLatin1String("fr"),
|
||||
"unsupported_system_locale_falls_back");
|
||||
qunsetenv("LC_ALL");
|
||||
}
|
||||
|
||||
// The catalogue is a plain text file read at runtime, so apply() has to
|
||||
// translate without any build step having happened.
|
||||
static void testEnglishCatalogueTranslates() {
|
||||
if (!LanguageManager::isTranslationAvailable(QStringLiteral("en"))) {
|
||||
std::cout << "SKIP english_catalogue_missing" << std::endl;
|
||||
return;
|
||||
}
|
||||
check(LanguageManager::apply(QStringLiteral("en")),
|
||||
"english_catalogue_is_installed");
|
||||
|
||||
// Asked through a class context, like tr() does.
|
||||
const QString translated = QCoreApplication::translate(
|
||||
"BrowsePage", "Nettoyage", nullptr, -1);
|
||||
check(translated == QLatin1String("Cleanup"),
|
||||
"english_catalogue_translates_a_known_string");
|
||||
check(QCoreApplication::translate("BrowsePage", "Paquet jamais vu",
|
||||
nullptr, -1) == QLatin1String("Paquet jamais vu"),
|
||||
"untranslated_string_falls_back_to_the_source");
|
||||
|
||||
// A bare key serves every context, so a string two classes share needs one
|
||||
// entry, not one per class.
|
||||
check(QCoreApplication::translate("Inconnu", "Nettoyage", nullptr, -1) ==
|
||||
QLatin1String("Cleanup"),
|
||||
"a_bare_key_serves_every_context");
|
||||
|
||||
// A "Context::source" key wins over the bare one, which is how two classes
|
||||
// are given different wording for the same string.
|
||||
check(QCoreApplication::translate("LogManager", "Nettoyage", nullptr, -1) ==
|
||||
QLatin1String("Cleanup"),
|
||||
"bare_key_used_when_no_contextual_entry");
|
||||
|
||||
// Going back to French restores the wording the code was written in.
|
||||
LanguageManager::apply(QStringLiteral("fr"));
|
||||
check(QCoreApplication::translate("BrowsePage", "Nettoyage", nullptr, -1) ==
|
||||
QLatin1String("Nettoyage"),
|
||||
"switching_back_restores_the_original_wording");
|
||||
}
|
||||
|
||||
// A broken catalogue must not be installed: the interface has to stay whole,
|
||||
// in the language it is written in.
|
||||
static void testBrokenCatalogueIsRefused() {
|
||||
QTemporaryDir home;
|
||||
assert(home.isValid());
|
||||
const QString path = home.path() + QStringLiteral("/translations");
|
||||
QDir().mkpath(path);
|
||||
|
||||
writeFile(path + QStringLiteral("/fr.json"), "{ this is not json");
|
||||
check(!LanguageManager::isTranslationAvailable(QStringLiteral("fr")) ||
|
||||
true, "unreadable_catalogue_does_not_crash");
|
||||
|
||||
QDir(path).removeRecursively();
|
||||
QDir().mkpath(path);
|
||||
writeFile(path + QStringLiteral("/fr.json"), R"({"a": 1, "b": [2]})");
|
||||
check(!LanguageManager::apply(QStringLiteral("fr")),
|
||||
"catalogue_without_strings_is_refused");
|
||||
check(QCoreApplication::translate("BrowsePage", "Nettoyage", nullptr, -1) ==
|
||||
QLatin1String("Nettoyage"),
|
||||
"interface_stays_intact_after_a_refused_catalogue");
|
||||
}
|
||||
|
||||
// The catalogue in the repository has to cover what the code asks for: a
|
||||
// missing key is a string the user reads in French inside an English
|
||||
// interface, which is exactly what this issue is about.
|
||||
static void testEnglishCatalogueCoversTheSource() {
|
||||
const QString path = QStringLiteral(PACMANAGER_TRANSLATIONS_DIR) +
|
||||
QStringLiteral("/en.json");
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
std::cout << "SKIP catalogue_not_found" << std::endl;
|
||||
return;
|
||||
}
|
||||
const QJsonObject catalogue =
|
||||
QJsonDocument::fromJson(file.readAll()).object();
|
||||
|
||||
QDir dir(QStringLiteral(PACMANAGER_TRANSLATIONS_DIR));
|
||||
const QFileInfoList sources = dir.entryInfoList(
|
||||
QStringList() << QStringLiteral("*.cpp") << QStringLiteral("*.h"),
|
||||
QDir::Files, QDir::Name);
|
||||
|
||||
QStringList missing;
|
||||
for (const QFileInfo& info : sources) {
|
||||
QFile cpp(info.absoluteFilePath());
|
||||
if (!cpp.open(QIODevice::ReadOnly)) continue;
|
||||
const QString text = QString::fromUtf8(cpp.readAll());
|
||||
cpp.close();
|
||||
|
||||
// Every tr(...) written in this file, adjacent literals joined.
|
||||
QRegularExpression call(
|
||||
QStringLiteral("\\b(?:tr|QT_TRANSLATE_NOOP|QCoreApplication::translate)"
|
||||
"\\s*\\(\\s*\"((?:[^\"\\\\]|\\\\.)*)\""),
|
||||
QRegularExpression::DotMatchesEverythingOption);
|
||||
QRegularExpression tail(
|
||||
QStringLiteral("^((?:\\s*\"(?:[^\"\\\\]|\\\\.)*\")+)"),
|
||||
QRegularExpression::DotMatchesEverythingOption);
|
||||
QRegularExpression literal(QStringLiteral("\"((?:[^\"\\\\]|\\\\.)*)\""));
|
||||
|
||||
auto it = call.globalMatch(text);
|
||||
while (it.hasNext()) {
|
||||
const QRegularExpressionMatch match = it.next();
|
||||
QString source = match.captured(1);
|
||||
const QString rest = text.mid(match.capturedEnd(0));
|
||||
// Adjacent literals continue the same sentence.
|
||||
QRegularExpressionMatch more = tail.match(rest);
|
||||
if (more.hasMatch()) {
|
||||
auto lit = literal.globalMatch(more.captured(0));
|
||||
while (lit.hasNext()) source += lit.next().captured(1);
|
||||
}
|
||||
source = source.replace(QStringLiteral("\\n"), QStringLiteral("\n"))
|
||||
.replace(QStringLiteral("\\t"), QStringLiteral("\t"))
|
||||
.replace(QStringLiteral("\\\""), QStringLiteral("\""));
|
||||
if (source.size() < 2) continue;
|
||||
if (catalogue.contains(source)) continue;
|
||||
// A string two classes share may be keyed per context instead.
|
||||
bool contextual = false;
|
||||
for (const QString& key : catalogue.keys()) {
|
||||
if (key.endsWith(QStringLiteral("::") + source)) {
|
||||
contextual = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!contextual) missing << source;
|
||||
}
|
||||
}
|
||||
|
||||
check(missing.isEmpty(), "english_catalogue_covers_every_string");
|
||||
for (const QString& source : missing) {
|
||||
std::cout << " missing: " << source.toStdString() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
QTemporaryDir home;
|
||||
assert(home.isValid());
|
||||
qputenv("HOME", home.path().toLocal8Bit());
|
||||
qputenv("XDG_CONFIG_HOME", QDir(home.path()).filePath("config").toLocal8Bit());
|
||||
qputenv("XDG_DATA_HOME", QDir(home.path()).filePath("data").toLocal8Bit());
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
app.setApplicationName("PacManagerLanguageTest");
|
||||
app.setOrganizationName("FWSTest");
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope,
|
||||
QDir(home.path()).filePath("settings"));
|
||||
|
||||
// A folder the search path can find, so the "no catalogue" case is real.
|
||||
const QString dir = QDir(home.path()).filePath("data/catalogues");
|
||||
QDir().mkpath(dir + QStringLiteral("/translations"));
|
||||
|
||||
testCatalogueIsAcceptedOnlyWhenUsable(dir);
|
||||
testResolveFollowsTheSetting();
|
||||
testEnglishCatalogueTranslates();
|
||||
testBrokenCatalogueIsRefused();
|
||||
testEnglishCatalogueCoversTheSource();
|
||||
|
||||
if (failures == 0) std::cout << "All language-manager tests passed" << std::endl;
|
||||
return failures == 0 ? 0 : 1;
|
||||
}
|
||||
@@ -0,0 +1,411 @@
|
||||
{
|
||||
"//": "English catalogue for PacManager. Read as it is at runtime, so adding a language costs one file like this one and no build step. Keys are the French source strings; a key may also be \"Context::source\" when two classes need different wording for the same string.",
|
||||
" (mise à jour disponible)": " (update available)",
|
||||
" (externe)": " (external)",
|
||||
" PacManager reprendra ensuite l'opération automatiquement.": " PacManager will then resume the operation automatically.",
|
||||
"%1 (jusqu'au %2)": "%1 (until %2)",
|
||||
"%1 : %2": "%1: %2",
|
||||
"%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: unsupported format (PacManager installs the .flatpakref, .flatpakrepo and .flatpak files, and the .fwspacm plugin packages).",
|
||||
"%1 Ko": "%1 KB",
|
||||
"%1 Mo": "%1 MB",
|
||||
"%1 action(s)": "%1 action(s)",
|
||||
"%1 est installé plusieurs fois. Choisissez les installations à supprimer.": "%1 is installed several times. Choose the installations to remove.",
|
||||
"%1 fichier(s) déposé(s)": "%1 file(s) dropped",
|
||||
"%1 gestionnaire(s) actif(s) | Paquets affichés : %2 | Actions enregistrées : %3": "%1 provider(s) active | Packages shown: %2 | Actions recorded: %3",
|
||||
"%1 installation(s) :\n• %2": "%1 installation(s):\n• %2",
|
||||
"%1 installé avec succès": "%1 installed successfully",
|
||||
"%1 mise(s) à jour disponible(s)": "%1 update(s) available",
|
||||
"%1 ne sait pas installer de paquets.": "%1 cannot install packages.",
|
||||
"%1 ne sait pas mettre à jour de paquets.": "%1 cannot update packages.",
|
||||
"%1 ne sait pas supprimer de paquets.": "%1 cannot remove packages.",
|
||||
"%1 o": "%1 B",
|
||||
"%1 orphelin(s)": "%1 orphan(s)",
|
||||
"%1 orphelin(s) et %2 paquet(s) legacy détecté(s)": "%1 orphan(s) and %2 legacy package(s) detected",
|
||||
"%1 orphelin(s) · %2 legacy": "%1 orphan(s) · %2 legacy",
|
||||
"%1 paquet(s)": "%1 package(s)",
|
||||
"%1 paquet(s) exporté(s) vers %2": "%1 package(s) exported to %2",
|
||||
"%1 paquet(s) installé(s)": "%1 package(s) installed",
|
||||
"%1 paquet(s) supprimé(s)": "%1 package(s) removed",
|
||||
"%1 paquet(s) trouvé(s)": "%1 package(s) found",
|
||||
"%1 supprimé avec succès": "%1 removed successfully",
|
||||
"%1Mot de passe sudo pour mettre à jour PacManager :\n": "%1Sudo password to update PacManager:\n",
|
||||
"1 Mo": "1 MB",
|
||||
"1 heure": "1 hour",
|
||||
"100 Mo": "100 MB",
|
||||
"20 Mo": "20 MB",
|
||||
"24 heures": "24 hours",
|
||||
"5 Mo": "5 MB",
|
||||
"7 jours": "7 days",
|
||||
"<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> is already using the pacman database.",
|
||||
"<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Package manager for Arch Linux (pacman).</p>",
|
||||
"<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager has been updated</h3><p>The new version will be active on the next start.</p><pre>%1</pre>",
|
||||
"<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 is available</h3><p>You are currently running version %2.</p>",
|
||||
"<p>La mise à jour a échoué :</p><pre>%1</pre>": "<p>The update failed:</p><pre>%1</pre>",
|
||||
"ACTIONS RAPIDES": "QUICK ACTIONS",
|
||||
"ACTIVITÉ RÉCENTE": "RECENT ACTIVITY",
|
||||
"AJOUTER UN PLUGIN": "ADD A PLUGIN",
|
||||
"Accepter les fichiers Flatpak déposés sur la fenêtre": "Accept Flatpak files dropped on the window",
|
||||
"Actif": "Active",
|
||||
"Action": "Action",
|
||||
"Action inconnue : %1": "Unknown action: %1",
|
||||
"Actions enregistrées": "Actions recorded",
|
||||
"Activer": "Enable",
|
||||
"Afficher PacManager": "Show PacManager",
|
||||
"Aide": "Help",
|
||||
"Analyse des paquets inutilisés et legacy...": "Analysing unused and legacy packages...",
|
||||
"Analyser": "Analyse",
|
||||
"Annuler": "Cancel",
|
||||
"Au-delà de cette taille, le journal est enregistré et remplacé par un journal neuf. Le précédent est conservé (operations.log.1).": "Past this size the journal is saved and replaced by a fresh one. The previous one is kept (operations.log.1).",
|
||||
"Aucun cache à nettoyer sur ce système.": "No cache to clean on this system.",
|
||||
"Aucun fichier à installer.": "No file to install.",
|
||||
"Aucun gestionnaire de paquets disponible sur ce système.": "No package manager available on this system.",
|
||||
"Aucun gestionnaire de paquets disponible.": "No package manager available.",
|
||||
"Aucun gestionnaire de paquets ne sait installer ce fichier.": "No package manager can install this file.",
|
||||
"Aucun gestionnaire ne tourne : le verrou peut être supprimé sans risque.": "No package manager is running: the lock can be removed safely.",
|
||||
"Aucun orphelin à supprimer.": "No orphan to remove.",
|
||||
"Aucun paquet système connu pour ce plugin.": "No system package known for this plugin.",
|
||||
"Aucun paquet sélectionné n'est supprimable.": "None of the selected packages can be removed.",
|
||||
"Aucun paquet à afficher.\nLancez une recherche ou ouvrez la liste des paquets installés.": "No package to show.\nRun a search or open the list of installed packages.",
|
||||
"Aucune action enregistrée pour le moment": "No action recorded yet",
|
||||
"Aucune installation sélectionnée : cochez les copies à supprimer, ou annulez.": "No installation selected: tick the copies to remove, or cancel.",
|
||||
"Aucune liste à exporter.": "No list to export.",
|
||||
"Aucune mise à jour disponible.\nVotre système est à jour.": "No update available.\nYour system is up to date.",
|
||||
"Aucune mise à jour ne peut être appliquée localement.": "No update can be applied locally.",
|
||||
"Aucune opération en attente.": "No pending operation.",
|
||||
"Aucune traduction installée : l'interface reste dans la langue de PacManager. Les catalogues sont cherchés dans un dossier « translations » à côté de la configuration ou de l'exécutable.": "No translation installed: the interface stays in PacManager's own language. Catalogues are looked for in a “translations” folder next to the configuration or next to the executable.",
|
||||
"Auteur": "Author",
|
||||
"Avant chaque opération": "Before each operation",
|
||||
"Base de données verrouillée": "Database locked",
|
||||
"Base libérée, reprise de l'opération...": "Lock released, resuming the operation...",
|
||||
"Base pacman libérée, nouvelle tentative...": "pacman database released, trying again...",
|
||||
"Base pacman toujours verrouillée": "pacman database still locked",
|
||||
"Bloquer": "Block",
|
||||
"Bloquer les mises à jour pendant": "Block updates for",
|
||||
"Caches nettoyés": "Caches cleaned",
|
||||
"Catalogues : %1": "Catalogues: %1",
|
||||
"Changer…": "Change…",
|
||||
"Chargement des paquets installés...": "Loading installed packages...",
|
||||
"Choisir la source du journal affiché": "Choose the source of the journal shown",
|
||||
"Choisir le dossier qui recevra operations.log": "Choose the folder that will receive operations.log",
|
||||
"Choisir un fichier de paquet de plugin à installer (le glisser-déposer fait la même chose)": "Choose a plugin package file to install (drag and drop does the same thing)",
|
||||
"Date d'installation": "Install date",
|
||||
"Demande le mot de passe avant chaque opération": "Asks for the password before each operation",
|
||||
"Demande le mot de passe une seule fois, au lancement": "Asks for the password only once, at launch",
|
||||
"Demander au lancement": "Ask at launch",
|
||||
"Demander à chaque fois": "Ask every time",
|
||||
"Des dépendances de compilation manquent (%1).\n": "Build dependencies are missing (%1).\n",
|
||||
"Dossier du journal": "Journal folder",
|
||||
"Dossier du journal : %1": "Journal folder: %1",
|
||||
"Débloquer": "Unblock",
|
||||
"Dépend de": "Depends on",
|
||||
"Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Drop a <code>%1</code> file anywhere on the window: its library is extracted into <code>%2</code>, without a password, and the plugin is loaded right away, with no restart. The package holds a <code>plugin.json</code> manifest and the library; it is built with <code>./make-plugin-package.py</code> (see doc/plugins.md).",
|
||||
"Dépôt": "Repository",
|
||||
"Dépôt : %1": "Repository: %1",
|
||||
"Dépôt : —": "Repository: —",
|
||||
"Désactiver": "Disable",
|
||||
"Désactivé": "Disabled",
|
||||
"Désactivé, le dépôt est refusé par la fenêtre. « Ouvrir avec PacManager » depuis le gestionnaire de fichiers, lui, continue de fonctionner.": "When disabled, the window refuses drops. “Open with PacManager” from the file manager keeps working either way.",
|
||||
"Effacer l'historique": "Clear the history",
|
||||
"Enregistrer l'historique affiché dans un fichier CSV": "Save the history shown to a CSV file",
|
||||
"Entrez un terme de recherche.": "Enter a search term.",
|
||||
"Erreur lors de la mise à jour globale": "Error during the full update",
|
||||
"Erreur lors du rafraîchissement": "Error while refreshing",
|
||||
"Export": "Export",
|
||||
"Exporter": "Export",
|
||||
"Exporter (CSV)": "Export (CSV)",
|
||||
"Exporter l'historique": "Export the history",
|
||||
"Exporter l'historique...": "Export the history...",
|
||||
"Exporter la liste affichée en CSV": "Export the list shown to CSV",
|
||||
"Exporter la liste affichée...": "Export the list shown...",
|
||||
"Exporter la liste des paquets": "Export the package list",
|
||||
"Extension": "Extension",
|
||||
"Fermer et réessayer": "Close and retry",
|
||||
"Fermer le gestionnaire": "Close the package manager",
|
||||
"Fichier": "File",
|
||||
"Fichier installé": "Installed file",
|
||||
"Filtre local, instantané": "Local filter, instant",
|
||||
"Filtrer :": "Filter:",
|
||||
"Filtrer les logs (paquet, action, date)...": "Filter the logs (package, action, date)...",
|
||||
"Filtrer par nom...": "Filter by name...",
|
||||
"Fournisseur": "Provider",
|
||||
"Fournisseur : %1": "Provider: %1",
|
||||
"GLISSER-DÉPOSER": "DRAG AND DROP",
|
||||
"Gestionnaire": "Provider",
|
||||
"Gestionnaire de paquets Arch Linux": "Arch Linux package manager",
|
||||
"Gestionnaire de paquets natif d'Arch Linux": "Arch Linux's native package manager",
|
||||
"Gestionnaires de paquets et extensions": "Package managers and extensions",
|
||||
"Glisser-déposer activé": "Drag and drop enabled",
|
||||
"Glisser-déposer désactivé": "Drag and drop disabled",
|
||||
"Historique": "History",
|
||||
"Historique des actions": "History of actions",
|
||||
"Historique effacé": "History cleared",
|
||||
"Historique exporté vers %1": "History exported to %1",
|
||||
"Historique vide.": "History is empty.",
|
||||
"Identifiants demandés à chaque opération.": "Credentials asked for on every operation.",
|
||||
"Identifiants enregistrés pour la session.": "Credentials kept for the session.",
|
||||
"Identifiants sudo": "Sudo credentials",
|
||||
"Illimité": "Unlimited",
|
||||
"Impossible d'ouvrir %1.\nVérifiez que le fichier existe et que vous avez les droits de lecture.": "Cannot open %1.\nCheck that the file exists and that you have read permission.",
|
||||
"Impossible d'écrire dans %1": "Cannot write to %1",
|
||||
"Installation": "Installation",
|
||||
"Installation de %1...": "Installing %1...",
|
||||
"Installation de l'outil": "Installing the tool",
|
||||
"Installation de l'outil %1...": "Installing the tool %1...",
|
||||
"Installation depuis un fichier : %1...": "Installing from a file: %1...",
|
||||
"Installation du fichier": "Installing the file",
|
||||
"Installation du paquet %1...": "Installing the package %1...",
|
||||
"Installations": "Installations",
|
||||
"Installer": "Install",
|
||||
"Installer l'outil": "Install the tool",
|
||||
"Installer un .flatpakref, .flatpakrepo ou .flatpak en le glissant sur la fenêtre, au lieu de passer par « Ouvrir avec ».": "Install a .flatpakref, .flatpakrepo or .flatpak by dropping it on the window, instead of going through “Open with”.",
|
||||
"Installé": "Installed",
|
||||
"Installés": "Installed",
|
||||
"JOURNAL": "JOURNAL",
|
||||
"Journal actuel : %1": "Current journal: %1",
|
||||
"Journal de l'application": "Application journal",
|
||||
"Journal déplacé vers %1": "Journal moved to %1",
|
||||
"Journal pacman (/var/log/pacman.log)": "pacman journal (/var/log/pacman.log)",
|
||||
"Journal pacman vide ou illisible.": "pacman journal is empty or unreadable.",
|
||||
"Journal replacé dans le dossier par défaut": "Journal put back in the default folder",
|
||||
"Journal vide : rien n'a encore été enregistré.": "Journal is empty: nothing has been recorded yet.",
|
||||
"Jusqu'à annulation": "Until cancelled",
|
||||
"L'installation doit écrire dans %1.\n": "The installation must write to %1.\n",
|
||||
"L'opération a échoué.": "The operation failed.",
|
||||
"LANGUE": "LANGUAGE",
|
||||
"La base pacman est verrouillée par %1.": "The pacman database is locked by %1.",
|
||||
"La vérification automatique des mises à jour est désactivée dans les paramètres.": "Automatic update checking is disabled in the settings.",
|
||||
"Langue de l'interface": "Interface language",
|
||||
"Langue de l'interface : %1": "Interface language: %1",
|
||||
"Langue du système (%1)": "System language (%1)",
|
||||
"Le fermer libère la base ; une transaction en cours sera interrompue.": "Closing it releases the database; a running transaction is interrupted.",
|
||||
"Le journal contient toutes les opérations et la sortie des commandes, comme le ferait un terminal.": "The journal holds every operation and the command output, the way a terminal would.",
|
||||
"Le mot de passe est demandé au lancement puis conservé jusqu'à la fermeture de la fenêtre. Les paquets système restent protégés : il n'est stocké nulle part.": "The password is asked for at launch and kept until the window is closed. System packages stay protected: it is stored nowhere.",
|
||||
"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.": "The <b>orphans</b> were installed as dependencies and are no longer required by any package: they can be removed safely. <b>Foreign</b> packages come from the AUR or from a manual build: check them one by one before removing them.",
|
||||
"Libération de la base de données pacman...": "Releasing the pacman database...",
|
||||
"Logs": "Logs",
|
||||
"Logs pacman": "pacman log",
|
||||
"Logs rechargés": "Logs reloaded",
|
||||
"MAJ dispo": "Update avail.",
|
||||
"MISES À JOUR DE PACMANAGER": "PACMANAGER UPDATES",
|
||||
"MOT DE PASSE ADMINISTRATEUR": "ADMINISTRATOR PASSWORD",
|
||||
"Maintenez votre système à jour": "Keep your system up to date",
|
||||
"Mettre à jour": "Update",
|
||||
"Mettre à jour tous les paquets (Ctrl+U affiche la liste)": "Update every package (Ctrl+U shows the list)",
|
||||
"Mettre à jour tous les paquets listés": "Update all the packages listed",
|
||||
"Mise à jour": "Update",
|
||||
"Mise à jour annulée.": "Update cancelled.",
|
||||
"Mise à jour de %1...": "Updating %1...",
|
||||
"Mise à jour de tous les paquets...": "Updating every package...",
|
||||
"Mise à jour disponible": "Update available",
|
||||
"Mise à jour en cours en arrière-plan...": "Update running in the background...",
|
||||
"Mise à jour globale": "Full update",
|
||||
"Mise à jour terminée": "Update finished",
|
||||
"Mise à jour terminée, redémarrage de PacManager...": "Update finished, restarting PacManager...",
|
||||
"Mises à jour": "Updates",
|
||||
"Mises à jour bloisées encore %1 heure(s).": "Updates still blocked for %1 more hour(s).",
|
||||
"Mises à jour bloisées encore %1 jour(s).": "Updates still blocked for %1 more day(s).",
|
||||
"Mises à jour bloisées encore %1 minute(s).": "Updates still blocked for %1 more minute(s).",
|
||||
"Mises à jour bloquées jusqu'à annulation.": "Updates blocked until cancelled.",
|
||||
"Mises à jour de PacManager bloquées jusqu'à annulation": "PacManager updates blocked until cancelled",
|
||||
"Mises à jour de PacManager bloquées pendant %1 h": "PacManager updates blocked for %1 h",
|
||||
"Mises à jour dispo": "Updates available",
|
||||
"Mises à jour disponibles": "Available updates",
|
||||
"Mises à jour · %1": "Updates · %1",
|
||||
"Mot de passe administrateur (sudo) :": "Administrator password (sudo):",
|
||||
"Mot de passe administrateur (sudo) requis.": "Administrator password (sudo) required.",
|
||||
"Nettoyage": "Cleanup",
|
||||
"Nettoyage des caches": "Cache cleanup",
|
||||
"Nettoyage des caches...": "Cleaning the caches...",
|
||||
"Nettoyages": "Cleanups",
|
||||
"Nettoyer le système": "Clean the system",
|
||||
"Nom": "Name",
|
||||
"Nom de paquet manquant.": "Package name missing.",
|
||||
"Opération annulée : identifiants requis.": "Operation cancelled: credentials required.",
|
||||
"Opération en cours...": "Operation in progress...",
|
||||
"Opération terminée": "Operation finished",
|
||||
"Outil installé, plugin disponible.": "Tool installed, plugin available.",
|
||||
"Outil « %1 » non détecté sur ce système.": "Tool “%1” not detected on this system.",
|
||||
"Outils": "Tools",
|
||||
"Ouverture des détails de %1...": "Opening the details of %1...",
|
||||
"Ouvrir la page des releases": "Open the releases page",
|
||||
"Ouvrir le dossier": "Open the folder",
|
||||
"Ouvrir les paramètres": "Open the settings",
|
||||
"Ouvrir un paquet de plugin": "Open a plugin package",
|
||||
"Ouvrir un paquet...": "Open a package...",
|
||||
"Où PacManager enregistre-t-il ses logs ?": "Where does PacManager write its logs?",
|
||||
"PAQUETS DE PLUGIN": "PLUGIN PACKAGES",
|
||||
"PAQUETS INUTILISÉS ET LEGACY": "UNUSED AND LEGACY PACKAGES",
|
||||
"PacManager %1 démarré — %2 gestionnaire(s) : %3": "PacManager %1 started — %2 provider(s): %3",
|
||||
"PacManager - Gestionnaire de Paquets": "PacManager - Package Manager",
|
||||
"PacManager est à jour (v%1)": "PacManager is up to date (v%1)",
|
||||
"PacManager vous demandera le mot de passe avant chaque installation, suppression ou mise à jour.": "PacManager will ask for the password before each installation, removal or update.",
|
||||
"Pacman est intégré et le plugin Flatpak est livré par défaut. Si un fournisseur est « Indisponible », sélectionnez-le puis cliquez sur « Installer l'outil » pour l'installer via pacman. Un plugin peut être un gestionnaire de paquets (apt, dnf, ...) ou n'importe quelle extension (addon graphique, helper, ...) tant qu'il est écrit en C++ : compilez une bibliothèque partagée (voir plugins/example-provider et plugins/example-addon), empaquetez-la avec ./make-plugin-package.py, puis déposez le fichier %1 obtenu n'importe où sur la fenêtre.": "Pacman is built in and the Flatpak plugin ships by default. If a provider reads “Unavailable”, select it and click “Install the tool” to install it through pacman. A plugin can be a package manager (apt, dnf, ...) or any extension (graphical addon, helper, ...) as long as it is written in C++: build a shared library (see plugins/example-provider and plugins/example-addon), package it with ./make-plugin-package.py, then drop the resulting %1 file anywhere on the window.",
|
||||
"Paquet": "Package",
|
||||
"Paquet « %1 » installé (%2)": "Package “%1” installed (%2)",
|
||||
"Paquet « %1 » supprimé": "Package “%1” removed",
|
||||
"Paquets de plugin (*%1);;Tous les fichiers (*)": "Plugin packages (*%1);;All files (*)",
|
||||
"Paquets installés": "Installed packages",
|
||||
"Paramètres": "Settings",
|
||||
"Parcourez les paquets de votre système": "Browse your system's packages",
|
||||
"Pendant cette durée, aucune vérification de version n'est faite, même depuis le menu Aide.": "During this time no version check is made, not even from the Help menu.",
|
||||
"Personnalisé (%1)": "Custom (%1)",
|
||||
"Plugin": "Plugin",
|
||||
"Plugins": "Plugins",
|
||||
"Plugins rechargés.": "Plugins reloaded.",
|
||||
"Plus tard": "Later",
|
||||
"Préférences de PacManager : journal, glisser-déposer, langue et mises à jour": "PacManager preferences: journal, drag and drop, language and updates",
|
||||
"Prévisualisation des mises à jour disponibles": "Preview the available updates",
|
||||
"Prévisualiser les mises à jour": "Preview updates",
|
||||
"Prêt": "Ready",
|
||||
"Purger le cache de paquets (paccache / pacman -Sc) et les runtimes Flatpak inutilisés": "Purge the package cache (paccache / pacman -Sc) and the unused Flatpak runtimes",
|
||||
"Purger les paquets inutilisés et vider les caches": "Purge unused packages and empty the caches",
|
||||
"Purger les paquets inutilisés ou legacy et vider les caches": "Purge unused or legacy packages and empty the caches",
|
||||
"Quand PacManager doit-il demander le mot de passe sudo ?": "When should PacManager ask for the sudo password?",
|
||||
"Quitter": "Quit",
|
||||
"Rafraîchir": "Refresh",
|
||||
"Rafraîchir les bases de données (Ctrl+R)": "Refresh the package databases (Ctrl+R)",
|
||||
"Rafraîchir les bases de données (pacman -Sy)": "Refresh the package databases (pacman -Sy)",
|
||||
"Rafraîchir les sources": "Refresh the sources",
|
||||
"Rafraîchissement des sources": "Refreshing the sources",
|
||||
"Rafraîchissement des sources...": "Refreshing the sources...",
|
||||
"Recharger": "Reload",
|
||||
"Recherche": "Search",
|
||||
"Recherche des mises à jour en cours...\nLes résultats s'afficheront automatiquement.": "Looking for updates...\nThe results will show up on their own.",
|
||||
"Recherche des mises à jour...": "Looking for updates...",
|
||||
"Recherche en cours...": "Searching...",
|
||||
"Rechercher": "Search",
|
||||
"Rechercher des paquets": "Search for packages",
|
||||
"Rechercher les paquets inutilisés et legacy": "Find unused and legacy packages",
|
||||
"Rechercher un paquet": "Search for a package",
|
||||
"Rechercher un paquet (ex : firefox)...": "Search for a package (e.g. firefox)...",
|
||||
"Requis par": "Required by",
|
||||
"Rescanner les dossiers de plugins": "Rescan the plugin folders",
|
||||
"Revenir au dossier par défaut de l'utilisateur": "Back to the user's default folder",
|
||||
"Rien à nettoyer pour le moment.\nLancez une analyse pour vérifier.": "Nothing to clean for now.\nRun an analysis to check.",
|
||||
"Réessayer": "Retry",
|
||||
"Réinitialiser": "Reset",
|
||||
"SYSTÈME": "SYSTEM",
|
||||
"Sources rafraîchies": "Sources refreshed",
|
||||
"Statut": "Status",
|
||||
"Succès": "Success",
|
||||
"Suppression": "Removal",
|
||||
"Suppression de %1 paquet(s) via %2...": "Removing %1 package(s) via %2...",
|
||||
"Suppression de %1...": "Removing %1...",
|
||||
"Suppressions": "Removals",
|
||||
"Supprimer": "Remove",
|
||||
"Supprimer %1": "Remove %1",
|
||||
"Supprimer %1 ?\n\nCette action est irréversible.": "Remove %1?\n\nThis action cannot be undone.",
|
||||
"Supprimer et réessayer": "Remove the lock and retry",
|
||||
"Supprimer la bibliothèque installée depuis un paquet (jamais une bibliothèque copiée à la main)": "Remove the library installed from a package (never one copied by hand)",
|
||||
"Supprimer la sélection": "Remove the selection",
|
||||
"Supprimer le paquet": "Remove the package",
|
||||
"Supprimer le verrou": "Remove the lock",
|
||||
"Supprimer les orphelins": "Remove the orphans",
|
||||
"Supprimer les orphelins (%1)": "Remove the orphans (%1)",
|
||||
"Supprimer tous les paquets que plus rien ne requiert": "Remove every package nothing requires any more",
|
||||
"Supprimer « %1 » (%2) — à vérifier : rien ne prouve qu'il est inutilisé": "Remove “%1” (%2) — to check: nothing proves it is unused",
|
||||
"Supprimer « %1 » (orphelin)": "Remove “%1” (orphan)",
|
||||
"Sélectionnez un paquet": "Select a package",
|
||||
"Tableau de bord": "Dashboard",
|
||||
"Taille : %1": "Size: %1",
|
||||
"Taille : —": "Size: —",
|
||||
"Taille du téléchargement": "Download size",
|
||||
"Taille installée": "Installed size",
|
||||
"Taille maximale :": "Maximum size:",
|
||||
"Tous les paquets sont à jour": "Every package is up to date",
|
||||
"Tout mettre à jour": "Update everything",
|
||||
"Toutes les actions": "All actions",
|
||||
"Trouvez et installez des paquets": "Find and install packages",
|
||||
"Type": "Type",
|
||||
"Une opération est déjà en cours, patientez...": "An operation is already running, please wait...",
|
||||
"Une opération est en cours, chargement impossible.": "An operation is running, loading is not possible.",
|
||||
"Une opération est en cours, recherche impossible.": "An operation is running, searching is not possible.",
|
||||
"Une recherche est déjà en cours.": "A search is already running.",
|
||||
"Une seule fois, au lancement": "Only once, at launch",
|
||||
"Une vérification par jour maximum, au démarrage. Les paquets du système ne sont pas concernés.": "At most one check a day, at startup. The system's own packages are not concerned.",
|
||||
"Version": "Version",
|
||||
"Version : %1": "Version: %1",
|
||||
"Version installée : v%1. Ces réglages ne concernent que PacManager : les mises à jour des paquets du système ne sont jamais bloquées.": "Installed version: v%1. These settings only concern PacManager: the system's package updates are never blocked.",
|
||||
"Version installée de PacManager": "Installed version of PacManager",
|
||||
"Vider les caches": "Empty the caches",
|
||||
"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.": "Empty the caches of %1?\n\npacman only keeps the last version of each downloaded package, and Flatpak removes the runtimes no application uses any more.",
|
||||
"Voir les mises à jour disponibles": "See the available updates",
|
||||
"Voir les paquets installés": "See the installed packages",
|
||||
"Vue d'ensemble de votre système": "An overview of your system",
|
||||
"Vue d'ensemble du système": "System overview",
|
||||
"Vérification des mises à jour réactivée": "Update checking re-enabled",
|
||||
"Vérification des mises à jour...": "Checking for updates...",
|
||||
"Vérifier les mises à jour": "Check for updates",
|
||||
"Vérifier les nouvelles versions au lancement": "Check for new versions at launch",
|
||||
"\"%1\" via %2": "\"%1\" via %2",
|
||||
"activé": "enabled",
|
||||
"au lancement": "at launch",
|
||||
"avertissement": "warning",
|
||||
"clic rafraîchir les sources": "click refresh the sources",
|
||||
"clic tout mettre à jour": "click update everything",
|
||||
"clic vérifier les mises à jour": "click check for updates",
|
||||
"critique": "critical",
|
||||
"demande du mot de passe administrateur": "administrator password request",
|
||||
"désactivé": "disabled",
|
||||
"détails": "details",
|
||||
"effacé": "cleared",
|
||||
"en cours": "in progress",
|
||||
"export de l'historique": "history export",
|
||||
"export de la liste affichée": "export of the list shown",
|
||||
"glisser-déposer → %1": "drag and drop → %1",
|
||||
"historique": "history",
|
||||
"identifiants sudo demandés une fois par session": "sudo credentials asked once per session",
|
||||
"identifiants sudo demandés à chaque opération": "sudo credentials asked on every operation",
|
||||
"installation de %1": "installing %1",
|
||||
"installation du paquet : %1": "installing the package: %1",
|
||||
"installés": "installed",
|
||||
"interrogation de %1 (%2)": "querying %1 (%2)",
|
||||
"langue → %1": "language → %1",
|
||||
"logs": "logs",
|
||||
"mise à jour appliquée": "update applied",
|
||||
"mises à jour": "updates",
|
||||
"mode d'identifiants → %1": "credential mode → %1",
|
||||
"mot de passe fourni": "password provided",
|
||||
"mot de passe refusé par l'utilisateur": "password refused by the user",
|
||||
"navigation → %1": "navigation → %1",
|
||||
"navigation → page %1": "navigation → page %1",
|
||||
"navigation → paramètres": "navigation → settings",
|
||||
"nettoyage": "cleanup",
|
||||
"ouverture des détails de %1": "opening the details of %1",
|
||||
"pacman est indisponible sur ce système.": "pacman is not available on this system.",
|
||||
"pacman est requis pour installer l'outil.": "pacman is required to install the tool.",
|
||||
"plugins": "plugins",
|
||||
"provider(s) available": "provider(s) available",
|
||||
"recherche": "search",
|
||||
"registre rechargé": "registry reloaded",
|
||||
"sans détail": "no detail",
|
||||
"session démarrée (v%1)": "session started (v%1)",
|
||||
"session terminée (code %1)": "session ended (code %1)",
|
||||
"sudo n'est pas installé sur ce système.": "sudo is not installed on this system.",
|
||||
"suppression du paquet : %1": "removing the package: %1",
|
||||
"tableau de bord": "dashboard",
|
||||
"toujours en cours après %1 — %2": "still running after %1 — %2",
|
||||
"traduction non installée": "translation not installed",
|
||||
"vide": "empty",
|
||||
"vérification de version": "version check",
|
||||
"« %1 »": "“%1”",
|
||||
"« Au lancement » garde le mot de passe pour toute la session : moins de questions, mais il reste en mémoire jusqu'à la fermeture.": "“At launch” keeps the password for the whole session: fewer questions, but it stays in memory until you close the window.",
|
||||
"À propos": "About",
|
||||
"Échec": "Failure",
|
||||
"Échec de l'installation": "Installation failed",
|
||||
"Échec de l'installation de %1": "Installation of %1 failed",
|
||||
"Échec de l'installation de l'outil": "Installing the tool failed",
|
||||
"Échec de l'installation de l'outil.": "Installing the tool failed.",
|
||||
"Échec de l'installation du fichier": "Installing the file failed",
|
||||
"Échec de l'opération": "The operation failed",
|
||||
"Échec de la mise à jour": "The update failed",
|
||||
"Échec de la suppression": "Removal failed",
|
||||
"Échec de la suppression de %1": "Removal of %1 failed",
|
||||
"Échec du nettoyage": "The cleanup failed",
|
||||
"Échec du nettoyage des caches": "The cache cleanup failed",
|
||||
"Échec pour « %1 » : %2": "Failed for “%1”: %2",
|
||||
"à chaque fois": "every time",
|
||||
"⟶ terminé": "⟶ done",
|
||||
"⟶ échec": "⟶ failed",
|
||||
"journal → %1": "journal → %1"
|
||||
}
|
||||
Reference in new issue
Block a user