mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Make experimental settings translatable
This commit is contained in:
@@ -265,5 +265,11 @@
|
||||
"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.",
|
||||
"dummy_last_string": ""
|
||||
}
|
||||
|
@@ -265,5 +265,11 @@
|
||||
"ktg_jump_to_beginning": "Перейти в начало",
|
||||
"ktg_show_calendar": "Показать календарь",
|
||||
"ktg_in_app_update_disabled": "Обновление внутри приложения отключено.",
|
||||
"ktg_experimental_tabbed_panel_by_click": "Панель с вкладками по клику",
|
||||
"ktg_experimental_tabbed_panel_by_click_description": "Показывать панель эмодзи / стикеров / GIF только после клика.",
|
||||
"ktg_experimental_view_profile_context_menu": "Добавить \"Показать профиль\"",
|
||||
"ktg_experimental_view_profile_context_menu_description": "Добавить пункт \"Показать профиль\" в контекстное меню списка чатов.",
|
||||
"ktg_experimental_linux_nvidia_opengl": "OpenGL на драйверах NVIDIA (Linux)",
|
||||
"ktg_experimental_linux_nvidia_opengl_description": "У Qt+OpenGL есть проблемы на Linux с драйверами NVIDIA.",
|
||||
"dummy_last_string": ""
|
||||
}
|
||||
|
@@ -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"
|
||||
@@ -26,13 +27,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
|
||||
@@ -72,7 +94,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()) {
|
||||
AddSkip(container, st::settingsCheckboxesSkip);
|
||||
AddDividerText(container, rpl::single(description));
|
||||
|
Reference in New Issue
Block a user