Fix applying language without restart

This commit is contained in:
Eric Kotato 2019-12-25 14:46:33 +03:00
parent fdb4fa4254
commit 2dc0071b29

View file

@ -436,6 +436,8 @@ void CloudManager::sendSwitchingToLanguageRequest() {
const auto finalize = [=] { const auto finalize = [=] {
if (canApplyWithoutRestart(language.id)) { if (canApplyWithoutRestart(language.id)) {
performSwitchAndAddToRecent(language); performSwitchAndAddToRecent(language);
Lang::Current().fillDefaultJson();
Lang::Current().fillFromJson();
} else { } else {
performSwitchAndRestart(language); performSwitchAndRestart(language);
} }
@ -471,6 +473,8 @@ void CloudManager::switchToLanguage(const Language &data) {
performSwitchToCustom(); performSwitchToCustom();
} else if (canApplyWithoutRestart(data.id)) { } else if (canApplyWithoutRestart(data.id)) {
performSwitchAndAddToRecent(data); performSwitchAndAddToRecent(data);
Lang::Current().fillDefaultJson();
Lang::Current().fillFromJson();
} else { } else {
QVector<MTPstring> keys; QVector<MTPstring> keys;
keys.reserve(3); keys.reserve(3);
@ -524,6 +528,8 @@ void CloudManager::performSwitchToCustom() {
} }
if (canApplyWithoutRestart(qsl("#custom"))) { if (canApplyWithoutRestart(qsl("#custom"))) {
_langpack.switchToCustomFile(filePath); _langpack.switchToCustomFile(filePath);
Lang::Current().fillDefaultJson();
Lang::Current().fillFromJson();
} else { } else {
const auto values = loader.found(); const auto values = loader.found();
const auto getValue = [&](ushort key) { const auto getValue = [&](ushort key) {