Commit f33b8c68 authored by Vladislav's avatar Vladislav

rename and added gettext locales

parent 33032258
......@@ -30,9 +30,9 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_executable(tray_test example/example.c)
target_link_libraries(tray_test PRIVATE tray)
add_executable(traypp_test example/example_pp.cpp)
set_target_properties(traypp_test PROPERTIES CXX_STANDARD 17)
target_link_libraries(traypp_test PRIVATE tray)
add_executable(pw_tray example/example_pp.cpp)
set_target_properties(pw_tray PROPERTIES CXX_STANDARD 17)
target_link_libraries(pw_tray PRIVATE tray)
add_custom_command(
TARGET tray_test
......
......@@ -2,13 +2,23 @@
#include <filesystem>
#include <stdlib.h>
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
int main() {
setlocale (LC_ALL, "");
bindtextdomain ("tray", getenv("PWD"));
textdomain ("tray");
trays::Menu q;
q.text_ = "WINEFILE";
q.text_ = _("WINEFILE");
trays::Menu w;
w.text_ = "TASKMGR";
w.text_ = _("TASKMGR");
trays::Menu e;
e.text_ = "CHANGELOG";
e.text_ = _("CHANGELOG");
// linux: png, svg
std::string icon_name = "portproton_tray.svg";
......
......@@ -23,7 +23,6 @@ static GtkMenuShell *_tray_menu(struct tray_menu *m) {
item = gtk_menu_item_new_with_label(m->text);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item),
GTK_WIDGET(_tray_menu(m->submenu)));
if (m->cb != NULL) {
g_signal_connect(item, "activate", G_CALLBACK(_tray_menu_cb), m);
}
......@@ -38,6 +37,7 @@ static GtkMenuShell *_tray_menu(struct tray_menu *m) {
if (gtk_init_check(0, NULL) == FALSE) {
return -1;
}
g_set_application_name ("PortProton");
indicator = app_indicator_new(TRAY_APPINDICATOR_ID, tray->icon,
APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);
......
......@@ -5,6 +5,7 @@
#include <vector>
#include "tray_raw.h"
namespace trays {
class Menu {
public:
......
# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-03 06:25+0500\n"
"PO-Revision-Date: 2024-07-03 07:14+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.4.4\n"
#: example/example_pp.cpp:17
msgid "WINEFILE"
msgstr "WINEFILE"
#: example/example_pp.cpp:19
msgid "TASKMGR"
msgstr "GESTOR DE TAREAS"
#: example/example_pp.cpp:21
msgid "CHANGELOG"
msgstr "LISTA DE CAMBIOS"
#: src/tray.cpp:20
msgid "FORCE EXIT"
msgstr "SALIDA FORZADA"
# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-03 06:25+0500\n"
"PO-Revision-Date: 2024-07-03 06:27+0500\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.4.4\n"
#: example/example_pp.cpp:17
msgid "WINEFILE"
msgstr "ФАЙЛОВЫЙ МЕНЕДЖЕР"
#: example/example_pp.cpp:19
msgid "TASKMGR"
msgstr "ДИСПЕТЧЕР ЗАДАЧ"
#: example/example_pp.cpp:21
msgid "CHANGELOG"
msgstr "ИЗМЕНЕНИЯ"
#: src/tray.cpp:20
msgid "FORCE EXIT"
msgstr "ПРИНУДИТЕЛЬНЫЙ ВЫХОД"
# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-03 06:25+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: example/example_pp.cpp:17
msgid "WINEFILE"
msgstr ""
#: example/example_pp.cpp:19
msgid "TASKMGR"
msgstr ""
#: example/example_pp.cpp:21
msgid "CHANGELOG"
msgstr ""
#: src/tray.cpp:20
msgid "FORCE EXIT"
msgstr ""
#include "tray/tray.h"
#include <libintl.h>
#include <locale.h>
#define _(STRING) gettext(STRING)
trays::Tray::Tray(std::string icon_path, std::vector<Menu> menus)
: icon_(icon_path) {
for (auto m : menus) {
add(m);
}
setlocale (LC_ALL, "");
bindtextdomain ("tray", getenv("PWD"));
textdomain ("tray");
Menu exit;
exit.on_click_ = [](Menu *) { system("bash -c tray_icon_click_exit"); tray_exit(); };
exit.text_ = "FORCE EXIT";
exit.text_ = _("FORCE EXIT");
add(exit);
tray_.icon = &icon_path[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment