From 86723ee3a227361bcf59e6f749ec6fed1f356590 Mon Sep 17 00:00:00 2001 From: Vlad Date: Sun, 14 Sep 2025 18:08:57 +0300 Subject: [PATCH 01/20] add support for translating plugin XML files --- meson.build | 4 ++++ src/main.cpp | 2 ++ src/metadata.cpp | 9 +++++++-- src/wcm.cpp | 13 ++++++++----- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index 0d33c4a..5e38af2 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,7 @@ project('wcm', 'c', 'cpp', version : '0.11.0', default_options : 'cpp_std=c++17') +fs = import('fs') + add_global_arguments('-DWAYFIRE_CONFIG_FILE="' + get_option('wayfire_config_file_path') + '"', language : 'cpp') add_global_arguments('-DWF_SHELL_CONFIG_FILE="' + get_option('wf_shell_config_file_path') + '"', language : 'cpp') @@ -7,12 +9,14 @@ wayfire = dependency('wayfire', version: '>=0.11.0') wf_shell = dependency('wf-shell', required : get_option('wf_shell')) wayfire_metadata_dir = wayfire.get_variable(pkgconfig: 'metadatadir') +wayfire_locale_dir = join_paths(fs.parent(wayfire_metadata_dir), 'locale') wayfire_sysconf_dir = wayfire.get_variable(pkgconfig: 'sysconfdir') share_dir = join_paths(get_option('prefix'), 'share') icon_dir = join_paths(share_dir, 'wcm', 'icons') add_global_arguments('-DWAYFIRE_METADATADIR="' + wayfire_metadata_dir + '"', language : 'cpp') +add_global_arguments('-DWAYFIRE_LOCALEDIR="' + wayfire_locale_dir + '"', language : 'cpp') add_global_arguments('-DWAYFIRE_SYSCONFDIR="' + wayfire_sysconf_dir + '"', language : 'cpp') if wf_shell.found() wf_shell_metadata_dir = wf_shell.get_variable(pkgconfig: 'metadatadir') diff --git a/src/main.cpp b/src/main.cpp index ba2ef10..5945b60 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,9 @@ +#include #include int main(int argc, char **argv) { + setlocale(LC_ALL, ""); auto app = Gtk::Application::create("org.gtk.wcm"); std::unique_ptr wcm = std::make_unique(app); return app->run(argc, argv); diff --git a/src/metadata.cpp b/src/metadata.cpp index 269e0b9..51c358f 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -25,6 +25,8 @@ */ #include "wcm.hpp" +#include +#include #include #include @@ -119,12 +121,13 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) } std::string node_name = (char*)node->name; + std::string gettext_domain_name = "plugin-" + plugin->name; if (node_name == "_short") { - this->disp_name = (char*)node->children->content; + this->disp_name = dgettext(gettext_domain_name.c_str(), (char*)node->children->content); } else if (node_name == "_long") { - this->tooltip = (char*)node->children->content; + this->tooltip = dgettext(gettext_domain_name.c_str(), (char*)node->children->content); } else if (node_name == "default") { if (!node->children) @@ -379,6 +382,8 @@ Plugin*Plugin::get_plugin_data(xmlNode *cur_node, Option *main_group, Plugin *pl if (prop) { plugin->name = (char*)prop; + // Initialise translations + bindtextdomain(("plugin-" + plugin->name).c_str(), WAYFIRE_LOCALEDIR); } free(prop); diff --git a/src/wcm.cpp b/src/wcm.cpp index 3db1d66..5c12fb5 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1096,6 +1096,7 @@ OptionGroupWidget::OptionGroupWidget(Option *group) PluginPage::PluginPage(Plugin *plugin) { + std::string gettext_domain_name = "plugin-" + plugin->name; set_scrollable(); for (auto *group : plugin->option_groups) { @@ -1105,7 +1106,7 @@ PluginPage::PluginPage(Plugin *plugin) } groups.emplace_back(group); - append_page(groups.back(), group->name); + append_page(groups.back(), dgettext(gettext_domain_name.c_str(), group->name.c_str())); } } @@ -1138,11 +1139,12 @@ void Plugin::init_widget() } button_layout.pack_start(icon); - label.set_text(disp_name); + std::string gettext_domain_name = "plugin-" + name; + label.set_text(dgettext(gettext_domain_name.c_str(), disp_name.c_str())); label.set_ellipsize(Pango::ELLIPSIZE_END); button_layout.pack_start(label); button_layout.set_halign(Gtk::ALIGN_START); - button.set_tooltip_markup(tooltip); + button.set_tooltip_markup(dgettext(gettext_domain_name.c_str(), tooltip.c_str())); button.set_relief(Gtk::RELIEF_NONE); button.add(button_layout); enabled_check.set_active(enabled); @@ -1600,15 +1602,16 @@ void WCM::create_main_layout() void WCM::open_page(Plugin *plugin) { + std::string gettext_domain_name = "plugin-" + plugin->name; if (plugin) { plugin_enabled_box.set_visible( !plugin->is_core_plugin() && plugin->type != PLUGIN_TYPE_WF_SHELL); plugin_enabled_check.set_active(plugin->enabled); plugin_name_label.set_markup( - "" + plugin->disp_name + ""); + "" + std::string(dgettext(gettext_domain_name.c_str(), plugin->disp_name.c_str())) + ""); plugin_description_label.set_markup( - "" + plugin->tooltip + ""); + "" + std::string(dgettext(gettext_domain_name.c_str(), plugin->tooltip.c_str())) + ""); plugin_page = std::make_unique(plugin); main_stack.add(*plugin_page); plugin_page->show_all(); From 429ff857bfbde325ca47ec2ba019c6a961ae96f4 Mon Sep 17 00:00:00 2001 From: Vlad Date: Sun, 14 Sep 2025 22:31:24 +0300 Subject: [PATCH 02/20] try to add libintl as dependency --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 5e38af2..c22e30a 100644 --- a/meson.build +++ b/meson.build @@ -7,6 +7,7 @@ add_global_arguments('-DWF_SHELL_CONFIG_FILE="' + get_option('wf_shell_config_fi wayfire = dependency('wayfire', version: '>=0.11.0') wf_shell = dependency('wf-shell', required : get_option('wf_shell')) +intl_dependency = dependency('intl') wayfire_metadata_dir = wayfire.get_variable(pkgconfig: 'metadatadir') wayfire_locale_dir = join_paths(fs.parent(wayfire_metadata_dir), 'locale') From 75356e306c1a34dce971ca5c21b44cd057ce3a0d Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 00:14:18 +0300 Subject: [PATCH 03/20] try to fix CI build --- .github/workflows/ci.yaml | 2 +- meson.build | 1 - src/meson.build | 3 ++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4517407..e20de74 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: alpine:edge steps: - - run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja cmake musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json gtk+3.0-dev gtkmm3-dev + - run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja cmake musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json gtk+3.0-dev gtkmm3-dev gettext-dev - name: Wayfire uses: actions/checkout@v2 with: diff --git a/meson.build b/meson.build index c22e30a..5e38af2 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,6 @@ add_global_arguments('-DWF_SHELL_CONFIG_FILE="' + get_option('wf_shell_config_fi wayfire = dependency('wayfire', version: '>=0.11.0') wf_shell = dependency('wf-shell', required : get_option('wf_shell')) -intl_dependency = dependency('intl') wayfire_metadata_dir = wayfire.get_variable(pkgconfig: 'metadatadir') wayfire_locale_dir = join_paths(fs.parent(wayfire_metadata_dir), 'locale') diff --git a/src/meson.build b/src/meson.build index b0c2453..736eeb5 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,8 +2,9 @@ xml = dependency('libxml-2.0', required: true) gtkmm = dependency('gtkmm-3.0', required: true) wf_config = dependency('wf-config', version: '>=0.6.0', required: true) xkbregistry = dependency('xkbregistry', required: true) +libintl = dependency('intl', required: true) -dep_list = [xml, gtkmm, wf_config, wf_protos, evdev, xkbregistry] +dep_list = [xml, gtkmm, wf_config, wf_protos, evdev, xkbregistry, libintl] sources = files('main.cpp', 'metadata.cpp', 'wcm.cpp', 'utils.cpp') From 4058992b50e8bb8544e7c6db01b7a64efae199a1 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Sun, 14 Sep 2025 16:54:42 -0600 Subject: [PATCH 04/20] Attempt to fix build for CI --- .github/workflows/ci.yaml | 2 +- src/wcm.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e20de74..4517407 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: alpine:edge steps: - - run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja cmake musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json gtk+3.0-dev gtkmm3-dev gettext-dev + - run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja cmake musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json gtk+3.0-dev gtkmm3-dev - name: Wayfire uses: actions/checkout@v2 with: diff --git a/src/wcm.cpp b/src/wcm.cpp index 5c12fb5..156c846 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1,6 +1,7 @@ #include "wcm.hpp" #include "utils.hpp" +#include #include #include #include From 06afb61010ac8bc91b359a8a8030cb41a19cdff1 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Sun, 14 Sep 2025 16:59:00 -0600 Subject: [PATCH 05/20] Uncrustify --- src/wcm.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wcm.cpp b/src/wcm.cpp index 156c846..f864811 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1610,9 +1610,11 @@ void WCM::open_page(Plugin *plugin) !plugin->is_core_plugin() && plugin->type != PLUGIN_TYPE_WF_SHELL); plugin_enabled_check.set_active(plugin->enabled); plugin_name_label.set_markup( - "" + std::string(dgettext(gettext_domain_name.c_str(), plugin->disp_name.c_str())) + ""); + "" + + std::string(dgettext(gettext_domain_name.c_str(), plugin->disp_name.c_str())) + ""); plugin_description_label.set_markup( - "" + std::string(dgettext(gettext_domain_name.c_str(), plugin->tooltip.c_str())) + ""); + "" + + std::string(dgettext(gettext_domain_name.c_str(), plugin->tooltip.c_str())) + ""); plugin_page = std::make_unique(plugin); main_stack.add(*plugin_page); plugin_page->show_all(); From 638ff304e6335d57824e497cec983962bbeadc45 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 10:45:02 +0300 Subject: [PATCH 06/20] translate the wcm's own UI --- .github/workflows/ci.yaml | 2 +- locale/ro_RO/LC_MESSAGES/wcm.mo | Bin 0 -> 3585 bytes locale/ro_RO/LC_MESSAGES/wcm.po | 238 ++++++++++++++++++++++++++++++++ locale/wcm.pot | 234 +++++++++++++++++++++++++++++++ meson.build | 9 +- src/main.cpp | 3 + src/meson.build | 3 +- src/metadata.cpp | 6 +- src/wcm.cpp | 104 +++++++------- src/wcm.hpp | 36 ++--- 10 files changed, 567 insertions(+), 68 deletions(-) create mode 100644 locale/ro_RO/LC_MESSAGES/wcm.mo create mode 100644 locale/ro_RO/LC_MESSAGES/wcm.po create mode 100644 locale/wcm.pot diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4517407..dbcc9fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: alpine:edge steps: - - run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja cmake musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json gtk+3.0-dev gtkmm3-dev + - run: apk --no-cache add git gcc g++ binutils pkgconf meson ninja cmake musl-dev wayland-dev wayland-protocols libinput-dev libevdev-dev libxkbcommon-dev pixman-dev glm-dev libdrm-dev mesa-dev cairo-dev pango-dev eudev-dev libxml2-dev glibmm-dev libseat-dev libdisplay-info-dev hwdata-dev nlohmann-json gtk+3.0-dev gtkmm3-dev gettext-dev fmt-dev - name: Wayfire uses: actions/checkout@v2 with: diff --git a/locale/ro_RO/LC_MESSAGES/wcm.mo b/locale/ro_RO/LC_MESSAGES/wcm.mo new file mode 100644 index 0000000000000000000000000000000000000000..79e41fe8797c1dab0e4eaaa089eeaaad479a2712 GIT binary patch literal 3585 zcmb7`ON<>y6^1KdzzhU}c|To162^FXJRW153?|Chp0P&Cct-QUmLkO|ch|jBcHgS2 z?&^7XWC>vj3GrGWFA_^ZY#<9HVpc)Q0)&aYiP)H30A&#=3)rA6K+1ye^kZgXUZQoY zzpmcLy9KH`OL4N8fZZa-|AAmXhB;1Dk;SDI`o`cfw z1^9mWVq5vy5p_bU7}{0kKO_S5ML@P7DtI01R3mY~dg0e%WT4f&~UZesVh zpxFB(DC_>Xt^XW~9xuXAz?Y%S_hzWV4>Gy*I|Rk96HwMW%k9H(0gBEkl=ZJd z+3yYbUidR8<8DEj?>8`kFGJbioA5Av0I~iKPr`@baR&2BJqbnE6pEb%JOIDjzJCsi z&Oe3x)GxS=!(TzM?+y4-_!g9L2S%Fy549YJGXDuEew&4KRZl}1cNvN<--I&Xw;|G~ zXIuUR%KFbkndcUief_#^e-%DT{dM>ico1jE_!TIAd6L_gU?0l5KZN4vXQ24+B`E8@ z($-&tqVM0J=)Di8%KL+G6&{0f1ik~sZ{LUFpPNwT|0Vo5dlff0^{3z%d>+cUKR}LNJr`4`qZB!hqJh{YePkZF4pGDg(dih4p|y5Ey@MkA z5g&_va(%Xe`eIALLCWVSAE6wfbQf}{FH^*a5@({Z#DQEAe-cX%QbsAVzpqj>1-I0G z0kv+z?mFH*z=tUk58{)A(p?g(qQ@jf&ZS%uXQH|Iae^W_N{yZidJr<#bG9h;u&`xm zvqNgs2X7Cl=`^LmU2?gLTWUJXw6_~N4TFL4nVQZw%vPyRne>V}<$UIRU!68SwYk8D zsC%?BY3LVbpijp5*hc2cVa}+NN2saOYax_YpK*mvV<@(|hM7&9R?%F_ZPzmEU)>o-sr;RVi-mj{6&sf&uw1Qd)^Q-cJrEA zEW%|RlFVhvH#m%Rp3)gj(?^h_6tXMPHQ=igBxVW@1GCwyzv%CJ$ z@re99M8thA45lSa4B9EcyXiWvLXTuYL5Lv_yX, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-15 01:08+0300\n" +"PO-Revision-Date: 2025-09-15 10:22+0300\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: ro_RO\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.7\n" + +#: src/metadata.cpp:382 +msgid "Uncategorized" +msgstr "Necategorizat" + +#: src/metadata.cpp:411 src/wcm.hpp:83 +msgid "General" +msgstr "Generale" + +#: src/wcm.cpp:65 +msgid "Waiting for Binding" +msgstr "Se așteaptă asocierea" + +#: src/wcm.cpp:66 +msgid "none" +msgstr "nimic" + +#: src/wcm.cpp:102 +msgid "(No modifiers pressed)" +msgstr "(Fără taste modificatoare apăsate)" + +#: src/wcm.cpp:199 +msgid "Edit binding" +msgstr "Editează asocierea" + +#: src/wcm.cpp:210 +msgid "Save binding" +msgstr "Salvează asocierea" + +#: src/wcm.cpp:221 src/wcm.cpp:575 src/wcm.cpp:697 +msgid "Cancel" +msgstr "Anulează" + +#: src/wcm.cpp:257 +msgid "Open context menu to choose layout" +msgstr "Deschideți meniul contextual pentru a alege aranjamentul" + +#: src/wcm.cpp:282 +msgid "Open context menu to choose model" +msgstr "Deschideți meniul contextual pentru a alege modelul" + +#: src/wcm.cpp:369 +msgid "Reset to default" +msgstr "Resetează la opțiunile implicite" + +#: src/wcm.cpp:576 src/wcm.cpp:698 +msgid "Open" +msgstr "Deschide" + +#: src/wcm.cpp:586 +msgid "Choose Directory" +msgstr "Alegeți directorul" + +#: src/wcm.cpp:590 +msgid "Select Folder" +msgstr "Alegeți director" + +#: src/wcm.cpp:600 +msgid "Choose File" +msgstr "Alegeți fișierul" + +#: src/wcm.cpp:604 +msgid "Select File" +msgstr "Alegeți fișier" + +#: src/wcm.cpp:693 src/wcm.cpp:696 +msgid "Choose Executable" +msgstr "Alegeți executabilul" + +#: src/wcm.cpp:705 +msgid "Run command" +msgstr "Execută comanda" + +#: src/wcm.cpp:711 +msgid "Remove from autostart list" +msgstr "Elimină din lista de pornire automată" + +#: src/wcm.cpp:773 +msgid "Regular" +msgstr "Obișnuită" + +#: src/wcm.cpp:774 +msgid "Repeat" +msgstr "Repetată" + +#: src/wcm.cpp:775 +msgid "Always" +msgstr "Mereu disponibilă" + +#: src/wcm.cpp:800 +msgid "Command {name}" +msgstr "Comanda {name}" + +#: src/wcm.cpp:803 +msgid "Command {name}: {command}" +msgstr "Comanda {name}: {command}" + +#: src/wcm.cpp:851 +msgid "Workspace Index" +msgstr "Indicele biroului" + +#: src/wcm.cpp:904 +msgid "Add new command" +msgstr "Adaugă o nouă comandă" + +#: src/wcm.cpp:978 +msgid "Go To Workspace" +msgstr "Treci la birou" + +#: src/wcm.cpp:981 +msgid "Go To Workspace With Window" +msgstr "Treci la birou cu fereastra" + +#: src/wcm.cpp:984 +msgid "Send Window To Workspace" +msgstr "Trimite fereastra pe birou" + +#: src/wcm.cpp:1010 src/wcm.cpp:1018 +msgid "{workspace_option_prefix} {workspace_index}" +msgstr "{workspace_option_prefix} {workspace_index}" + +#: src/wcm.cpp:1327 +msgid "Wayfire config file to use" +msgstr "fișierul de configurare Wayfire de folosit" + +#: src/wcm.cpp:1332 +msgid "wf-shell config file to use" +msgstr "fișierul de configurare wf-shell de folosit" + +#: src/wcm.cpp:1337 +msgid "plugin to open at launch, or none for default" +msgstr "" +"modul care să se deschidă la lansare, sau none pentru valoarea standard" + +#: src/wcm.cpp:1364 +msgid "Wayfire Config Manager" +msgstr "Administratorul configurărilor Wayfire" + +#: src/wcm.cpp:1437 +msgid "To use input binding capture, enable shortcuts-inhibit plugin." +msgstr "" +"Pentru a folosi captarea asocierilor de intrare, activați modulul shortcuts-" +"inhibit." + +#: src/wcm.cpp:1530 +msgid "Filter" +msgstr "Filtru" + +#: src/wcm.cpp:1564 +msgid "Cannot find program wdisplays" +msgstr "Nu se poate găsi programul wdisplays" + +#: src/wcm.hpp:84 +msgid "Accessibility" +msgstr "Accesibilitate" + +#: src/wcm.hpp:85 +msgid "Desktop" +msgstr "Birou" + +#: src/wcm.hpp:85 +msgid "Shell" +msgstr "Interfața biroului" + +#: src/wcm.hpp:86 +msgid "Effects" +msgstr "Efecte" + +#: src/wcm.hpp:87 +msgid "Window Management" +msgstr "Gestionarea ferestrelor" + +#: src/wcm.hpp:88 +msgid "Utility" +msgstr "Utilitare" + +#: src/wcm.hpp:88 +msgid "Other" +msgstr "Altele" + +#: src/wcm.hpp:94 +msgid "(none)" +msgstr "(nimic)" + +#: src/wcm.hpp:215 +msgid "Command:" +msgstr "Comandă:" + +#: src/wcm.hpp:221 +msgid "Type" +msgstr "Tip" + +#: src/wcm.hpp:222 +msgid "Binding" +msgstr "Asociere" + +#: src/wcm.hpp:223 +msgid "Command" +msgstr "Comandă" + +#: src/wcm.hpp:254 +msgid "Workspace" +msgstr "Birou" + +#: src/wcm.hpp:338 +msgid "Close" +msgstr "Închide" + +#: src/wcm.hpp:340 +msgid "Configure Outputs" +msgstr "Configurează ieșiri" + +#: src/wcm.hpp:347 +msgid "Use This Plugin" +msgstr "Folosește acest modul" + +#: src/wcm.hpp:348 +msgid "Back" +msgstr "Înapoi" diff --git a/locale/wcm.pot b/locale/wcm.pot new file mode 100644 index 0000000..742e012 --- /dev/null +++ b/locale/wcm.pot @@ -0,0 +1,234 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-09-15 01:08+0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/metadata.cpp:382 +msgid "Uncategorized" +msgstr "" + +#: src/metadata.cpp:411 src/wcm.hpp:83 +msgid "General" +msgstr "" + +#: src/wcm.cpp:65 +msgid "Waiting for Binding" +msgstr "" + +#: src/wcm.cpp:66 +msgid "none" +msgstr "" + +#: src/wcm.cpp:102 +msgid "(No modifiers pressed)" +msgstr "" + +#: src/wcm.cpp:199 +msgid "Edit binding" +msgstr "" + +#: src/wcm.cpp:210 +msgid "Save binding" +msgstr "" + +#: src/wcm.cpp:221 src/wcm.cpp:575 src/wcm.cpp:697 +msgid "Cancel" +msgstr "" + +#: src/wcm.cpp:257 +msgid "Open context menu to choose layout" +msgstr "" + +#: src/wcm.cpp:282 +msgid "Open context menu to choose model" +msgstr "" + +#: src/wcm.cpp:369 +msgid "Reset to default" +msgstr "" + +#: src/wcm.cpp:576 src/wcm.cpp:698 +msgid "Open" +msgstr "" + +#: src/wcm.cpp:586 +msgid "Choose Directory" +msgstr "" + +#: src/wcm.cpp:590 +msgid "Select Folder" +msgstr "" + +#: src/wcm.cpp:600 +msgid "Choose File" +msgstr "" + +#: src/wcm.cpp:604 +msgid "Select File" +msgstr "" + +#: src/wcm.cpp:693 src/wcm.cpp:696 +msgid "Choose Executable" +msgstr "" + +#: src/wcm.cpp:705 +msgid "Run command" +msgstr "" + +#: src/wcm.cpp:711 +msgid "Remove from autostart list" +msgstr "" + +#: src/wcm.cpp:773 +msgid "Regular" +msgstr "" + +#: src/wcm.cpp:774 +msgid "Repeat" +msgstr "" + +#: src/wcm.cpp:775 +msgid "Always" +msgstr "" + +#: src/wcm.cpp:800 +msgid "Command {name}" +msgstr "" + +#: src/wcm.cpp:803 +msgid "Command {name}: {command}" +msgstr "" + +#: src/wcm.cpp:851 +msgid "Workspace Index" +msgstr "" + +#: src/wcm.cpp:904 +msgid "Add new command" +msgstr "" + +#: src/wcm.cpp:978 +msgid "Go To Workspace" +msgstr "" + +#: src/wcm.cpp:981 +msgid "Go To Workspace With Window" +msgstr "" + +#: src/wcm.cpp:984 +msgid "Send Window To Workspace" +msgstr "" + +#: src/wcm.cpp:1010 src/wcm.cpp:1018 +msgid "{workspace_option_prefix} {workspace_index}" +msgstr "" + +#: src/wcm.cpp:1327 +msgid "Wayfire config file to use" +msgstr "" + +#: src/wcm.cpp:1332 +msgid "wf-shell config file to use" +msgstr "" + +#: src/wcm.cpp:1337 +msgid "plugin to open at launch, or none for default" +msgstr "" + +#: src/wcm.cpp:1364 +msgid "Wayfire Config Manager" +msgstr "" + +#: src/wcm.cpp:1437 +msgid "To use input binding capture, enable shortcuts-inhibit plugin." +msgstr "" + +#: src/wcm.cpp:1530 +msgid "Filter" +msgstr "" + +#: src/wcm.cpp:1564 +msgid "Cannot find program wdisplays" +msgstr "" + +#: src/wcm.hpp:84 +msgid "Accessibility" +msgstr "" + +#: src/wcm.hpp:85 +msgid "Desktop" +msgstr "" + +#: src/wcm.hpp:85 +msgid "Shell" +msgstr "" + +#: src/wcm.hpp:86 +msgid "Effects" +msgstr "" + +#: src/wcm.hpp:87 +msgid "Window Management" +msgstr "" + +#: src/wcm.hpp:88 +msgid "Utility" +msgstr "" + +#: src/wcm.hpp:88 +msgid "Other" +msgstr "" + +#: src/wcm.hpp:94 +msgid "(none)" +msgstr "" + +#: src/wcm.hpp:215 +msgid "Command:" +msgstr "" + +#: src/wcm.hpp:221 +msgid "Type" +msgstr "" + +#: src/wcm.hpp:222 +msgid "Binding" +msgstr "" + +#: src/wcm.hpp:223 +msgid "Command" +msgstr "" + +#: src/wcm.hpp:254 +msgid "Workspace" +msgstr "" + +#: src/wcm.hpp:338 +msgid "Close" +msgstr "" + +#: src/wcm.hpp:340 +msgid "Configure Outputs" +msgstr "" + +#: src/wcm.hpp:347 +msgid "Use This Plugin" +msgstr "" + +#: src/wcm.hpp:348 +msgid "Back" +msgstr "" diff --git a/meson.build b/meson.build index 5e38af2..36a47ad 100644 --- a/meson.build +++ b/meson.build @@ -9,10 +9,10 @@ wayfire = dependency('wayfire', version: '>=0.11.0') wf_shell = dependency('wf-shell', required : get_option('wf_shell')) wayfire_metadata_dir = wayfire.get_variable(pkgconfig: 'metadatadir') -wayfire_locale_dir = join_paths(fs.parent(wayfire_metadata_dir), 'locale') wayfire_sysconf_dir = wayfire.get_variable(pkgconfig: 'sysconfdir') share_dir = join_paths(get_option('prefix'), 'share') +wayfire_locale_dir = join_paths(share_dir, 'locale') icon_dir = join_paths(share_dir, 'wcm', 'icons') add_global_arguments('-DWAYFIRE_METADATADIR="' + wayfire_metadata_dir + '"', language : 'cpp') @@ -37,3 +37,10 @@ subdir('proto') subdir('src') install_data('wcm.desktop', install_dir: join_paths(share_dir, 'applications')) + +message(wayfire_locale_dir) + +install_subdir('locale', + install_dir : wayfire_locale_dir, + strip_directory : true +) diff --git a/src/main.cpp b/src/main.cpp index 5945b60..b8007f2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,9 +1,12 @@ +#include #include #include int main(int argc, char **argv) { setlocale(LC_ALL, ""); + bindtextdomain("wcm", WAYFIRE_LOCALEDIR); + textdomain("wcm"); auto app = Gtk::Application::create("org.gtk.wcm"); std::unique_ptr wcm = std::make_unique(app); return app->run(argc, argv); diff --git a/src/meson.build b/src/meson.build index 736eeb5..9700a30 100644 --- a/src/meson.build +++ b/src/meson.build @@ -3,8 +3,9 @@ gtkmm = dependency('gtkmm-3.0', required: true) wf_config = dependency('wf-config', version: '>=0.6.0', required: true) xkbregistry = dependency('xkbregistry', required: true) libintl = dependency('intl', required: true) +libfmt = dependency('fmt', required: true) -dep_list = [xml, gtkmm, wf_config, wf_protos, evdev, xkbregistry, libintl] +dep_list = [xml, gtkmm, wf_config, wf_protos, evdev, xkbregistry, libintl, libfmt] sources = files('main.cpp', 'metadata.cpp', 'wcm.cpp', 'utils.cpp') diff --git a/src/metadata.cpp b/src/metadata.cpp index 51c358f..21b172f 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -30,6 +30,8 @@ #include #include +#define _(MSG) gettext(MSG) + Option::Option(xmlNode *cur_node, Plugin *plugin) { xmlNode *node; @@ -377,7 +379,7 @@ Plugin*Plugin::get_plugin_data(xmlNode *cur_node, Option *main_group, Plugin *pl if (cur_node_name == "plugin") { plugin = new Plugin(); - plugin->category = "Uncategorized"; + plugin->category = _("Uncategorized"); prop = xmlGetProp(cur_node, (xmlChar*)"name"); if (prop) { @@ -406,7 +408,7 @@ Plugin*Plugin::get_plugin_data(xmlNode *cur_node, Option *main_group, Plugin *pl if (!main_group) { main_group = new Option(OPTION_TYPE_GROUP, plugin); - main_group->name = "General"; + main_group->name = _("General"); plugin->option_groups.push_back(main_group); } diff --git a/src/wcm.cpp b/src/wcm.cpp index f864811..36f7701 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1,9 +1,10 @@ #include "wcm.hpp" #include "utils.hpp" -#include #include +#include #include +#include #include #include #include @@ -11,6 +12,7 @@ #include #define OUTPUT_CONFIG_PROGRAM "wdisplays" +#define _(MSG) gettext(MSG) constexpr int OPTION_LABEL_SIZE = 200; @@ -20,9 +22,9 @@ bool KeyEntry::check_and_confirm(const std::string & key_str) ((key_str.find("BTN") != std::string::npos) || (key_str.find("KEY") != std::string::npos))) { - auto dialog = Gtk::MessageDialog("Attempting to bind \"" + key_str + '"' + + auto dialog = Gtk::MessageDialog(_(("Attempting to bind \"" + key_str + '"' + " without modifier. You will be unable to use this key/button " - "for anything else! Are you sure?", + "for anything else! Are you sure?").c_str()), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO); return dialog.run() == Gtk::RESPONSE_YES; } @@ -60,8 +62,8 @@ std::string KeyEntry::grab_key() { static const auto HW_OFFSET = 8; - auto grab_dialog = Gtk::Dialog("Waiting for Binding", true); - auto label = Gtk::Label("none"); + auto grab_dialog = Gtk::Dialog(_("Waiting for Binding"), true); + auto label = Gtk::Label(_("none")); grab_dialog.get_content_area()->pack_start(label); label.show(); @@ -97,7 +99,7 @@ std::string KeyEntry::grab_key() auto update_label = [=, &label] { const auto text = cur_state_string(); - label.set_text(text.empty() ? "(No modifiers pressed)" : text); + label.set_text(text.empty() ? _("(No modifiers pressed)") : text); }; update_label(); @@ -194,7 +196,7 @@ KeyEntry::KeyEntry() } }); edit_button.set_image_from_icon_name("gtk-edit"); - edit_button.set_tooltip_text("Edit binding"); + edit_button.set_tooltip_text(_("Edit binding")); edit_button.signal_clicked().connect([=] { entry.set_text(get_value()); @@ -205,7 +207,7 @@ KeyEntry::KeyEntry() edit_layout.pack_start(entry, true, true); ok_button.set_image_from_icon_name("gtk-ok"); - ok_button.set_tooltip_text("Save binding"); + ok_button.set_tooltip_text(_("Save binding")); ok_button.signal_clicked().connect([=] { const std::string value = entry.get_text(); @@ -216,7 +218,7 @@ KeyEntry::KeyEntry() } }); cancel_button.set_image_from_icon_name("gtk-cancel"); - cancel_button.set_tooltip_text("Cancel"); + cancel_button.set_tooltip_text(_("Cancel")); cancel_button.signal_clicked().connect([=] { set_visible_child(grab_layout); }); edit_layout.pack_start(cancel_button, false, false); edit_layout.pack_start(ok_button, false, false); @@ -252,7 +254,7 @@ LayoutsEntry::LayoutsEntry() }); } - set_tooltip_text("Open context menu to choose layout"); + set_tooltip_text(_("Open context menu to choose layout")); signal_populate_popup().connect([&] (Gtk::Menu *menu) { @@ -277,7 +279,7 @@ XkbModelEntry::XkbModelEntry() }); } - set_tooltip_text("Open context menu to choose model"); + set_tooltip_text(_("Open context menu to choose model")); signal_populate_popup().connect([&] (Gtk::Menu *menu) { @@ -364,7 +366,7 @@ OptionWidget::OptionWidget(Option *option) : Gtk::Box(Gtk::ORIENTATION_HORIZONTA name_label.set_alignment(Gtk::ALIGN_START); reset_button.set_image_from_icon_name("edit-clear"); - reset_button.set_tooltip_text("Reset to default"); + reset_button.set_tooltip_text(_("Reset to default")); pack_start(name_label, false, false); Gtk::Box::pack_end(reset_button, false, false); @@ -570,8 +572,8 @@ OptionWidget::OptionWidget(Option *option) : Gtk::Box(Gtk::ORIENTATION_HORIZONTA Gtk::FileChooserAction action) { auto dialog = Gtk::FileChooserDialog(label, action); - dialog.add_button("Cancel", Gtk::RESPONSE_CANCEL); - dialog.add_button("Open", Gtk::RESPONSE_ACCEPT); + dialog.add_button(_("Cancel"), Gtk::RESPONSE_CANCEL); + dialog.add_button(_("Open"), Gtk::RESPONSE_ACCEPT); if (dialog.run() == Gtk::RESPONSE_ACCEPT) { widget->set_text(dialog.get_filename()); @@ -581,11 +583,11 @@ OptionWidget::OptionWidget(Option *option) : Gtk::Box(Gtk::ORIENTATION_HORIZONTA { auto dir_choose_button = std::make_unique(); dir_choose_button->set_image_from_icon_name("folder-open"); - dir_choose_button->set_tooltip_text("Choose Directory"); + dir_choose_button->set_tooltip_text(_("Choose Directory")); dir_choose_button->signal_clicked().connect( [=] { - run_dialog("Select Folder", + run_dialog(_("Select Folder"), Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); }); pack_end(std::move(dir_choose_button)); @@ -595,11 +597,11 @@ OptionWidget::OptionWidget(Option *option) : Gtk::Box(Gtk::ORIENTATION_HORIZONTA { auto file_choose_button = std::make_unique(); file_choose_button->set_image_from_icon_name("text-x-generic"); - file_choose_button->set_tooltip_text("Choose File"); + file_choose_button->set_tooltip_text(_("Choose File")); file_choose_button->signal_clicked().connect( [=] { - run_dialog("Select File", Gtk::FILE_CHOOSER_ACTION_OPEN); + run_dialog(_("Select File"), Gtk::FILE_CHOOSER_ACTION_OPEN); }); pack_end(std::move(file_choose_button)); } @@ -688,25 +690,25 @@ AutostartDynamicList::AutostartWidget::AutostartWidget(Option *option) : Gtk::Bo option->set_save(command_entry.get_text()); }); choose_button.set_image_from_icon_name("application-x-executable"); - choose_button.set_tooltip_text("Choose Executable"); + choose_button.set_tooltip_text(_("Choose Executable")); choose_button.signal_clicked().connect([&] { - auto dialog = Gtk::FileChooserDialog("Choose Executable"); - dialog.add_button("Cancel", Gtk::RESPONSE_CANCEL); - dialog.add_button("Open", Gtk::RESPONSE_ACCEPT); + auto dialog = Gtk::FileChooserDialog(_("Choose Executable")); + dialog.add_button(_("Cancel"), Gtk::RESPONSE_CANCEL); + dialog.add_button(_("Open"), Gtk::RESPONSE_ACCEPT); if (dialog.run() == Gtk::RESPONSE_ACCEPT) { command_entry.set_text(dialog.get_filename()); } }); run_button.set_image_from_icon_name("media-playback-start"); - run_button.set_tooltip_text("Run command"); + run_button.set_tooltip_text(_("Run command")); run_button.signal_clicked().connect([=] { Glib::spawn_command_line_async(command_entry.get_text()); }); remove_button.set_image_from_icon_name("list-remove"); - remove_button.set_tooltip_text("Remove from autostart list"); + remove_button.set_tooltip_text(_("Remove from autostart list")); remove_button.signal_clicked().connect([=] { auto section = WCM::get_instance()->get_config_section(option->plugin); @@ -768,9 +770,9 @@ BindingsDynamicList::BindingWidget::BindingWidget(const std::string & cmd_name, type_label.set_size_request(OPTION_LABEL_SIZE); type_label.set_alignment(Gtk::ALIGN_START); type_box.pack_start(type_label, false, false); - type_combo_box.append("Regular"); - type_combo_box.append("Repeat"); - type_combo_box.append("Always"); + type_combo_box.append(_("Regular")); + type_combo_box.append(_("Repeat")); + type_combo_box.append(_("Always")); type_combo_box.set_active(always_opt ? 2 : repeatable_opt ? 1 : 0); type_combo_box.signal_changed().connect([=] { @@ -795,10 +797,12 @@ BindingsDynamicList::BindingWidget::BindingWidget(const std::string & cmd_name, command_label.set_size_request(OPTION_LABEL_SIZE); command_label.set_alignment(Gtk::ALIGN_START); command_box.pack_start(command_label, false, false); - expander.set_label("Command " + cmd_name); + expander.set_label(fmt::format(_("Command {name}"), fmt::arg("name", cmd_name))); command_entry.signal_changed().connect([=] { - expander.set_label("Command " + cmd_name + ": " + command_entry.get_text()); + expander.set_label(fmt::format(_("Command {name}: {command}"), + fmt::arg("name", cmd_name), + fmt::arg("command", command_entry.get_text().c_str()))); auto *label = (Gtk::Label*)expander.get_label_widget(); label->set_ellipsize(Pango::ELLIPSIZE_END); label->set_tooltip_text(command_entry.get_text()); @@ -844,7 +848,7 @@ VswitchBindingsDynamicList::BindingWidget::BindingWidget(std::shared_ptrsave_config(option->plugin); }); - workspace_spin_button.set_tooltip_text("Workspace Index"); + workspace_spin_button.set_tooltip_text(_("Workspace Index")); workspace_spin_button.set_value(workspace_index); workspace_spin_button.signal_value_changed().connect([=] { @@ -897,7 +901,7 @@ AutostartDynamicList::AutostartDynamicList(Option *option) pack_widget(std::make_unique(dyn_opt)); } - add_button.set_tooltip_text("Add new command"); + add_button.set_tooltip_text(_("Add new command")); add_button.signal_clicked().connect([=] { static const std::string prefix = "autostart"; @@ -971,13 +975,13 @@ const std::string VswitchBindingsDynamicList::O template<> const std::string VswitchBindingsDynamicList::OPTION_PREFIX = "send_win_"; template<> -const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = "Go To Workspace"; +const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = _("Go To Workspace"); template<> const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = - "Go To Workspace With Window"; + _("Go To Workspace With Window"); template<> const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = - "Send Window To Workspace"; + _("Send Window To Workspace"); template VswitchBindingsDynamicList::VswitchBindingsDynamicList(Option *option) @@ -1003,13 +1007,19 @@ VswitchBindingsDynamicList::VswitchBindingsDynamicList(Option *option) add_button.signal_clicked().connect([=] { int workspace_index = 1; - while (section->get_option_or(OPTION_PREFIX + std::to_string(workspace_index))) + while (section->get_option_or(fmt::format(_("{workspace_option_prefix} {workspace_index}"), + fmt::arg("workspace_option_prefix", OPTION_PREFIX), + fmt::arg("workspace_index", std::to_string(workspace_index))))) { ++workspace_index; } - Option *binding_option = - option->create_child_option(OPTION_PREFIX + std::to_string(workspace_index), OPTION_TYPE_STRING); + Option *binding_option = option->create_child_option( + fmt::format(_("{workspace_option_prefix} {workspace_index}"), + fmt::arg("workspace_option_prefix", OPTION_PREFIX), + fmt::arg("workspace_index", std::to_string(workspace_index))), + OPTION_TYPE_STRING + ); section->register_new_option(std::make_shared>(binding_option->name, "")); pack_widget(std::make_unique(section, binding_option, workspace_index)); @@ -1021,7 +1031,7 @@ VswitchBindingsDynamicList::VswitchBindingsDynamicList(Option *option) template VswitchBindingsWidget::VswitchBindingsWidget(Option *option) : dynamic_list(option) { - set_label(LABEL_TEXT + " Bindings"); + set_label(fmt::format("{option_name} Bindings", fmt::arg("option_name", LABEL_TEXT.c_str()))); dynamic_list.property_margin().set_value(5); add(dynamic_list); } @@ -1183,7 +1193,7 @@ MainPage::MainPage(const std::vector & plugins) : plugins(plugins) std::find_if(categories.begin(), categories.end() - 1, [=] (const Category & cat) { - return cat.name == plugin->category; + return cat.name == Glib::ustring(_(plugin->category.c_str())); })->add_plugin(plugin); size_group->add_widget(plugin->widget); } @@ -1214,7 +1224,7 @@ void MainPage::set_filter(const Glib::ustring & filter) find_string(plug->tooltip, filter); // the parent of `plug->widget` is `Gtk::FlowBoxItem` plug->widget.get_parent()->set_visible(plug_visible); - category_visible[plug->category] |= plug_visible; + category_visible[_(plug->category.c_str())] |= plug_visible; } categories[0].vbox.set_visible(category_visible[categories[0].name]); @@ -1314,17 +1324,17 @@ WCM::WCM(Glib::RefPtr app) { wf_config_file = value; return true; - }, "config", 'c', "Wayfire config file to use", "file"); + }, "config", 'c', _("Wayfire config file to use"), "file"); app->add_main_option_entry([this] (const Glib::ustring &, const Glib::ustring & value, bool) { wf_shell_config_file = value; return true; - }, "shell-config", 's', "wf-shell config file to use", "file"); + }, "shell-config", 's', _("wf-shell config file to use"), "file"); app->add_main_option_entry([this] (const Glib::ustring &, const Glib::ustring & value, bool) { start_plugin = value; return true; - }, "plugin", 'p', "plugin to open at launch, or none for default", "name"); + }, "plugin", 'p', _("plugin to open at launch, or none for default"), "name"); app->signal_startup().connect([this, app] () { @@ -1351,7 +1361,7 @@ WCM::WCM(Glib::RefPtr app) window->set_icon(icon); window->set_size_request(750, 550); window->set_default_size(1000, 580); - window->set_title("Wayfire Config Manager"); + window->set_title(_("Wayfire Config Manager")); create_main_layout(); window->show_all(); }); @@ -1424,7 +1434,7 @@ bool WCM::lock_input(Gtk::Dialog *grab_dialog) auto error_dialog = Gtk::Dialog( "Compositor does not advertise zwp_keyboard_shortcuts_inhibit_manager_v1!", *window, Gtk::DIALOG_DESTROY_WITH_PARENT); - auto label = Gtk::Label("To use input binding capture, enable shortcuts-inhibit plugin."); + auto label = Gtk::Label(_("To use input binding capture, enable shortcuts-inhibit plugin.")); error_dialog.get_content_area()->pack_start(label, true, true, 50); error_dialog.add_button("Ok", 0); label.show(); @@ -1517,7 +1527,7 @@ void WCM::create_main_layout() main_page = std::make_unique(plugins); filter_label.property_margin().set_value(10); - filter_label.set_markup("Filter"); + filter_label.set_markup("" + std::string(_("Filter")) + ""); main_left_panel_layout.pack_start(filter_label, false, false); search_entry.property_margin().set_value(10); @@ -1551,7 +1561,7 @@ void WCM::create_main_layout() { output_config_button.set_sensitive(false); output_config_button.set_tooltip_markup( - "Cannot find program wdisplays"); + _("Cannot find program wdisplays")); } plugin_left_panel_layout.pack_start(plugin_name_label, false, false); diff --git a/src/wcm.hpp b/src/wcm.hpp index d75478b..d39bda8 100644 --- a/src/wcm.hpp +++ b/src/wcm.hpp @@ -31,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -39,6 +41,8 @@ #include "metadata.hpp" +#define _(MSG) gettext(MSG) + struct animate_option { Option *option; @@ -76,18 +80,18 @@ class MainPage : public Gtk::ScrolledWindow Gtk::SIZE_GROUP_BOTH); std::array separators; std::array categories = { - Category{"General", "preferences-system"}, - {"Accessibility", "preferences-desktop-accessibility"}, - {"Desktop", "preferences-desktop"}, {"Shell", "user-desktop"}, - {"Effects", "applications-graphics"}, - {"Window Management", "applications-accessories"}, - {"Utility", "applications-other"}, {"Other", "applications-other"}}; + Category{_("General"), "preferences-system"}, + {_("Accessibility"), "preferences-desktop-accessibility"}, + {_("Desktop"), "preferences-desktop"}, {_("Shell"), "user-desktop"}, + {_("Effects"), "applications-graphics"}, + {_("Window Management"), "applications-accessories"}, + {_("Utility"), "applications-other"}, {_("Other"), "applications-other"}}; }; class KeyEntry : public Gtk::Stack { Gtk::Box grab_layout = Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); - Gtk::Label grab_label = Gtk::Label("(none)"); + Gtk::Label grab_label = Gtk::Label(_("(none)")); Gtk::Button grab_button; Gtk::Button edit_button; @@ -208,15 +212,15 @@ class BindingsDynamicList : public DynamicListBase { struct BindingWidget : public Gtk::Frame { - Gtk::Expander expander = Gtk::Expander("Command:"); + Gtk::Expander expander = Gtk::Expander(_("Command:")); Gtk::Box vbox = Gtk::Box(Gtk::ORIENTATION_VERTICAL, 10); Gtk::Box type_box = Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); Gtk::Box binding_box = Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); Gtk::Box command_box = Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); - Gtk::Label type_label = Gtk::Label("Type"); - Gtk::Label binding_label = Gtk::Label("Binding"); - Gtk::Label command_label = Gtk::Label("Command"); + Gtk::Label type_label = Gtk::Label(_("Type")); + Gtk::Label binding_label = Gtk::Label(_("Binding")); + Gtk::Label command_label = Gtk::Label(_("Command")); Gtk::ComboBoxText type_combo_box; std::unique_ptr key_entry; @@ -247,7 +251,7 @@ class VswitchBindingsDynamicList : public DynamicListBase struct BindingWidget : public Gtk::Box { - Gtk::Label label = Gtk::Label("Workspace"); + Gtk::Label label = Gtk::Label(_("Workspace")); Gtk::SpinButton workspace_spin_button = Gtk::SpinButton(Gtk::Adjustment::create(1, 1, 30)); KeyEntry key_entry; Gtk::Button remove_button; @@ -331,17 +335,17 @@ class WCM Gtk::Box main_left_panel_layout = Gtk::Box(Gtk::ORIENTATION_VERTICAL); Gtk::Label filter_label; Gtk::SearchEntry search_entry; - PrettyButton close_button = PrettyButton("Close", "window-close"); + PrettyButton close_button = PrettyButton(_("Close"), "window-close"); PrettyButton output_config_button = - PrettyButton("Configure Outputs", "computer"); + PrettyButton(_("Configure Outputs"), "computer"); Gtk::Box plugin_left_panel_layout = Gtk::Box(Gtk::ORIENTATION_VERTICAL); Gtk::Label plugin_name_label; Gtk::Label plugin_description_label; Gtk::Box plugin_enabled_box = Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); Gtk::CheckButton plugin_enabled_check; - Gtk::Label plugin_enabled_label = Gtk::Label("Use This Plugin"); - PrettyButton back_button = PrettyButton("Back", "go-previous"); + Gtk::Label plugin_enabled_label = Gtk::Label(_("Use This Plugin")); + PrettyButton back_button = PrettyButton(_("Back"), "go-previous"); cairo_surface_t *grab_window_surface = nullptr; zwp_keyboard_shortcuts_inhibitor_v1 *shortcuts_inhibitor = nullptr; From 6b596ec7deb9c5a98849e5319ec30faa49db2ef5 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 11:16:21 +0300 Subject: [PATCH 07/20] change gettext domain prefix to a more unique one --- src/wcm.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wcm.cpp b/src/wcm.cpp index 36f7701..0c0cc86 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1107,7 +1107,7 @@ OptionGroupWidget::OptionGroupWidget(Option *group) PluginPage::PluginPage(Plugin *plugin) { - std::string gettext_domain_name = "plugin-" + plugin->name; + std::string gettext_domain_name = "wf-plugin-" + plugin->name; set_scrollable(); for (auto *group : plugin->option_groups) { @@ -1150,7 +1150,7 @@ void Plugin::init_widget() } button_layout.pack_start(icon); - std::string gettext_domain_name = "plugin-" + name; + std::string gettext_domain_name = "wf-plugin-" + name; label.set_text(dgettext(gettext_domain_name.c_str(), disp_name.c_str())); label.set_ellipsize(Pango::ELLIPSIZE_END); button_layout.pack_start(label); @@ -1613,7 +1613,7 @@ void WCM::create_main_layout() void WCM::open_page(Plugin *plugin) { - std::string gettext_domain_name = "plugin-" + plugin->name; + std::string gettext_domain_name = "wf-plugin-" + plugin->name; if (plugin) { plugin_enabled_box.set_visible( From f393e123659d75592b80aa1323a8ab99b40734f8 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 13:43:39 +0300 Subject: [PATCH 08/20] fix the back button --- src/wcm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wcm.cpp b/src/wcm.cpp index 0c0cc86..e66b2a2 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1613,9 +1613,9 @@ void WCM::create_main_layout() void WCM::open_page(Plugin *plugin) { - std::string gettext_domain_name = "wf-plugin-" + plugin->name; if (plugin) { + std::string gettext_domain_name = "wf-plugin-" + plugin->name; plugin_enabled_box.set_visible( !plugin->is_core_plugin() && plugin->type != PLUGIN_TYPE_WF_SHELL); plugin_enabled_check.set_active(plugin->enabled); From 4980c7921609fa0e3a22bd5e26dc122e1537f1d3 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 13:56:00 +0300 Subject: [PATCH 09/20] fix text domains --- meson.build | 2 -- src/metadata.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 36a47ad..f09df8e 100644 --- a/meson.build +++ b/meson.build @@ -38,8 +38,6 @@ subdir('src') install_data('wcm.desktop', install_dir: join_paths(share_dir, 'applications')) -message(wayfire_locale_dir) - install_subdir('locale', install_dir : wayfire_locale_dir, strip_directory : true diff --git a/src/metadata.cpp b/src/metadata.cpp index 21b172f..34c7f49 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -123,7 +123,7 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) } std::string node_name = (char*)node->name; - std::string gettext_domain_name = "plugin-" + plugin->name; + std::string gettext_domain_name = "wf-plugin-" + plugin->name; if (node_name == "_short") { this->disp_name = dgettext(gettext_domain_name.c_str(), (char*)node->children->content); From 22be7b6dd80133e599988a3795fa69da73383fcc Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 15:01:58 +0300 Subject: [PATCH 10/20] fix a string in a dialogue --- locale/ro_RO/LC_MESSAGES/wcm.mo | Bin 3585 -> 3949 bytes locale/ro_RO/LC_MESSAGES/wcm.po | 83 ++++++++++++++++++-------------- locale/wcm.pot | 78 ++++++++++++++++-------------- src/wcm.cpp | 7 +-- 4 files changed, 92 insertions(+), 76 deletions(-) diff --git a/locale/ro_RO/LC_MESSAGES/wcm.mo b/locale/ro_RO/LC_MESSAGES/wcm.mo index 79e41fe8797c1dab0e4eaaa089eeaaad479a2712..6e6e4f754792a6f6a9167d4d47ecf5490ddd75b6 100644 GIT binary patch delta 1601 zcmY+^O>7ip9LMnoyDe|6)v{QWQXZ<*^0r$Q5U^?O341U`UJir=o!xy(Cv0b$nP)J? z=!W!S>_t;KfErD_kSH8zj0ZUYZlW>XObjH*MK4562x!!B;roLrfhYUSXXcrCp6CDk zpP4=0^H*=bYOBlljdbobWTZIjq1ImZ_9?qXHAF@gQnN z4mDtgTksfag{N^7Ht|2af$Q-)oi$JAvU{2B#)cy8=cEfq@EhENdT<%bq_62hO}rXQ zxE>YgK3s_tsQ&Mwp8qiS6lx2x7~i!>Xk+H%D9>}UjrzhuL#|e&qLeFW6@5_y)LvasN>pu)vbl!3k;*%B$ZY3Cd#o2u zMQKw}dX(xxD(~Y%MSJ%gRWGl$K^c3n=#PvuA4Z3*k8LH4YIex` z;i1ZK-`hvr^c$&9-su}ESB8hmG~2gAKM`l%PR6xxJakFP9*8qq>vdakHj9Ev-D#jK zg^4h=j8U#+-p7$0j}se2(=;=gtEX6c;r{ zfA~1G-<^%BE~y6Irp*}}q;WM2)PCv9JkI-J-jDLqw|2Zalkm6?Qt$F$86pl6_mYh= zd(>%&sm!~8u8;@|xpJrcRc9n3JZanL3UiLlWXjaV1ECAc!!5Ag)^G;#P|wDuQGd z6&P-67DA4*F>q0fq>Z>4cUH6zTI42NB)I7RT+e`)`<~x9ch1*+&z=4HM|J*>n3plG z6j4VMLT01*yo7>l)ib+*IXsQuumZQS62H6W`^aqv6lHkmo`*`!T4;x{3cIixhcIg9 z+c*_&o2Jmfdw3S-@e(dz7&EAWOQ?RUcm~&9`zvaLTdrL|ZEzQ_;2+cm!*puI3T$9~ zOHkoA8%Iq%iI;H(xov?$JAaJq*cMR>zjN&sR7TeEB5tDQ`-y|Nhg!Ia$)6UH|Y7He(-y`N^hGnN6cM zdLR85m1nNQ5-Qd2k=s5}bmAw}27lvuJVK3&MUMM7J3CPeq)l@n0S&%sdgCF~ zI>W9#iKDcqeJZ!8WKjcmkbht>8FN@Sp}(cFppB`ICeqbLXcNj*55dqNdtj#sy^zjX z8`O367`yHiew?D7s3E$D;zdI2CZTiG$EGyvThOJCP#;ti(MsqI`-y7=CleeE1eue? ztFKtW7J_f0KRB0;6F=ySRYsCTgL|%zO=;IzCWzGHjyICemcA\"{key_str}\" without modifier. You will " +"be unable to use this key/button for anything else! Are you sure?" +msgstr "" +"Ați încercat să asociați «{key_str}» fără taste " +"modificatoare; nu veți putea folosi această tastă/buton pentru nimic " +"altceva. Sigur doriți să continuați?" + +#: src/wcm.cpp:66 msgid "Waiting for Binding" msgstr "Se așteaptă asocierea" -#: src/wcm.cpp:66 +#: src/wcm.cpp:67 msgid "none" msgstr "nimic" -#: src/wcm.cpp:102 +#: src/wcm.cpp:103 msgid "(No modifiers pressed)" msgstr "(Fără taste modificatoare apăsate)" -#: src/wcm.cpp:199 +#: src/wcm.cpp:200 msgid "Edit binding" msgstr "Editează asocierea" -#: src/wcm.cpp:210 +#: src/wcm.cpp:211 msgid "Save binding" msgstr "Salvează asocierea" -#: src/wcm.cpp:221 src/wcm.cpp:575 src/wcm.cpp:697 +#: src/wcm.cpp:222 src/wcm.cpp:576 src/wcm.cpp:698 msgid "Cancel" msgstr "Anulează" -#: src/wcm.cpp:257 +#: src/wcm.cpp:258 msgid "Open context menu to choose layout" msgstr "Deschideți meniul contextual pentru a alege aranjamentul" -#: src/wcm.cpp:282 +#: src/wcm.cpp:283 msgid "Open context menu to choose model" msgstr "Deschideți meniul contextual pentru a alege modelul" -#: src/wcm.cpp:369 +#: src/wcm.cpp:370 msgid "Reset to default" msgstr "Resetează la opțiunile implicite" -#: src/wcm.cpp:576 src/wcm.cpp:698 +#: src/wcm.cpp:577 src/wcm.cpp:699 msgid "Open" msgstr "Deschide" -#: src/wcm.cpp:586 +#: src/wcm.cpp:587 msgid "Choose Directory" msgstr "Alegeți directorul" -#: src/wcm.cpp:590 +#: src/wcm.cpp:591 msgid "Select Folder" msgstr "Alegeți director" -#: src/wcm.cpp:600 +#: src/wcm.cpp:601 msgid "Choose File" msgstr "Alegeți fișierul" -#: src/wcm.cpp:604 +#: src/wcm.cpp:605 msgid "Select File" msgstr "Alegeți fișier" -#: src/wcm.cpp:693 src/wcm.cpp:696 +#: src/wcm.cpp:694 src/wcm.cpp:697 msgid "Choose Executable" msgstr "Alegeți executabilul" -#: src/wcm.cpp:705 +#: src/wcm.cpp:706 msgid "Run command" msgstr "Execută comanda" -#: src/wcm.cpp:711 +#: src/wcm.cpp:712 msgid "Remove from autostart list" msgstr "Elimină din lista de pornire automată" -#: src/wcm.cpp:773 +#: src/wcm.cpp:774 msgid "Regular" msgstr "Obișnuită" -#: src/wcm.cpp:774 +#: src/wcm.cpp:775 msgid "Repeat" msgstr "Repetată" -#: src/wcm.cpp:775 +#: src/wcm.cpp:776 msgid "Always" msgstr "Mereu disponibilă" -#: src/wcm.cpp:800 +#: src/wcm.cpp:801 msgid "Command {name}" msgstr "Comanda {name}" -#: src/wcm.cpp:803 +#: src/wcm.cpp:804 msgid "Command {name}: {command}" msgstr "Comanda {name}: {command}" -#: src/wcm.cpp:851 +#: src/wcm.cpp:852 msgid "Workspace Index" msgstr "Indicele biroului" -#: src/wcm.cpp:904 +#: src/wcm.cpp:905 msgid "Add new command" msgstr "Adaugă o nouă comandă" -#: src/wcm.cpp:978 +#: src/wcm.cpp:979 msgid "Go To Workspace" msgstr "Treci la birou" -#: src/wcm.cpp:981 +#: src/wcm.cpp:982 msgid "Go To Workspace With Window" msgstr "Treci la birou cu fereastra" -#: src/wcm.cpp:984 +#: src/wcm.cpp:985 msgid "Send Window To Workspace" msgstr "Trimite fereastra pe birou" -#: src/wcm.cpp:1010 src/wcm.cpp:1018 +#: src/wcm.cpp:1011 src/wcm.cpp:1019 msgid "{workspace_option_prefix} {workspace_index}" msgstr "{workspace_option_prefix} {workspace_index}" -#: src/wcm.cpp:1327 +#: src/wcm.cpp:1328 msgid "Wayfire config file to use" msgstr "fișierul de configurare Wayfire de folosit" -#: src/wcm.cpp:1332 +#: src/wcm.cpp:1333 msgid "wf-shell config file to use" msgstr "fișierul de configurare wf-shell de folosit" -#: src/wcm.cpp:1337 +#: src/wcm.cpp:1338 msgid "plugin to open at launch, or none for default" msgstr "" "modul care să se deschidă la lansare, sau none pentru valoarea standard" -#: src/wcm.cpp:1364 +#: src/wcm.cpp:1365 msgid "Wayfire Config Manager" msgstr "Administratorul configurărilor Wayfire" -#: src/wcm.cpp:1437 +#: src/wcm.cpp:1438 msgid "To use input binding capture, enable shortcuts-inhibit plugin." msgstr "" "Pentru a folosi captarea asocierilor de intrare, activați modulul shortcuts-" "inhibit." -#: src/wcm.cpp:1530 +#: src/wcm.cpp:1531 msgid "Filter" msgstr "Filtru" -#: src/wcm.cpp:1564 +#: src/wcm.cpp:1565 msgid "Cannot find program wdisplays" msgstr "Nu se poate găsi programul wdisplays" diff --git a/locale/wcm.pot b/locale/wcm.pot index 742e012..c80f018 100644 --- a/locale/wcm.pot +++ b/locale/wcm.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-15 01:08+0300\n" +"POT-Creation-Date: 2025-09-15 14:54+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,143 +25,149 @@ msgstr "" msgid "General" msgstr "" -#: src/wcm.cpp:65 -msgid "Waiting for Binding" +#: src/wcm.cpp:26 +msgid "" +"Attempting to bind \"{key_str}\" without modifier. You will " +"be unable to use this key/button for anything else! Are you sure?" msgstr "" #: src/wcm.cpp:66 +msgid "Waiting for Binding" +msgstr "" + +#: src/wcm.cpp:67 msgid "none" msgstr "" -#: src/wcm.cpp:102 +#: src/wcm.cpp:103 msgid "(No modifiers pressed)" msgstr "" -#: src/wcm.cpp:199 +#: src/wcm.cpp:200 msgid "Edit binding" msgstr "" -#: src/wcm.cpp:210 +#: src/wcm.cpp:211 msgid "Save binding" msgstr "" -#: src/wcm.cpp:221 src/wcm.cpp:575 src/wcm.cpp:697 +#: src/wcm.cpp:222 src/wcm.cpp:576 src/wcm.cpp:698 msgid "Cancel" msgstr "" -#: src/wcm.cpp:257 +#: src/wcm.cpp:258 msgid "Open context menu to choose layout" msgstr "" -#: src/wcm.cpp:282 +#: src/wcm.cpp:283 msgid "Open context menu to choose model" msgstr "" -#: src/wcm.cpp:369 +#: src/wcm.cpp:370 msgid "Reset to default" msgstr "" -#: src/wcm.cpp:576 src/wcm.cpp:698 +#: src/wcm.cpp:577 src/wcm.cpp:699 msgid "Open" msgstr "" -#: src/wcm.cpp:586 +#: src/wcm.cpp:587 msgid "Choose Directory" msgstr "" -#: src/wcm.cpp:590 +#: src/wcm.cpp:591 msgid "Select Folder" msgstr "" -#: src/wcm.cpp:600 +#: src/wcm.cpp:601 msgid "Choose File" msgstr "" -#: src/wcm.cpp:604 +#: src/wcm.cpp:605 msgid "Select File" msgstr "" -#: src/wcm.cpp:693 src/wcm.cpp:696 +#: src/wcm.cpp:694 src/wcm.cpp:697 msgid "Choose Executable" msgstr "" -#: src/wcm.cpp:705 +#: src/wcm.cpp:706 msgid "Run command" msgstr "" -#: src/wcm.cpp:711 +#: src/wcm.cpp:712 msgid "Remove from autostart list" msgstr "" -#: src/wcm.cpp:773 +#: src/wcm.cpp:774 msgid "Regular" msgstr "" -#: src/wcm.cpp:774 +#: src/wcm.cpp:775 msgid "Repeat" msgstr "" -#: src/wcm.cpp:775 +#: src/wcm.cpp:776 msgid "Always" msgstr "" -#: src/wcm.cpp:800 +#: src/wcm.cpp:801 msgid "Command {name}" msgstr "" -#: src/wcm.cpp:803 +#: src/wcm.cpp:804 msgid "Command {name}: {command}" msgstr "" -#: src/wcm.cpp:851 +#: src/wcm.cpp:852 msgid "Workspace Index" msgstr "" -#: src/wcm.cpp:904 +#: src/wcm.cpp:905 msgid "Add new command" msgstr "" -#: src/wcm.cpp:978 +#: src/wcm.cpp:979 msgid "Go To Workspace" msgstr "" -#: src/wcm.cpp:981 +#: src/wcm.cpp:982 msgid "Go To Workspace With Window" msgstr "" -#: src/wcm.cpp:984 +#: src/wcm.cpp:985 msgid "Send Window To Workspace" msgstr "" -#: src/wcm.cpp:1010 src/wcm.cpp:1018 +#: src/wcm.cpp:1011 src/wcm.cpp:1019 msgid "{workspace_option_prefix} {workspace_index}" msgstr "" -#: src/wcm.cpp:1327 +#: src/wcm.cpp:1328 msgid "Wayfire config file to use" msgstr "" -#: src/wcm.cpp:1332 +#: src/wcm.cpp:1333 msgid "wf-shell config file to use" msgstr "" -#: src/wcm.cpp:1337 +#: src/wcm.cpp:1338 msgid "plugin to open at launch, or none for default" msgstr "" -#: src/wcm.cpp:1364 +#: src/wcm.cpp:1365 msgid "Wayfire Config Manager" msgstr "" -#: src/wcm.cpp:1437 +#: src/wcm.cpp:1438 msgid "To use input binding capture, enable shortcuts-inhibit plugin." msgstr "" -#: src/wcm.cpp:1530 +#: src/wcm.cpp:1531 msgid "Filter" msgstr "" -#: src/wcm.cpp:1564 +#: src/wcm.cpp:1565 msgid "Cannot find program wdisplays" msgstr "" diff --git a/src/wcm.cpp b/src/wcm.cpp index e66b2a2..858a515 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -22,9 +22,10 @@ bool KeyEntry::check_and_confirm(const std::string & key_str) ((key_str.find("BTN") != std::string::npos) || (key_str.find("KEY") != std::string::npos))) { - auto dialog = Gtk::MessageDialog(_(("Attempting to bind \"" + key_str + '"' + - " without modifier. You will be unable to use this key/button " - "for anything else! Are you sure?").c_str()), + auto dialog = Gtk::MessageDialog( + fmt::format(_("Attempting to bind \"{key_str}\" without modifier." + " You will be unable to use this key/button for anything else!" + " Are you sure?"), fmt::arg("key_str", key_str)), true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_YES_NO); return dialog.run() == Gtk::RESPONSE_YES; } From 434c60c1085e5053cc8b9888fae61b3f9d9d5510 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 15:07:50 +0300 Subject: [PATCH 11/20] allow enum names to be translated --- src/metadata.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/metadata.cpp b/src/metadata.cpp index 34c7f49..4763905 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -115,6 +115,7 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) } free(prop); + std::string gettext_domain_name = "wf-plugin-" + plugin->name; for (node = cur_node->children; node; node = node->next) { if (node->type != XML_ELEMENT_NODE) @@ -123,7 +124,6 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) } std::string node_name = (char*)node->name; - std::string gettext_domain_name = "wf-plugin-" + plugin->name; if (node_name == "_short") { this->disp_name = dgettext(gettext_domain_name.c_str(), (char*)node->children->content); @@ -289,7 +289,7 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) if (is_name) { - li->name = strdup((char*)n->children->content); + li->name = dgettext(gettext_domain_name.c_str(), strdup((char*)n->children->content)); } } else if (this->type == OPTION_TYPE_STRING) { @@ -312,7 +312,7 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) if (is_name) { - ls->name = (char*)n->children->content; + ls->name = dgettext(gettext_domain_name.c_str(), strdup((char*)n->children->content)); } } } From 6b6bfb49584994a16c697a0347e9d2f16c8dc56d Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 17:18:56 +0300 Subject: [PATCH 12/20] remove pot, mo from tree; make meson automatically compile mo --- locale/ro_RO/LC_MESSAGES/wcm.mo | Bin 3949 -> 0 bytes locale/wcm.pot | 240 -------------------------------- meson.build | 26 +++- 3 files changed, 22 insertions(+), 244 deletions(-) delete mode 100644 locale/ro_RO/LC_MESSAGES/wcm.mo delete mode 100644 locale/wcm.pot diff --git a/locale/ro_RO/LC_MESSAGES/wcm.mo b/locale/ro_RO/LC_MESSAGES/wcm.mo deleted file mode 100644 index 6e6e4f754792a6f6a9167d4d47ecf5490ddd75b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3949 zcmb7`U2Gjk6~_nKq+nVKAti-=Fby;~#A`bVX%jaj+$2u0RL3T^2?&WWzB~8cY4*-s z?aulmQIL>dkRl-v@K9O_Bwi}<@lXlzKp&vBM1^=mLPY{z;03`$g+PG%!tdS8s zvGUyC&g^`g`JXdq{JTAOe?##cr#wvg&0CaOfY0B>56^3NEA?LZYq%S}4)241hxfx> zyXy7_;7#feLq4e&;63pB&G#R|1JqxF?}ERF?}mSc?|{3RoL996%D4yNJE4Z}gH!Nr za1P42OHlfy@LrfT^-aj1`eIZ65)?bX0w03khGO4Ka6kMhd<^~p%KE#RROY>xpZCMP zkWXp~irr5@vG)R$b(fm@=b`A5!3W_rDD!;{o`TOpS@$(4{eBC@u0KKk)EoS~2j0ad zMelu3)}Ms3-#Pep_*p39ER^|5n80gL_V)rj1h?To;Op>l_(ulII`@y&y6%Hw=K;6} zo`yeym!R|;W0MS3d!VfQ5S)aML$PxiJ^*`A#(x1y|F1UuCKUgD2a5k*gfh=Bpp5$! z6n*{-Wxl^a(Rnwb3h#q5-(D#5JOX8Z6HWUk;0fxVgdc@Bp^Wj{v_o9W%!5&@_c}TB-Qgley5su*^@k?!SFf4%Q4E)VM9aNk36Ec*es8n zrE$umQsJ4Th+jnOM<^emNW45j5&uf8$s?M{Bie}0(-cDSwnzMSm?Cj2J`lZjK9awX zv5E&Zelh5NNL|O-ywHQ(7KKd@s&OB@J*ZmkHVtmoWiD>2R+?&W*L6Ge`^KlLm93l2 zLbYPF{XulTt7Fis&ZqihjHgbnp4xx?s@=R&#QetolT)jwPEOIR*In#|GLBZA)Sn3@ zty!j5tuDP;&8$pR7NF+}%^Xv!WsJe=PRO4eS%?kUNZsk^QGC@)1_Ov=<+E>*X zOrV20Ykb>g0w1F8h+%^~baT_M3|voLG050KWtTeJ3xOrix!ks6$Tx=#vm3TuMzLzx za^A^%MsIbtk)ol#?oHp`7&bT68GXHxZ1iP@F23Ws7_Aq|I4EPG&e`H>3(65 zdzkHXFsD$g8EvjESZ{NasS80b2Yor@SBrsZ+dJ#}G9vTi)3B}<2G&4ok2-TjCIV2Kvl=910WrmmD7zK1MjwIz$&>Yd!a<)xm@GKC5fD9$6{a5mjGgNU*d z+Sbuj^g#Qy zF)lGUjIhgQvqQY-+L?OZc+clN6$hxcbheudffoQ^aIBH@?UW2aJ(V8{aKaELpauzoR~*^Kj+T!r1)W{Oqmu z4^K{yA#_BvMEo|RC77o;!p=WMESsEY``F6z`Q-SmezIK0=Em397S{lgO|-IfD{@TShq>HW%i#EZY#6h z%G9(;xn;(c(zMwo>$+@bYsbC%EQ`{F8SS1+s|;LgObX`3>`1{os&}N|YQ&BlEaq!x znLKw~A9*ONEL?4?b_+W-BxBBmt#WZ*4s)?p%iI`_V@dvzk+)ZMyVL}r=${+O@wM5* z7txqB;E+gUCZJ1`4LxJ<3VLWm6hFho;v+l%zeZMhyHYTcVb#Ja0{YSs3TieZhCTb{ zSX5ctkf!lo?j@s1Lhl>tC%HT}Zyc~%6E+(L*j{?cZLUAaT-zZ{eOXp9Q+Y!znQZM& z8AncT+QfMsQ!sT-TI1PVs0yK, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-09-15 14:54+0300\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: src/metadata.cpp:382 -msgid "Uncategorized" -msgstr "" - -#: src/metadata.cpp:411 src/wcm.hpp:83 -msgid "General" -msgstr "" - -#: src/wcm.cpp:26 -msgid "" -"Attempting to bind \"{key_str}\" without modifier. You will " -"be unable to use this key/button for anything else! Are you sure?" -msgstr "" - -#: src/wcm.cpp:66 -msgid "Waiting for Binding" -msgstr "" - -#: src/wcm.cpp:67 -msgid "none" -msgstr "" - -#: src/wcm.cpp:103 -msgid "(No modifiers pressed)" -msgstr "" - -#: src/wcm.cpp:200 -msgid "Edit binding" -msgstr "" - -#: src/wcm.cpp:211 -msgid "Save binding" -msgstr "" - -#: src/wcm.cpp:222 src/wcm.cpp:576 src/wcm.cpp:698 -msgid "Cancel" -msgstr "" - -#: src/wcm.cpp:258 -msgid "Open context menu to choose layout" -msgstr "" - -#: src/wcm.cpp:283 -msgid "Open context menu to choose model" -msgstr "" - -#: src/wcm.cpp:370 -msgid "Reset to default" -msgstr "" - -#: src/wcm.cpp:577 src/wcm.cpp:699 -msgid "Open" -msgstr "" - -#: src/wcm.cpp:587 -msgid "Choose Directory" -msgstr "" - -#: src/wcm.cpp:591 -msgid "Select Folder" -msgstr "" - -#: src/wcm.cpp:601 -msgid "Choose File" -msgstr "" - -#: src/wcm.cpp:605 -msgid "Select File" -msgstr "" - -#: src/wcm.cpp:694 src/wcm.cpp:697 -msgid "Choose Executable" -msgstr "" - -#: src/wcm.cpp:706 -msgid "Run command" -msgstr "" - -#: src/wcm.cpp:712 -msgid "Remove from autostart list" -msgstr "" - -#: src/wcm.cpp:774 -msgid "Regular" -msgstr "" - -#: src/wcm.cpp:775 -msgid "Repeat" -msgstr "" - -#: src/wcm.cpp:776 -msgid "Always" -msgstr "" - -#: src/wcm.cpp:801 -msgid "Command {name}" -msgstr "" - -#: src/wcm.cpp:804 -msgid "Command {name}: {command}" -msgstr "" - -#: src/wcm.cpp:852 -msgid "Workspace Index" -msgstr "" - -#: src/wcm.cpp:905 -msgid "Add new command" -msgstr "" - -#: src/wcm.cpp:979 -msgid "Go To Workspace" -msgstr "" - -#: src/wcm.cpp:982 -msgid "Go To Workspace With Window" -msgstr "" - -#: src/wcm.cpp:985 -msgid "Send Window To Workspace" -msgstr "" - -#: src/wcm.cpp:1011 src/wcm.cpp:1019 -msgid "{workspace_option_prefix} {workspace_index}" -msgstr "" - -#: src/wcm.cpp:1328 -msgid "Wayfire config file to use" -msgstr "" - -#: src/wcm.cpp:1333 -msgid "wf-shell config file to use" -msgstr "" - -#: src/wcm.cpp:1338 -msgid "plugin to open at launch, or none for default" -msgstr "" - -#: src/wcm.cpp:1365 -msgid "Wayfire Config Manager" -msgstr "" - -#: src/wcm.cpp:1438 -msgid "To use input binding capture, enable shortcuts-inhibit plugin." -msgstr "" - -#: src/wcm.cpp:1531 -msgid "Filter" -msgstr "" - -#: src/wcm.cpp:1565 -msgid "Cannot find program wdisplays" -msgstr "" - -#: src/wcm.hpp:84 -msgid "Accessibility" -msgstr "" - -#: src/wcm.hpp:85 -msgid "Desktop" -msgstr "" - -#: src/wcm.hpp:85 -msgid "Shell" -msgstr "" - -#: src/wcm.hpp:86 -msgid "Effects" -msgstr "" - -#: src/wcm.hpp:87 -msgid "Window Management" -msgstr "" - -#: src/wcm.hpp:88 -msgid "Utility" -msgstr "" - -#: src/wcm.hpp:88 -msgid "Other" -msgstr "" - -#: src/wcm.hpp:94 -msgid "(none)" -msgstr "" - -#: src/wcm.hpp:215 -msgid "Command:" -msgstr "" - -#: src/wcm.hpp:221 -msgid "Type" -msgstr "" - -#: src/wcm.hpp:222 -msgid "Binding" -msgstr "" - -#: src/wcm.hpp:223 -msgid "Command" -msgstr "" - -#: src/wcm.hpp:254 -msgid "Workspace" -msgstr "" - -#: src/wcm.hpp:338 -msgid "Close" -msgstr "" - -#: src/wcm.hpp:340 -msgid "Configure Outputs" -msgstr "" - -#: src/wcm.hpp:347 -msgid "Use This Plugin" -msgstr "" - -#: src/wcm.hpp:348 -msgid "Back" -msgstr "" diff --git a/meson.build b/meson.build index f09df8e..1fd5405 100644 --- a/meson.build +++ b/meson.build @@ -38,7 +38,25 @@ subdir('src') install_data('wcm.desktop', install_dir: join_paths(share_dir, 'applications')) -install_subdir('locale', - install_dir : wayfire_locale_dir, - strip_directory : true -) +mo_targets = [] + +po_files_raw = run_command('find', 'locale', '-name', '*.po').stdout().strip().split('\n') +po_files = files(po_files_raw) + +foreach po_file : po_files + language = fs.name(fs.parent(fs.parent(po_file))) + mo_file = fs.stem(po_file) + '.mo' + t = custom_target('mo-' + language, + input : po_file, + output : mo_file, + command : ['msgfmt', '@INPUT@', '-o', '@OUTPUT@'], + install : true, + install_dir : join_paths( + wayfire_locale_dir, + language, + 'LC_MESSAGES' + ) + ) + + mo_targets += t +endforeach From e31ed6b19e245fba078bf11bf230f830b9187216 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 17:35:11 +0300 Subject: [PATCH 13/20] fix code style and meson warning --- meson.build | 2 +- src/metadata.cpp | 6 ++++-- src/wcm.cpp | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/meson.build b/meson.build index 1fd5405..a1c72b4 100644 --- a/meson.build +++ b/meson.build @@ -40,7 +40,7 @@ install_data('wcm.desktop', install_dir: join_paths(share_dir, 'applications')) mo_targets = [] -po_files_raw = run_command('find', 'locale', '-name', '*.po').stdout().strip().split('\n') +po_files_raw = run_command('find', 'locale', '-name', '*.po', check : false).stdout().strip().split('\n') po_files = files(po_files_raw) foreach po_file : po_files diff --git a/src/metadata.cpp b/src/metadata.cpp index 4763905..df6c113 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -289,7 +289,8 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) if (is_name) { - li->name = dgettext(gettext_domain_name.c_str(), strdup((char*)n->children->content)); + li->name = + dgettext(gettext_domain_name.c_str(), strdup((char*)n->children->content)); } } else if (this->type == OPTION_TYPE_STRING) { @@ -312,7 +313,8 @@ Option::Option(xmlNode *cur_node, Plugin *plugin) if (is_name) { - ls->name = dgettext(gettext_domain_name.c_str(), strdup((char*)n->children->content)); + ls->name = + dgettext(gettext_domain_name.c_str(), strdup((char*)n->children->content)); } } } diff --git a/src/wcm.cpp b/src/wcm.cpp index 858a515..348fe8a 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -802,8 +802,8 @@ BindingsDynamicList::BindingWidget::BindingWidget(const std::string & cmd_name, command_entry.signal_changed().connect([=] { expander.set_label(fmt::format(_("Command {name}: {command}"), - fmt::arg("name", cmd_name), - fmt::arg("command", command_entry.get_text().c_str()))); + fmt::arg("name", cmd_name), + fmt::arg("command", command_entry.get_text().c_str()))); auto *label = (Gtk::Label*)expander.get_label_widget(); label->set_ellipsize(Pango::ELLIPSIZE_END); label->set_tooltip_text(command_entry.get_text()); @@ -976,7 +976,8 @@ const std::string VswitchBindingsDynamicList::O template<> const std::string VswitchBindingsDynamicList::OPTION_PREFIX = "send_win_"; template<> -const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = _("Go To Workspace"); +const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = + _("Go To Workspace"); template<> const Glib::ustring VswitchBindingsWidget::LABEL_TEXT = _("Go To Workspace With Window"); @@ -1009,18 +1010,17 @@ VswitchBindingsDynamicList::VswitchBindingsDynamicList(Option *option) { int workspace_index = 1; while (section->get_option_or(fmt::format(_("{workspace_option_prefix} {workspace_index}"), - fmt::arg("workspace_option_prefix", OPTION_PREFIX), - fmt::arg("workspace_index", std::to_string(workspace_index))))) + fmt::arg("workspace_option_prefix", OPTION_PREFIX), + fmt::arg("workspace_index", std::to_string(workspace_index))))) { ++workspace_index; } Option *binding_option = option->create_child_option( - fmt::format(_("{workspace_option_prefix} {workspace_index}"), - fmt::arg("workspace_option_prefix", OPTION_PREFIX), - fmt::arg("workspace_index", std::to_string(workspace_index))), - OPTION_TYPE_STRING - ); + fmt::format(_("{workspace_option_prefix} {workspace_index}"), + fmt::arg("workspace_option_prefix", OPTION_PREFIX), + fmt::arg("workspace_index", std::to_string(workspace_index))), + OPTION_TYPE_STRING); section->register_new_option(std::make_shared>(binding_option->name, "")); pack_widget(std::make_unique(section, binding_option, workspace_index)); From f5d71fe5179b8e603294b1031a592d7f59649108 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 17:36:04 +0300 Subject: [PATCH 14/20] use true for check --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index a1c72b4..7c1904e 100644 --- a/meson.build +++ b/meson.build @@ -40,7 +40,7 @@ install_data('wcm.desktop', install_dir: join_paths(share_dir, 'applications')) mo_targets = [] -po_files_raw = run_command('find', 'locale', '-name', '*.po', check : false).stdout().strip().split('\n') +po_files_raw = run_command('find', 'locale', '-name', '*.po', check : true).stdout().strip().split('\n') po_files = files(po_files_raw) foreach po_file : po_files From ec1f95565033b9ff336b8471c571c5ff02fa39c8 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 17:37:56 +0300 Subject: [PATCH 15/20] move meson of locales to another directory --- locale/meson.build | 22 ++++++++++++++++++++++ meson.build | 24 +----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 locale/meson.build diff --git a/locale/meson.build b/locale/meson.build new file mode 100644 index 0000000..e6502f9 --- /dev/null +++ b/locale/meson.build @@ -0,0 +1,22 @@ +mo_targets = [] + +po_files_raw = run_command('find', '.', '-name', '*.po', check : true).stdout().strip().split('\n') +po_files = files(po_files_raw) + +foreach po_file : po_files + language = fs.name(fs.parent(fs.parent(po_file))) + mo_file = fs.stem(po_file) + '.mo' + t = custom_target('mo-' + language, + input : po_file, + output : mo_file, + command : ['msgfmt', '@INPUT@', '-o', '@OUTPUT@'], + install : true, + install_dir : join_paths( + wayfire_locale_dir, + language, + 'LC_MESSAGES' + ) + ) + + mo_targets += t +endforeach diff --git a/meson.build b/meson.build index 7c1904e..7aa78f3 100644 --- a/meson.build +++ b/meson.build @@ -35,28 +35,6 @@ add_project_arguments('-DICONDIR="' + icon_dir + '"', language : 'cpp') subdir('icons') subdir('proto') subdir('src') +subdir('locale') install_data('wcm.desktop', install_dir: join_paths(share_dir, 'applications')) - -mo_targets = [] - -po_files_raw = run_command('find', 'locale', '-name', '*.po', check : true).stdout().strip().split('\n') -po_files = files(po_files_raw) - -foreach po_file : po_files - language = fs.name(fs.parent(fs.parent(po_file))) - mo_file = fs.stem(po_file) + '.mo' - t = custom_target('mo-' + language, - input : po_file, - output : mo_file, - command : ['msgfmt', '@INPUT@', '-o', '@OUTPUT@'], - install : true, - install_dir : join_paths( - wayfire_locale_dir, - language, - 'LC_MESSAGES' - ) - ) - - mo_targets += t -endforeach From 05fbbddc3ca0190f593236ab0dc65ce3dcd81579 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 17:38:59 +0300 Subject: [PATCH 16/20] import fs because I forgot --- locale/meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locale/meson.build b/locale/meson.build index e6502f9..47d8d46 100644 --- a/locale/meson.build +++ b/locale/meson.build @@ -1,3 +1,5 @@ +fs = import('fs') + mo_targets = [] po_files_raw = run_command('find', '.', '-name', '*.po', check : true).stdout().strip().split('\n') From d649b135e754baba55539f88b26f2b7a7fc3ce98 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 15 Sep 2025 23:03:42 +0300 Subject: [PATCH 17/20] fix meson.build and translation domains --- locale/meson.build | 3 +++ src/metadata.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/locale/meson.build b/locale/meson.build index 47d8d46..318697b 100644 --- a/locale/meson.build +++ b/locale/meson.build @@ -1,3 +1,6 @@ +share_dir = join_paths(get_option('prefix'), 'share') +wayfire_locale_dir = join_paths(share_dir, 'locale') + fs = import('fs') mo_targets = [] diff --git a/src/metadata.cpp b/src/metadata.cpp index df6c113..3a34e0f 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -387,7 +387,7 @@ Plugin*Plugin::get_plugin_data(xmlNode *cur_node, Option *main_group, Plugin *pl { plugin->name = (char*)prop; // Initialise translations - bindtextdomain(("plugin-" + plugin->name).c_str(), WAYFIRE_LOCALEDIR); + bindtextdomain(("wf-plugin-" + plugin->name).c_str(), WAYFIRE_LOCALEDIR); } free(prop); From 2f099df92c98e0dfa34a11051aee4bb2bf3be784 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 16 Sep 2025 21:59:00 +0300 Subject: [PATCH 18/20] don't translate some internal strings --- src/wcm.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/wcm.cpp b/src/wcm.cpp index 348fe8a..5457a90 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -1009,20 +1009,15 @@ VswitchBindingsDynamicList::VswitchBindingsDynamicList(Option *option) add_button.signal_clicked().connect([=] { int workspace_index = 1; - while (section->get_option_or(fmt::format(_("{workspace_option_prefix} {workspace_index}"), - fmt::arg("workspace_option_prefix", OPTION_PREFIX), - fmt::arg("workspace_index", std::to_string(workspace_index))))) + while (section->get_option_or(OPTION_PREFIX + std::to_string(workspace_index))) { ++workspace_index; } - Option *binding_option = option->create_child_option( - fmt::format(_("{workspace_option_prefix} {workspace_index}"), - fmt::arg("workspace_option_prefix", OPTION_PREFIX), - fmt::arg("workspace_index", std::to_string(workspace_index))), - OPTION_TYPE_STRING); - section->register_new_option(std::make_shared>(binding_option->name, - "")); + Option *binding_option = + option->create_child_option(OPTION_PREFIX + std::to_string(workspace_index), OPTION_TYPE_STRING); + section->register_new_option(std::make_shared>( + binding_option->name, "")); pack_widget(std::make_unique(section, binding_option, workspace_index)); show_all(); WCM::get_instance()->save_config(option->plugin); From 8186a9be2f7fabb37039a2379239f22c4d53864d Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 16 Sep 2025 22:03:59 +0300 Subject: [PATCH 19/20] format meson with 4 spaces --- locale/meson.build | 26 +++++++++++++------------- meson.build | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/locale/meson.build b/locale/meson.build index 318697b..eea7f1f 100644 --- a/locale/meson.build +++ b/locale/meson.build @@ -9,19 +9,19 @@ po_files_raw = run_command('find', '.', '-name', '*.po', check : true).stdout(). po_files = files(po_files_raw) foreach po_file : po_files - language = fs.name(fs.parent(fs.parent(po_file))) - mo_file = fs.stem(po_file) + '.mo' - t = custom_target('mo-' + language, - input : po_file, - output : mo_file, - command : ['msgfmt', '@INPUT@', '-o', '@OUTPUT@'], - install : true, - install_dir : join_paths( - wayfire_locale_dir, - language, - 'LC_MESSAGES' + language = fs.name(fs.parent(fs.parent(po_file))) + mo_file = fs.stem(po_file) + '.mo' + t = custom_target('mo-' + language, + input : po_file, + output : mo_file, + command : ['msgfmt', '@INPUT@', '-o', '@OUTPUT@'], + install : true, + install_dir : join_paths( + wayfire_locale_dir, + language, + 'LC_MESSAGES' + ) ) - ) - mo_targets += t + mo_targets += t endforeach diff --git a/meson.build b/meson.build index 7aa78f3..fbb7c31 100644 --- a/meson.build +++ b/meson.build @@ -19,11 +19,11 @@ add_global_arguments('-DWAYFIRE_METADATADIR="' + wayfire_metadata_dir + '"', lan add_global_arguments('-DWAYFIRE_LOCALEDIR="' + wayfire_locale_dir + '"', language : 'cpp') add_global_arguments('-DWAYFIRE_SYSCONFDIR="' + wayfire_sysconf_dir + '"', language : 'cpp') if wf_shell.found() - wf_shell_metadata_dir = wf_shell.get_variable(pkgconfig: 'metadatadir') - wf_shell_sysconf_dir = wf_shell.get_variable(pkgconfig: 'sysconfdir') - add_project_arguments('-DHAVE_WFSHELL=1', language : 'cpp') - add_global_arguments('-DWFSHELL_METADATADIR="' + wf_shell_metadata_dir + '"', language : 'cpp') - add_global_arguments('-DWFSHELL_SYSCONFDIR="' + wf_shell_sysconf_dir + '"', language : 'cpp') + wf_shell_metadata_dir = wf_shell.get_variable(pkgconfig: 'metadatadir') + wf_shell_sysconf_dir = wf_shell.get_variable(pkgconfig: 'sysconfdir') + add_project_arguments('-DHAVE_WFSHELL=1', language : 'cpp') + add_global_arguments('-DWFSHELL_METADATADIR="' + wf_shell_metadata_dir + '"', language : 'cpp') + add_global_arguments('-DWFSHELL_SYSCONFDIR="' + wf_shell_sysconf_dir + '"', language : 'cpp') endif add_global_arguments('-DICONDIR="' + icon_dir + '"', language : 'cpp') From d1a9c5902a69daa2df7c06375683861ae83e21a0 Mon Sep 17 00:00:00 2001 From: Vlad Date: Tue, 16 Sep 2025 22:06:40 +0300 Subject: [PATCH 20/20] rely on glib's header for gettext macros --- src/metadata.cpp | 3 +-- src/wcm.cpp | 2 +- src/wcm.hpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/metadata.cpp b/src/metadata.cpp index 3a34e0f..65fac8a 100644 --- a/src/metadata.cpp +++ b/src/metadata.cpp @@ -29,8 +29,7 @@ #include #include #include - -#define _(MSG) gettext(MSG) +#include Option::Option(xmlNode *cur_node, Plugin *plugin) { diff --git a/src/wcm.cpp b/src/wcm.cpp index 5457a90..b51d199 100644 --- a/src/wcm.cpp +++ b/src/wcm.cpp @@ -10,9 +10,9 @@ #include #include #include +#include #define OUTPUT_CONFIG_PROGRAM "wdisplays" -#define _(MSG) gettext(MSG) constexpr int OPTION_LABEL_SIZE = 200; diff --git a/src/wcm.hpp b/src/wcm.hpp index d39bda8..4fc774a 100644 --- a/src/wcm.hpp +++ b/src/wcm.hpp @@ -38,11 +38,10 @@ #include #include #include +#include #include "metadata.hpp" -#define _(MSG) gettext(MSG) - struct animate_option { Option *option;