From b6046d829faa172472b1fcaab644968aa0551823 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 1 Jun 2017 18:18:00 +0300 Subject: [PATCH] Save the default language after logging in. We suggest an appropriate language in the intro if server has users system language langpack. But if user doesn't switch to it we save the default ("en") language so that he won't be bothered again. --- Telegram/SourceFiles/intro/introwidget.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp index 0c59748ec4..dd6ed678bb 100644 --- a/Telegram/SourceFiles/intro/introwidget.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -440,6 +440,15 @@ void Widget::Step::finish(const MTPUser &user, QImage photo) { return; } + // Save the default language if we've suggested some other and user ignored it. + auto currentId = Lang::Current().id(); + auto defaultId = Lang::DefaultLanguageId(); + auto suggestedId = Lang::CurrentCloudManager().suggestedLanguage(); + if (currentId.isEmpty() && !suggestedId.isEmpty() && suggestedId != defaultId) { + Lang::Current().switchToId(defaultId); + Local::writeLangPack(); + } + Messenger::Instance().authSessionCreate(user.c_user().vid.v); Local::writeMtpData(); App::wnd()->setupMain(&user);