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 "QvTinyLog.hpp"
#include "QvCoreConfigObjects.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. // Linux users and DEs should handle the darkMode UI themselves.
#ifndef QV2RAY_USE_BUILTIN_DARKTHEME #ifndef QV2RAY_USE_BUILTIN_DARKTHEME

View File

@ -69,7 +69,7 @@ namespace Qv2ray
UPDATELOG("Added v2CorePath to the config file.") UPDATELOG("Added v2CorePath to the config file.")
// //
QJsonObject uiSettings; QJsonObject uiSettings;
uiSettings["language"] = root["language"].toString("en-US"); uiSettings["language"] = root["language"].toString("en-US").replace("-", "_");
root["uiConfig"] = uiSettings; root["uiConfig"] = uiSettings;
// //
root["inboundConfig"] = root["inBoundSettings"]; root["inboundConfig"] = root["inBoundSettings"];
@ -121,6 +121,7 @@ namespace Qv2ray
} }
root["subscriptions"] = newSubscriptions; root["subscriptions"] = newSubscriptions;
UPDATELOG("Added subscription renewal options.")
break; break;
} }
@ -133,6 +134,15 @@ namespace Qv2ray
root["apiConfig"] = apiConfig; root["apiConfig"] = apiConfig;
break; 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; 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)); std::unique_ptr<QCoreApplication> consoleApp(new QCoreApplication(argc, argv));
// //
// Install a default translater. From the OS/DE // Install a default translater. From the OS/DE
consoleApp->installTranslator(getTranslator(QLocale::system().name().replace("_", "-"))); consoleApp->installTranslator(getTranslator(QLocale::system().name()));
QvCommandArgParser parser; QvCommandArgParser parser;
QString errorMessage; QString errorMessage;
@ -251,7 +251,7 @@ int main(int argc, char *argv[])
// //
// Not duplicated. // Not duplicated.
// Install a default translater. From the OS/DE // Install a default translater. From the OS/DE
auto _lang = QLocale::system().name().replace("_", "-"); auto _lang = QLocale::system().name();
auto _sysTranslator = getTranslator(_lang); auto _sysTranslator = getTranslator(_lang);
if (_lang != "en-US") { if (_lang != "en-US") {