diff --git a/src/lang.qrc b/src/lang.qrc index 49d0aa7f1..945f76713 100644 --- a/src/lang.qrc +++ b/src/lang.qrc @@ -9,6 +9,8 @@ lang/qbittorrent_de.qm lang/qbittorrent_el.qm lang/qbittorrent_en.qm + lang/qbittorrent_en_AU.qm + lang/qbittorrent_en_GB.qm lang/qbittorrent_es.qm lang/qbittorrent_eu.qm lang/qbittorrent_fi.qm diff --git a/src/main.cpp b/src/main.cpp index 809e3a084..fe7b8d87b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -260,13 +260,13 @@ int main(int argc, char *argv[]) { )) { qDebug("Qt %s locale recognized, using translation.", qPrintable(locale)); }else{ - qDebug("Qt %s locale unrecognized, using default (en_GB).", qPrintable(locale)); + qDebug("Qt %s locale unrecognized, using default (en).", qPrintable(locale)); } app.installTranslator(&qtTranslator); if (translator.load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { qDebug("%s locale recognized, using translation.", qPrintable(locale)); }else{ - qDebug("%s locale unrecognized, using default (en_GB).", qPrintable(locale)); + qDebug("%s locale unrecognized, using default (en).", qPrintable(locale)); } app.installTranslator(&translator); #ifndef DISABLE_GUI diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index 588353c83..15401a9d5 100755 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -278,9 +278,8 @@ void options_imp::initializeLanguageCombo() foreach (QString lang_file, lang_files) { QString localeStr = lang_file.mid(12); // remove "qbittorrent_" localeStr.chop(3); // Remove ".qm" - QLocale locale(localeStr); - const QString country = locale.name().split("_").last().toLower(); - QString language_name = languageToLocalizedString(locale.language(), country); + QLocale locale(localeStr); + QString language_name = languageToLocalizedString(locale); comboI18n->addItem(/*QIcon(":/Icons/flags/"+country+".png"), */language_name, locale.name()); qDebug() << "Supported locale:" << locale.name(); } @@ -361,7 +360,7 @@ void options_imp::saveOptions() { if (translator->load(QString::fromUtf8(":/lang/qbittorrent_") + locale)) { qDebug("%s locale recognized, using translation.", qPrintable(locale)); }else{ - qDebug("%s locale unrecognized, using default (en_GB).", qPrintable(locale)); + qDebug("%s locale unrecognized, using default (en).", qPrintable(locale)); } qApp->installTranslator(translator); } @@ -1304,10 +1303,16 @@ void options_imp::handleIPFilterParsed(bool error, int ruleCount) disconnect(QBtSession::instance(), SIGNAL(ipFilterParsed(bool, int)), this, SLOT(handleIPFilterParsed(bool, int))); } -QString options_imp::languageToLocalizedString(QLocale::Language language, const QString& country) +QString options_imp::languageToLocalizedString(const QLocale &locale) { - switch(language) { - case QLocale::English: return "English"; + switch(locale.language()) { + case QLocale::English: { + if (locale.country() == QLocale::Australia) + return "English(Australia)"; + else if (locale.country() == QLocale::UnitedKingdom) + return "English(United Kingdom)"; + return "English"; + } case QLocale::French: return QString::fromUtf8("Français"); case QLocale::German: return QString::fromUtf8("Deutsch"); case QLocale::Hungarian: return QString::fromUtf8("Magyar"); @@ -1317,7 +1322,7 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const case QLocale::Catalan: return QString::fromUtf8("Català"); case QLocale::Galician: return QString::fromUtf8("Galego"); case QLocale::Portuguese: { - if (country == "br") + if (locale.country() == QLocale::Brazil) return QString::fromUtf8("Português brasileiro"); return QString::fromUtf8("Português"); } @@ -1346,14 +1351,14 @@ QString options_imp::languageToLocalizedString(QLocale::Language language, const case QLocale::Basque: return QString::fromUtf8("Euskara"); case QLocale::Vietnamese: return QString::fromUtf8("tiếng Việt"); case QLocale::Chinese: { - if (country == "cn") + if (locale.country() == QLocale::China) return QString::fromUtf8("中文 (简体)"); return QString::fromUtf8("中文 (繁體)"); } case QLocale::Korean: return QString::fromUtf8("한글"); default: { // Fallback to English - const QString eng_lang = QLocale::languageToString(language); + const QString eng_lang = QLocale::languageToString(locale.language()); qWarning() << "Unrecognized language name: " << eng_lang; return eng_lang; } diff --git a/src/preferences/options_imp.h b/src/preferences/options_imp.h index 720707e81..1b0172dd2 100755 --- a/src/preferences/options_imp.h +++ b/src/preferences/options_imp.h @@ -92,7 +92,7 @@ private: void saveOptions(); void loadOptions(); void initializeLanguageCombo(); - static QString languageToLocalizedString(QLocale::Language language, const QString& country); + static QString languageToLocalizedString(const QLocale &locale); // General options QString getLocale() const; bool systrayIntegration() const; diff --git a/src/src.pro b/src/src.pro index 23a32b504..38be01971 100644 --- a/src/src.pro +++ b/src/src.pro @@ -210,6 +210,8 @@ TRANSLATIONS = $$LANG_PATH/qbittorrent_fr.ts \ $$LANG_PATH/qbittorrent_zh.ts \ $$LANG_PATH/qbittorrent_zh_TW.ts \ $$LANG_PATH/qbittorrent_en.ts \ + $$LANG_PATH/qbittorrent_en_AU.ts \ + $$LANG_PATH/qbittorrent_en_GB.ts \ $$LANG_PATH/qbittorrent_ca.ts \ $$LANG_PATH/qbittorrent_es.ts \ $$LANG_PATH/qbittorrent_pl.ts \ diff --git a/src/webui/html/preferences_content.html b/src/webui/html/preferences_content.html index f35a843a7..32de01c11 100644 --- a/src/webui/html/preferences_content.html +++ b/src/webui/html/preferences_content.html @@ -270,7 +270,9 @@ _(Language)