mirror of https://github.com/procxx/kepka.git
Use QLocale::uiLanguages for system language.
This commit is contained in:
parent
9276101809
commit
e9ab8df737
Telegram/SourceFiles
|
@ -202,8 +202,8 @@ QString PhoneWidget::fullNumber() const {
|
|||
return _code->getLastText() + _phone->getLastText();
|
||||
}
|
||||
|
||||
void PhoneWidget::selectCountry(const QString &c) {
|
||||
_country->onChooseCountry(c);
|
||||
void PhoneWidget::selectCountry(const QString &country) {
|
||||
_country->onChooseCountry(country);
|
||||
}
|
||||
|
||||
void PhoneWidget::setInnerFocus() {
|
||||
|
|
|
@ -43,8 +43,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
namespace Intro {
|
||||
namespace {
|
||||
|
||||
constexpr str_const kDefaultCountry = "US";
|
||||
|
||||
void PrepareSupportMode() {
|
||||
using Data::AutoDownload::Full;
|
||||
|
||||
|
@ -70,11 +68,7 @@ Widget::Widget(QWidget *parent, not_null<Main::Account*> account)
|
|||
tr::lng_menu_settings(),
|
||||
st::defaultBoxButton))
|
||||
, _next(this, nullptr, st::introNextButton) {
|
||||
auto country = Platform::SystemCountry();
|
||||
if (country.isEmpty()) {
|
||||
country = str_const_toString(kDefaultCountry);
|
||||
}
|
||||
getData()->country = country;
|
||||
getData()->country = Platform::SystemCountry();
|
||||
|
||||
_back->entity()->setClickedCallback([this] { historyMove(Direction::Back); });
|
||||
_back->hide(anim::type::instant);
|
||||
|
@ -439,7 +433,7 @@ void Widget::getNearestDC() {
|
|||
).arg(nearest.vnearest_dc().v
|
||||
).arg(nearest.vthis_dc().v));
|
||||
_account->suggestMainDcId(nearest.vnearest_dc().v);
|
||||
auto nearestCountry = qs(nearest.vcountry());
|
||||
const auto nearestCountry = qs(nearest.vcountry());
|
||||
if (getData()->country != nearestCountry) {
|
||||
getData()->country = nearestCountry;
|
||||
getData()->updated.notify();
|
||||
|
|
|
@ -27,13 +27,15 @@ QString SystemVersionPretty() {
|
|||
}
|
||||
|
||||
QString SystemCountry() {
|
||||
QLocale locale;
|
||||
return locale.name().split('_').last();
|
||||
return QLocale::system().name().split('_').last();
|
||||
}
|
||||
|
||||
QString SystemLanguage() {
|
||||
QLocale locale;
|
||||
return locale.name().split('_').first();
|
||||
const auto system = QLocale::system();
|
||||
const auto languages = system.uiLanguages();
|
||||
return languages.isEmpty()
|
||||
? system.name().split('_').first()
|
||||
: languages.front();
|
||||
}
|
||||
|
||||
QDate WhenSystemBecomesOutdated() {
|
||||
|
|
|
@ -152,7 +152,9 @@ CountrySelectBox::CountrySelectBox(QWidget*)
|
|||
CountrySelectBox::CountrySelectBox(QWidget*, const QString &iso, Type type)
|
||||
: _type(type)
|
||||
, _select(this, st::contactsMultiSelect, tr::lng_country_ph()) {
|
||||
LastValidISO = iso;
|
||||
if (Data::CountriesByISO2().contains(iso)) {
|
||||
LastValidISO = iso;
|
||||
}
|
||||
}
|
||||
|
||||
void CountrySelectBox::prepare() {
|
||||
|
|
Loading…
Reference in New Issue