Alwayse show locale "en_US" in the language list.
--HG-- branch : develop
This commit is contained in:
parent
973e2563af
commit
e881547999
|
@ -144,6 +144,9 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
||||||
fileNames.append(it.fileName());
|
fileNames.append(it.fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool englishUS = false;
|
||||||
|
const QString en_US = QStringLiteral("en_US");
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i)
|
for (int i = 0; i < fileNames.size(); ++i)
|
||||||
{
|
{
|
||||||
// get locale extracted by filename
|
// get locale extracted by filename
|
||||||
|
@ -151,6 +154,11 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
||||||
locale.truncate(locale.lastIndexOf(QLatin1String("."))); // "valentina_de_De"
|
locale.truncate(locale.lastIndexOf(QLatin1String("."))); // "valentina_de_De"
|
||||||
locale.remove(0, locale.indexOf(QLatin1String("_")) + 1); // "de_De"
|
locale.remove(0, locale.indexOf(QLatin1String("_")) + 1); // "de_De"
|
||||||
|
|
||||||
|
if (not englishUS)
|
||||||
|
{
|
||||||
|
englishUS = (en_US == locale);
|
||||||
|
}
|
||||||
|
|
||||||
const QLocale loc(locale);
|
const QLocale loc(locale);
|
||||||
const QString lang = loc.nativeLanguageName();
|
const QString lang = loc.nativeLanguageName();
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
||||||
|
@ -158,12 +166,12 @@ QGroupBox *TapeConfigurationPage::LangGroup()
|
||||||
langCombo->addItem(ico, lang, locale);
|
langCombo->addItem(ico, lang, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (langCombo->count() == 0)
|
if (langCombo->count() == 0 || not englishUS)
|
||||||
{
|
{
|
||||||
// English language is internal and doens't have own *.qm file.
|
// English language is internal and doens't have own *.qm file.
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
||||||
const QString lang = QLocale("en_US").nativeLanguageName();
|
const QString lang = QLocale(en_US).nativeLanguageName();
|
||||||
langCombo->addItem(ico, lang, "en_US");
|
langCombo->addItem(ico, lang, en_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default translators and language checked
|
// set default translators and language checked
|
||||||
|
|
|
@ -203,6 +203,9 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
fileNames.append(it.fileName());
|
fileNames.append(it.fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool englishUS = false;
|
||||||
|
const QString en_US = QStringLiteral("en_US");
|
||||||
|
|
||||||
for (int i = 0; i < fileNames.size(); ++i)
|
for (int i = 0; i < fileNames.size(); ++i)
|
||||||
{
|
{
|
||||||
// get locale extracted by filename
|
// get locale extracted by filename
|
||||||
|
@ -211,6 +214,11 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De"
|
locale.truncate(locale.lastIndexOf('.')); // "valentina_de_De"
|
||||||
locale.remove(0, locale.indexOf('_') + 1); // "de_De"
|
locale.remove(0, locale.indexOf('_') + 1); // "de_De"
|
||||||
|
|
||||||
|
if (not englishUS)
|
||||||
|
{
|
||||||
|
englishUS = (en_US == locale);
|
||||||
|
}
|
||||||
|
|
||||||
QLocale loc = QLocale(locale);
|
QLocale loc = QLocale(locale);
|
||||||
QString lang = loc.nativeLanguageName();
|
QString lang = loc.nativeLanguageName();
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(loc.country())));
|
||||||
|
@ -218,12 +226,12 @@ QGroupBox *ConfigurationPage::LangGroup()
|
||||||
langCombo->addItem(ico, lang, locale);
|
langCombo->addItem(ico, lang, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (langCombo->count() == 0)
|
if (langCombo->count() == 0 || not englishUS)
|
||||||
{
|
{
|
||||||
// English language is internal and doens't have own *.qm file.
|
// English language is internal and doens't have own *.qm file.
|
||||||
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
QIcon ico(QString("%1/%2.png").arg("://flags").arg(QLocale::countryToString(QLocale::UnitedStates)));
|
||||||
QString lang = QLocale("en_US").nativeLanguageName();
|
QString lang = QLocale(en_US).nativeLanguageName();
|
||||||
langCombo->addItem(ico, lang, "en_US");
|
langCombo->addItem(ico, lang, en_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set default translators and language checked
|
// set default translators and language checked
|
||||||
|
|
Loading…
Reference in New Issue
Block a user