2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Display languages native names in the box.

Also don't suggest the old official languages in a popup.
This commit is contained in:
John Preston
2017-06-04 16:09:53 +03:00
parent 85e6f55536
commit f3e65d400d
5 changed files with 45 additions and 23 deletions

View File

@@ -73,8 +73,22 @@ void CloudManager::setSuggestedLanguage(const QString &langCode) {
_firstLanguageSuggestion.notify();
if (AuthSession::Exists() && _langpack.id().isEmpty() && !_suggestedLanguage.isEmpty()) {
_offerSwitchToId = _suggestedLanguage;
offerSwitchLangPack();
auto isLegacy = [](const QString &languageId) {
for (auto &legacyString : kLegacyLanguages) {
auto legacyId = str_const_toString(legacyString);
if (ConvertLegacyLanguageId(legacyId) == languageId) {
return true;
}
}
return false;
};
// The old available languages (de/it/nl/ko/es/pt_BR) won't be
// suggested anyway, because everyone saw the suggestion in intro.
if (!isLegacy(_suggestedLanguage)) {
_offerSwitchToId = _suggestedLanguage;
offerSwitchLangPack();
}
}
}
}
@@ -103,7 +117,7 @@ void CloudManager::requestLanguageList() {
for_const (auto &langData, result.v) {
t_assert(langData.type() == mtpc_langPackLanguage);
auto &language = langData.c_langPackLanguage();
languages.push_back({ qs(language.vlang_code), qs(language.vname) });
languages.push_back({ qs(language.vlang_code), qs(language.vname), qs(language.vnative_name) });
}
if (_languages != languages) {
_languages = languages;