mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 23:00:58 +00:00
Use API-provided translations link.
This commit is contained in:
parent
155b8f1c45
commit
93678a07a8
@ -29,7 +29,6 @@ public:
|
|||||||
ConfirmSwitchBox(
|
ConfirmSwitchBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
const MTPDlangPackLanguage &data,
|
const MTPDlangPackLanguage &data,
|
||||||
const QString &editLink,
|
|
||||||
Fn<void()> apply);
|
Fn<void()> apply);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -48,8 +47,7 @@ class NotReadyBox : public BoxContent {
|
|||||||
public:
|
public:
|
||||||
NotReadyBox(
|
NotReadyBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
const MTPDlangPackLanguage &data,
|
const MTPDlangPackLanguage &data);
|
||||||
const QString &editLink);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
@ -63,12 +61,11 @@ private:
|
|||||||
ConfirmSwitchBox::ConfirmSwitchBox(
|
ConfirmSwitchBox::ConfirmSwitchBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
const MTPDlangPackLanguage &data,
|
const MTPDlangPackLanguage &data,
|
||||||
const QString &editLink,
|
|
||||||
Fn<void()> apply)
|
Fn<void()> apply)
|
||||||
: _name(qs(data.vnative_name))
|
: _name(qs(data.vnative_name))
|
||||||
, _percent(data.vtranslated_count.v * 100 / data.vstrings_count.v)
|
, _percent(data.vtranslated_count.v * 100 / data.vstrings_count.v)
|
||||||
, _official(data.is_official())
|
, _official(data.is_official())
|
||||||
, _editLink(editLink)
|
, _editLink(qs(data.vtranslations_url))
|
||||||
, _apply(std::move(apply)) {
|
, _apply(std::move(apply)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,10 +125,9 @@ void ConfirmSwitchBox::prepare() {
|
|||||||
|
|
||||||
NotReadyBox::NotReadyBox(
|
NotReadyBox::NotReadyBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
const MTPDlangPackLanguage &data,
|
const MTPDlangPackLanguage &data)
|
||||||
const QString &editLink)
|
|
||||||
: _name(qs(data.vnative_name))
|
: _name(qs(data.vnative_name))
|
||||||
, _editLink(editLink) {
|
, _editLink(qs(data.vtranslations_url)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotReadyBox::prepare() {
|
void NotReadyBox::prepare() {
|
||||||
@ -456,13 +452,10 @@ void CloudManager::requestLanguageAndSwitch(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
result.match([=](const MTPDlangPackLanguage &data) {
|
result.match([=](const MTPDlangPackLanguage &data) {
|
||||||
const auto link = "https://translations.telegram.org/"
|
|
||||||
+ id
|
|
||||||
+ '/';
|
|
||||||
if (data.vstrings_count.v > 0) {
|
if (data.vstrings_count.v > 0) {
|
||||||
Ui::show(Box<ConfirmSwitchBox>(data, link, finalize));
|
Ui::show(Box<ConfirmSwitchBox>(data, finalize));
|
||||||
} else {
|
} else {
|
||||||
Ui::show(Box<NotReadyBox>(data, link));
|
Ui::show(Box<NotReadyBox>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user