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