english mode fix
This commit is contained in:
parent
38cefbbe45
commit
1edf71eedc
2 changed files with 24 additions and 3 deletions
|
@ -69,6 +69,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
#ifndef GTA5SYNC_QCONF // Classic modable loading method
|
#ifndef GTA5SYNC_QCONF // Classic modable loading method
|
||||||
QString externalLanguageStr;
|
QString externalLanguageStr;
|
||||||
bool externalLanguageReady = false;
|
bool externalLanguageReady = false;
|
||||||
|
bool externalEnglishMode = false;
|
||||||
bool loadInternalLang = false;
|
bool loadInternalLang = false;
|
||||||
bool trLoadSuccess = false;
|
bool trLoadSuccess = false;
|
||||||
if (isUserLanguageSystem_p())
|
if (isUserLanguageSystem_p())
|
||||||
|
@ -115,11 +116,12 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
}
|
}
|
||||||
if (trLoadSuccess)
|
if (trLoadSuccess)
|
||||||
{
|
{
|
||||||
if (currentLangIndex != 0) // Don't install the language until we know we not have a better language for the user
|
if (currentLangIndex != 0 || isEnglishMode) // Don't install the language until we know we not have a better language for the user
|
||||||
{
|
{
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "externalLanguageReady" << currentLanguage;
|
qDebug() << "externalLanguageReady" << currentLanguage;
|
||||||
#endif
|
#endif
|
||||||
|
externalEnglishMode = isEnglishMode;
|
||||||
externalLanguageStr = currentLanguage;
|
externalLanguageStr = currentLanguage;
|
||||||
externalLanguageReady = true;
|
externalLanguageReady = true;
|
||||||
}
|
}
|
||||||
|
@ -157,8 +159,9 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
trLoadSuccess = loadSystemTranslation_p(inLangPath, &inAppTranslator);
|
trLoadSuccess = loadSystemTranslation_p(inLangPath, &inAppTranslator);
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "externalLangIndex" << externalLangIndex << "internalLangIndex" << currentLangIndex;
|
qDebug() << "externalLangIndex" << externalLangIndex << "internalLangIndex" << currentLangIndex;
|
||||||
|
qDebug() << "externalEnglishMode" << externalEnglishMode << "internalEnglishMode" << isEnglishMode;
|
||||||
#endif
|
#endif
|
||||||
if (trLoadSuccess && externalLangIndex > currentLangIndex)
|
if ((trLoadSuccess && externalLangIndex > currentLangIndex) || (trLoadSuccess && externalEnglishMode && !isEnglishMode))
|
||||||
{
|
{
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "installInternalTranslation";
|
qDebug() << "installInternalTranslation";
|
||||||
|
@ -180,6 +183,7 @@ void TranslationClass::loadTranslation(QApplication *app)
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "installExternalTranslation";
|
qDebug() << "installExternalTranslation";
|
||||||
#endif
|
#endif
|
||||||
|
isEnglishMode = externalEnglishMode;
|
||||||
currentLanguage = externalLanguageStr;
|
currentLanguage = externalLanguageStr;
|
||||||
app->installTranslator(&exAppTranslator);
|
app->installTranslator(&exAppTranslator);
|
||||||
if (loadQtTranslation_p(exLangPath, &exQtTranslator))
|
if (loadQtTranslation_p(exLangPath, &exQtTranslator))
|
||||||
|
@ -306,6 +310,7 @@ bool TranslationClass::loadSystemTranslation_p(const QString &langPath, QTransla
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "loadLanguageFileSuccess" << QString(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % "_" % langList.at(1) % ".qm");
|
qDebug() << "loadLanguageFileSuccess" << QString(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % "_" % langList.at(1) % ".qm");
|
||||||
#endif
|
#endif
|
||||||
|
isEnglishMode = false;
|
||||||
currentLanguage = languageName;
|
currentLanguage = languageName;
|
||||||
currentLangIndex = currentLangCounter;
|
currentLangIndex = currentLangCounter;
|
||||||
return true;
|
return true;
|
||||||
|
@ -321,16 +326,28 @@ bool TranslationClass::loadSystemTranslation_p(const QString &langPath, QTransla
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "loadLanguageFileSuccess" << QString(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % ".qm");
|
qDebug() << "loadLanguageFileSuccess" << QString(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % ".qm");
|
||||||
#endif
|
#endif
|
||||||
|
isEnglishMode = false;
|
||||||
|
currentLanguage = languageName;
|
||||||
|
currentLangIndex = currentLangCounter;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (langList.at(0) == "en")
|
||||||
|
{
|
||||||
|
#ifdef GTA5SYNC_DEBUG
|
||||||
|
qDebug() << "languageEnglishMode index" << currentLangCounter;
|
||||||
|
#endif
|
||||||
|
isEnglishMode = true;
|
||||||
currentLanguage = languageName;
|
currentLanguage = languageName;
|
||||||
currentLangIndex = currentLangCounter;
|
currentLangIndex = currentLangCounter;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (langList.at(0) == "en")
|
else if (langList.at(0) == "en")
|
||||||
{
|
{
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "languageEnglishMode index" << currentLangCounter;
|
qDebug() << "languageEnglishMode index" << currentLangCounter;
|
||||||
#endif
|
#endif
|
||||||
|
isEnglishMode = true;
|
||||||
currentLanguage = languageName;
|
currentLanguage = languageName;
|
||||||
currentLangIndex = currentLangCounter;
|
currentLangIndex = currentLangCounter;
|
||||||
return true;
|
return true;
|
||||||
|
@ -345,10 +362,12 @@ bool TranslationClass::loadSystemTranslation_p(const QString &langPath, QTransla
|
||||||
{
|
{
|
||||||
if (appTranslator->load(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % ".qm"))
|
if (appTranslator->load(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % ".qm"))
|
||||||
{
|
{
|
||||||
|
isEnglishMode = false;
|
||||||
#ifdef GTA5SYNC_DEBUG
|
#ifdef GTA5SYNC_DEBUG
|
||||||
qDebug() << "loadLanguageFileSuccess" << QString(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % ".qm");
|
qDebug() << "loadLanguageFileSuccess" << QString(langPath % QDir::separator() % "gta5sync_" % langList.at(0) % ".qm");
|
||||||
#endif
|
#endif
|
||||||
currentLanguage = languageName;
|
currentLanguage = languageName;
|
||||||
|
currentLangIndex = currentLangCounter;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -505,6 +524,7 @@ void TranslationClass::unloadTranslation(QApplication *app)
|
||||||
currentLangIndex = 0;
|
currentLangIndex = 0;
|
||||||
currentLanguage = QString();
|
currentLanguage = QString();
|
||||||
QLocale::setDefault(QLocale::c());
|
QLocale::setDefault(QLocale::c());
|
||||||
|
isEnglishMode = false;
|
||||||
isLangLoaded = false;
|
isLangLoaded = false;
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER // Fix dumb Microsoft compiler warning
|
#ifdef _MSC_VER // Fix dumb Microsoft compiler warning
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
QString currentLanguage;
|
QString currentLanguage;
|
||||||
QString userLanguage;
|
QString userLanguage;
|
||||||
int currentLangIndex;
|
int currentLangIndex;
|
||||||
|
bool isEnglishMode;
|
||||||
bool isLangLoaded;
|
bool isLangLoaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue