mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 10:50:23 +08:00
fix: fixed #845
This commit is contained in:
parent
311f7ee294
commit
a62db8de1d
@ -1 +1 @@
|
|||||||
5819
|
5820
|
||||||
|
@ -396,11 +396,17 @@ namespace Qv2ray
|
|||||||
// Load config object from upgraded config QJsonObject
|
// Load config object from upgraded config QJsonObject
|
||||||
auto confObject = Qv2rayConfigObject::fromJson(conf);
|
auto confObject = Qv2rayConfigObject::fromJson(conf);
|
||||||
|
|
||||||
if (!Qv2rayTranslator->GetAvailableLanguages().contains(confObject.uiConfig.language))
|
const auto allTranslations = Qv2rayTranslator->GetAvailableLanguages();
|
||||||
|
const auto osLanguage = QLocale::system().name();
|
||||||
|
if (!allTranslations.contains(confObject.uiConfig.language) && allTranslations.contains(osLanguage))
|
||||||
{
|
{
|
||||||
// Prevent empty.
|
// If configured language is not found. Set to system language.
|
||||||
LOG(MODULE_UI, "Setting default UI language to system locale.")
|
LOG(MODULE_UI, "Fall back language setting to: " + osLanguage)
|
||||||
confObject.uiConfig.language = QLocale::system().name();
|
confObject.uiConfig.language = osLanguage;
|
||||||
|
}
|
||||||
|
else if (!allTranslations.isEmpty())
|
||||||
|
{
|
||||||
|
confObject.uiConfig.language = allTranslations.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Qv2rayTranslator->InstallTranslation(confObject.uiConfig.language))
|
if (!Qv2rayTranslator->InstallTranslation(confObject.uiConfig.language))
|
||||||
@ -409,6 +415,7 @@ namespace Qv2ray
|
|||||||
"Cannot load translation for " + confObject.uiConfig.language + NEWLINE + //
|
"Cannot load translation for " + confObject.uiConfig.language + NEWLINE + //
|
||||||
"English is now used." + NEWLINE + NEWLINE + //
|
"English is now used." + NEWLINE + NEWLINE + //
|
||||||
"Please go to Preferences Window to change language or open an Issue");
|
"Please go to Preferences Window to change language or open an Issue");
|
||||||
|
confObject.uiConfig.language = "en_US";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's save the config.
|
// Let's save the config.
|
||||||
|
Loading…
Reference in New Issue
Block a user