mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-28 16:33:06 +02:00
Try to open localized changelog.
This commit is contained in:
parent
d782ea63f8
commit
e8affa85b0
5 changed files with 38 additions and 3 deletions
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
#include "core/update_checker.h"
|
#include "core/update_checker.h"
|
||||||
|
#include "core/application.h"
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ void AboutBox::showVersionHistory() {
|
||||||
|
|
||||||
Ui::show(Box<InformBox>("The link to the current private alpha version of Telegram Desktop was copied to the clipboard."));
|
Ui::show(Box<InformBox>("The link to the current private alpha version of Telegram Desktop was copied to the clipboard."));
|
||||||
} else {
|
} else {
|
||||||
UrlClickHandler::Open(qsl("https://desktop.telegram.org/changelog"));
|
UrlClickHandler::Open(Core::App().changelogLink());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -764,6 +764,39 @@ bool Application::openInternalUrl(const QString &url, QVariant context) {
|
||||||
return openCustomUrl("internal:", InternalUrlHandlers(), url, context);
|
return openCustomUrl("internal:", InternalUrlHandlers(), url, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Application::changelogLink() const {
|
||||||
|
const auto base = u"https://desktop.telegram.org/changelog"_q;
|
||||||
|
const auto languages = {
|
||||||
|
"id",
|
||||||
|
"de",
|
||||||
|
"fr",
|
||||||
|
"nl",
|
||||||
|
"pl",
|
||||||
|
"tr",
|
||||||
|
"uk",
|
||||||
|
"fa",
|
||||||
|
"ru",
|
||||||
|
"ms",
|
||||||
|
"es",
|
||||||
|
"it",
|
||||||
|
"uz",
|
||||||
|
"pt-br",
|
||||||
|
"be",
|
||||||
|
"ar",
|
||||||
|
"ko",
|
||||||
|
};
|
||||||
|
const auto current = _langpack->id().replace("-raw", "");
|
||||||
|
if (current.isEmpty()) {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
for (const auto language : languages) {
|
||||||
|
if (current == language || current.split(u'-')[0] == language) {
|
||||||
|
return base + "?setln=" + language;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
bool Application::openCustomUrl(
|
bool Application::openCustomUrl(
|
||||||
const QString &protocol,
|
const QString &protocol,
|
||||||
const std::vector<LocalUrlHandler> &handlers,
|
const std::vector<LocalUrlHandler> &handlers,
|
||||||
|
|
|
@ -227,6 +227,7 @@ public:
|
||||||
void checkStartUrl();
|
void checkStartUrl();
|
||||||
bool openLocalUrl(const QString &url, QVariant context);
|
bool openLocalUrl(const QString &url, QVariant context);
|
||||||
bool openInternalUrl(const QString &url, QVariant context);
|
bool openInternalUrl(const QString &url, QVariant context);
|
||||||
|
[[nodiscard]] QString changelogLink() const;
|
||||||
|
|
||||||
// Float player.
|
// Float player.
|
||||||
void setDefaultFloatPlayerDelegate(
|
void setDefaultFloatPlayerDelegate(
|
||||||
|
|
|
@ -185,7 +185,7 @@ void Changelogs::addLocalLogs() {
|
||||||
lt_changes,
|
lt_changes,
|
||||||
tr::lng_new_version_minor(tr::now),
|
tr::lng_new_version_minor(tr::now),
|
||||||
lt_link,
|
lt_link,
|
||||||
qsl("https://desktop.telegram.org/changelog"));
|
Core::App().changelogLink());
|
||||||
addLocalLog(text.trimmed());
|
addLocalLog(text.trimmed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -616,7 +616,7 @@ MainMenu::MainMenu(
|
||||||
qsl("https://desktop.telegram.org")));
|
qsl("https://desktop.telegram.org")));
|
||||||
_telegram->setLinksTrusted();
|
_telegram->setLinksTrusted();
|
||||||
_version->setRichText(textcmdLink(1, tr::lng_settings_current_version(tr::now, lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, tr::lng_menu_about(tr::now)));
|
_version->setRichText(textcmdLink(1, tr::lng_settings_current_version(tr::now, lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, tr::lng_menu_about(tr::now)));
|
||||||
_version->setLink(1, std::make_shared<UrlClickHandler>(qsl("https://desktop.telegram.org/changelog")));
|
_version->setLink(1, std::make_shared<UrlClickHandler>(Core::App().changelogLink()));
|
||||||
_version->setLink(2, std::make_shared<LambdaClickHandler>([] { Ui::show(Box<AboutBox>()); }));
|
_version->setLink(2, std::make_shared<LambdaClickHandler>([] { Ui::show(Box<AboutBox>()); }));
|
||||||
|
|
||||||
_controller->session().downloaderTaskFinished(
|
_controller->session().downloaderTaskFinished(
|
||||||
|
|
Loading…
Add table
Reference in a new issue