From bbc5ff5103fd60d98dd6d7f6cba7b1b001be01a7 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Sat, 20 Jan 2018 14:16:02 +0100 Subject: [PATCH] Use actual full en_US translation for English and drop en_plurals file --- share/translations/keepassx_en_plurals.ts | 41 ----------------------- share/translations/update.sh | 1 - src/core/Translator.cpp | 15 ++++++--- 3 files changed, 11 insertions(+), 46 deletions(-) delete mode 100644 share/translations/keepassx_en_plurals.ts diff --git a/share/translations/keepassx_en_plurals.ts b/share/translations/keepassx_en_plurals.ts deleted file mode 100644 index 02ed5541e..000000000 --- a/share/translations/keepassx_en_plurals.ts +++ /dev/null @@ -1,41 +0,0 @@ - - - - - DatabaseWidget - - Do you really want to move %n entry(s) to the recycle bin? - - Do you really want to move %n entry to the recycle bin? - Do you really want to move %n entries to the recycle bin? - - - - - EditEntryWidget - - %n week(s) - - %n week - %n weeks - - - - %n month(s) - - %n month - %n months - - - - - EditWidgetIcons - - Can't delete icon. Still used by %n item(s). - - Can't delete icon. Still used by %n item. - Can't delete icon. Still used by %n items. - - - - diff --git a/share/translations/update.sh b/share/translations/update.sh index ed8a69f55..c8b7da40c 100755 --- a/share/translations/update.sh +++ b/share/translations/update.sh @@ -49,7 +49,6 @@ if $UPDATE; then LUPDATE=lupdate fi $LUPDATE -no-ui-lines -disable-heuristic similartext -locations none -no-obsolete src -ts share/translations/keepassx_en.ts - $LUPDATE -no-ui-lines -disable-heuristic similartext -locations none -pluralonly src -ts share/translations/keepassx_en_plurals.ts echo fi diff --git a/src/core/Translator.cpp b/src/core/Translator.cpp index bc75a0973..94aed3adf 100644 --- a/src/core/Translator.cpp +++ b/src/core/Translator.cpp @@ -38,6 +38,10 @@ void Translator::installTranslators() if (language == "system" || language.isEmpty()) { language = QLocale::system().name(); } + if (language == "en") { + // use actual English translation instead of the English locale source language + language = "en_US"; + } const QStringList paths = { #ifdef QT_DEBUG @@ -48,8 +52,7 @@ void Translator::installTranslators() bool translationsLoaded = false; for (const QString& path : paths) { - translationsLoaded |= installTranslator(language, path) || installTranslator("en_plurals", path); - installQtTranslator(language, path); + translationsLoaded |= installTranslator(language, path) || installTranslator("en_US", path); } if (!translationsLoaded) { // couldn't load configured language or fallback @@ -79,12 +82,16 @@ QList> Translator::availableLanguages() QRegularExpressionMatch match = regExp.match(filename); if (match.hasMatch()) { QString langcode = match.captured(1); - if (langcode == "en_plurals") { - langcode = "en"; + if (langcode == "en") { + continue; } QLocale locale(langcode); QString languageStr = QLocale::languageToString(locale.language()); + if (langcode == "la") { + // langcode "la" (Latin) is translated into "C" by QLocale::languageToString() + languageStr = "Latin"; + } QString countryStr; if (langcode.contains("_")) { countryStr = QString(" (%1)").arg(QLocale::countryToString(locale.country()));