mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-29 05:37:45 +00:00
[Improvement] Experimental settings translation
This commit is contained in:
parent
9854a7a5d5
commit
72e52bd6ec
@ -193,6 +193,12 @@
|
||||
"ktg_jump_to_beginning": "Jump to beginning",
|
||||
"ktg_show_calendar": "Show calendar",
|
||||
"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_about": "This option also enables \"Add \"View Profile\"\" from TDesktop's experimental settings.",
|
||||
"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 "kotato/kotato_lang.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
@ -38,13 +39,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Settings {
|
||||
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(
|
||||
not_null<Window::Controller*> window,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
base::options::option<bool> &option,
|
||||
rpl::producer<> resetClicks) {
|
||||
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>>();
|
||||
std::move(
|
||||
resetClicks
|
||||
@ -87,7 +109,10 @@ void AddOption(
|
||||
}
|
||||
}, 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()) {
|
||||
Ui::AddSkip(container, st::settingsCheckboxesSkip);
|
||||
Ui::AddDividerText(container, rpl::single(description));
|
||||
|
Loading…
x
Reference in New Issue
Block a user