1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-22 20:44:15 +00:00

Migrate setting about Simplified Chinese locale

Related to PR #17978
This commit is contained in:
sledgehammer999 2023-01-22 02:31:58 +02:00
parent 771c58d000
commit 051bac5e59
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2

View File

@ -395,6 +395,18 @@ namespace
settingsStorage->storeValue(u"GUI/StartUpWindowState"_qs, windowState);
}
}
void migrateChineseLocale()
{
auto *settingsStorage = SettingsStorage::instance();
const auto key = u"Preferences/General/Locale"_qs;
if (settingsStorage->hasKey(key))
{
const auto locale = settingsStorage->loadValue<QString>(key);
if (locale.compare(u"zh"_qs, Qt::CaseInsensitive) == 0)
settingsStorage->storeValue(key, u"zh_CN"_qs);
}
}
}
bool upgrade(const bool /*ask*/)
@ -425,7 +437,10 @@ bool upgrade(const bool /*ask*/)
#endif
if (version < 5)
{
migrateStartupWindowState();
migrateChineseLocale();
}
version = MIGRATION_VERSION;
}