change: changed language code format

This commit is contained in:
Qv2ray Bot 2020-01-23 14:43:18 +08:00
parent ad9acc686b
commit 8746877bd2
4 changed files with 15 additions and 5 deletions

View File

@ -1 +1 @@
3076
3077

View File

@ -9,7 +9,7 @@
#include "QvTinyLog.hpp"
#include "QvCoreConfigObjects.hpp"
const int QV2RAY_CONFIG_VERSION = 7;
const int QV2RAY_CONFIG_VERSION = 8;
// Linux users and DEs should handle the darkMode UI themselves.
#ifndef QV2RAY_USE_BUILTIN_DARKTHEME

View File

@ -69,7 +69,7 @@ namespace Qv2ray
UPDATELOG("Added v2CorePath to the config file.")
//
QJsonObject uiSettings;
uiSettings["language"] = root["language"].toString("en-US");
uiSettings["language"] = root["language"].toString("en-US").replace("-", "_");
root["uiConfig"] = uiSettings;
//
root["inboundConfig"] = root["inBoundSettings"];
@ -121,6 +121,7 @@ namespace Qv2ray
}
root["subscriptions"] = newSubscriptions;
UPDATELOG("Added subscription renewal options.")
break;
}
@ -133,6 +134,15 @@ namespace Qv2ray
root["apiConfig"] = apiConfig;
break;
}
case 7: {
auto lang = root["uiConfig"].toObject()["language"].toString().replace("-", "_");
auto uiConfig = root["uiConfig"].toObject();
uiConfig["language"] = lang;
root["uiConfig"] = uiConfig;
UPDATELOG("Changed language: " + lang)
break;
}
}
root["config_version"] = root["config_version"].toInt() + 1;

View File

@ -191,7 +191,7 @@ int main(int argc, char *argv[])
std::unique_ptr<QCoreApplication> consoleApp(new QCoreApplication(argc, argv));
//
// Install a default translater. From the OS/DE
consoleApp->installTranslator(getTranslator(QLocale::system().name().replace("_", "-")));
consoleApp->installTranslator(getTranslator(QLocale::system().name()));
QvCommandArgParser parser;
QString errorMessage;
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
//
// Not duplicated.
// Install a default translater. From the OS/DE
auto _lang = QLocale::system().name().replace("_", "-");
auto _lang = QLocale::system().name();
auto _sysTranslator = getTranslator(_lang);
if (_lang != "en-US") {