1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

[Preferences] Correctly shows name for N'ko language

This commit is contained in:
nowrep 2014-01-04 11:14:48 +01:00
parent 4cd8fc4557
commit d2d7d89893

View File

@ -56,6 +56,20 @@
#include <QColorDialog> #include <QColorDialog>
#include <QDesktopWidget> #include <QDesktopWidget>
static QString createLanguageItem(const QString &lang)
{
QLocale locale(lang);
QString country = QLocale::countryToString(locale.country());
QString language = QLocale::languageToString(locale.language());
if (lang == QLatin1String("nqo")) {
return QString("N'ko (nqo)");
}
return QString("%1, %2 (%3)").arg(language, country, lang);
}
Preferences::Preferences(QupZilla* mainClass, QWidget* parent) Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::Preferences) , ui(new Ui::Preferences)
@ -380,11 +394,9 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
//OTHER //OTHER
//Languages //Languages
QString activeLanguage = mApp->currentLanguage(); QString activeLanguage = mApp->currentLanguage();
if (!activeLanguage.isEmpty() && activeLanguage != QLatin1String("en_US")) { if (!activeLanguage.isEmpty() && activeLanguage != QLatin1String("en_US")) {
QLocale locale(activeLanguage); ui->languages->addItem(createLanguageItem(activeLanguage), activeLanguage);
QString country = QLocale::countryToString(locale.country());
QString language = QLocale::languageToString(locale.language());
ui->languages->addItem(language + ", " + country + " (" + activeLanguage + ")", activeLanguage);
} }
ui->languages->addItem("English (en_US)"); ui->languages->addItem("English (en_US)");
@ -403,10 +415,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
continue; continue;
} }
QLocale locale(loc); ui->languages->addItem(createLanguageItem(loc), loc);
QString country = QLocale::countryToString(locale.country());
QString language = QLocale::languageToString(locale.language());
ui->languages->addItem(language + ", " + country + " (" + loc + ")", loc);
} }
// Proxy Configuration // Proxy Configuration