mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 15:45:12 +00:00
[Improvement] Experimental settings translation
This commit is contained in:
committed by
Eric Kotato
parent
15d7dfef92
commit
d9e40d28a7
@@ -182,6 +182,12 @@
|
|||||||
"ktg_jump_to_beginning": "Jump to beginning",
|
"ktg_jump_to_beginning": "Jump to beginning",
|
||||||
"ktg_show_calendar": "Show calendar",
|
"ktg_show_calendar": "Show calendar",
|
||||||
"ktg_in_app_update_disabled": "In-app updater is disabled.",
|
"ktg_in_app_update_disabled": "In-app updater is disabled.",
|
||||||
|
"ktg_experimental_tabbed_panel_by_click": "Show tabbed panel by click",
|
||||||
|
"ktg_experimental_tabbed_panel_by_click_description": "Show Emoji / Stickers / GIFs panel only after a click.",
|
||||||
|
"ktg_experimental_view_profile_context_menu": "Add \"View Profile\"",
|
||||||
|
"ktg_experimental_view_profile_context_menu_description": "Add \"View Profile\" to context menu in chats list",
|
||||||
|
"ktg_experimental_linux_nvidia_opengl": "Allow OpenGL on the NVIDIA drivers (Linux)",
|
||||||
|
"ktg_experimental_linux_nvidia_opengl_description": "Qt+OpenGL have problems on Linux with NVIDIA drivers.",
|
||||||
"ktg_settings_view_profile_on_top": "Show \"View Profile\" first",
|
"ktg_settings_view_profile_on_top": "Show \"View Profile\" first",
|
||||||
"ktg_settings_view_profile_on_top_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.",
|
"ktg_settings_view_profile_on_top_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.",
|
||||||
"ktg_settings_emoji_sidebar": "Enable emoji sidebar",
|
"ktg_settings_emoji_sidebar": "Enable emoji sidebar",
|
||||||
|
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
*/
|
*/
|
||||||
#include "settings/settings_experimental.h"
|
#include "settings/settings_experimental.h"
|
||||||
|
|
||||||
|
#include "kotato/kotato_lang.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
@@ -38,13 +39,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||||||
namespace Settings {
|
namespace Settings {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// format: { key, { name, description }}
|
||||||
|
const std::map<QString, std::pair<QString, QString>> TranslationMap {
|
||||||
|
{ ChatHelpers::kOptionTabbedPanelShowOnClick, {
|
||||||
|
"ktg_experimental_tabbed_panel_by_click",
|
||||||
|
"ktg_experimental_tabbed_panel_by_click_description",
|
||||||
|
}},
|
||||||
|
{ Window::kOptionViewProfileInChatsListContextMenu, {
|
||||||
|
"ktg_experimental_view_profile_context_menu",
|
||||||
|
"ktg_experimental_view_profile_context_menu_description",
|
||||||
|
}},
|
||||||
|
{ Ui::GL::kOptionAllowLinuxNvidiaOpenGL, {
|
||||||
|
"ktg_experimental_linux_nvidia_opengl",
|
||||||
|
"ktg_experimental_linux_nvidia_opengl_description",
|
||||||
|
}},
|
||||||
|
};
|
||||||
|
|
||||||
void AddOption(
|
void AddOption(
|
||||||
not_null<Window::Controller*> window,
|
not_null<Window::Controller*> window,
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
base::options::option<bool> &option,
|
base::options::option<bool> &option,
|
||||||
rpl::producer<> resetClicks) {
|
rpl::producer<> resetClicks) {
|
||||||
auto &lifetime = container->lifetime();
|
auto &lifetime = container->lifetime();
|
||||||
const auto name = option.name().isEmpty() ? option.id() : option.name();
|
const auto translation = TranslationMap.find(option.id());
|
||||||
|
const auto name = translation != TranslationMap.end()
|
||||||
|
? ktr(translation->second.first)
|
||||||
|
: option.name().isEmpty()
|
||||||
|
? option.id()
|
||||||
|
: option.name();
|
||||||
const auto toggles = lifetime.make_state<rpl::event_stream<bool>>();
|
const auto toggles = lifetime.make_state<rpl::event_stream<bool>>();
|
||||||
std::move(
|
std::move(
|
||||||
resetClicks
|
resetClicks
|
||||||
@@ -87,7 +109,10 @@ void AddOption(
|
|||||||
}
|
}
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
const auto &description = option.description();
|
const auto &description = (translation != TranslationMap.end()
|
||||||
|
&& !translation->second.second.isEmpty())
|
||||||
|
? ktr(translation->second.second)
|
||||||
|
: option.description();
|
||||||
if (!description.isEmpty()) {
|
if (!description.isEmpty()) {
|
||||||
Ui::AddSkip(container, st::settingsCheckboxesSkip);
|
Ui::AddSkip(container, st::settingsCheckboxesSkip);
|
||||||
Ui::AddDividerText(container, rpl::single(description));
|
Ui::AddDividerText(container, rpl::single(description));
|
||||||
|
Reference in New Issue
Block a user