From 1bc2e4ff9d1a6e31d6e67be135b54bf9cee80229 Mon Sep 17 00:00:00 2001 From: jixiaoxu Date: Tue, 28 Mar 2023 15:20:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E9=9D=A2=E6=9D=BF=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E6=96=B0=E5=A2=9E=E7=BF=BB=E8=AF=91=E6=96=87=E4=BB=B6?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- notification-ukcc-plugin/CMakeLists.txt | 21 +++- .../notification-ukcc-plugin.cpp | 13 +++ .../notification-ukcc-plugin.h | 1 + .../translations/bo_CN.ts | 96 +++++++++++++++++++ .../translations/en_US.ts | 96 +++++++++++++++++++ .../translations/zh_CN.ts | 96 +++++++++++++++++++ 6 files changed, 318 insertions(+), 5 deletions(-) create mode 100644 notification-ukcc-plugin/translations/bo_CN.ts create mode 100644 notification-ukcc-plugin/translations/en_US.ts create mode 100644 notification-ukcc-plugin/translations/zh_CN.ts diff --git a/notification-ukcc-plugin/CMakeLists.txt b/notification-ukcc-plugin/CMakeLists.txt index 80d4340..f146d96 100644 --- a/notification-ukcc-plugin/CMakeLists.txt +++ b/notification-ukcc-plugin/CMakeLists.txt @@ -5,10 +5,8 @@ set(notification-ukcc-plugin_LIB_SRCS noticemenu.cpp noticemenu.h) -add_library(notification-ukcc-plugin SHARED ${notification-ukcc-plugin_LIB_SRCS}) - -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) +find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Widgets LinguistTools REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools REQUIRED) find_package(PkgConfig REQUIRED) set(UKUI_NOTIFICATION_EXTERNAL_LIBS "") set(UKUI_NOTIFICATION_PC_PKGS kysdk-qtwidgets) @@ -26,6 +24,17 @@ include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS}) include_directories(../libukui-notification/notification-settings) include_directories(../libukui-notification) + +file(GLOB TS_FILES "${PROJECT_SOURCE_DIR}/notification-ukcc-plugin/translations/*.ts") +qt5_add_translation(QM_FILES ${TS_FILES}) +#set(QM_FILES ${QM_FILES} PARENT_SCOPE) +add_custom_target(translations ALL DEPENDS ${QM_FILES}) + +add_library(notification-ukcc-plugin SHARED + ${notification-ukcc-plugin_LIB_SRCS} + ${QM_FILES} + ) + target_link_libraries(notification-ukcc-plugin PRIVATE Qt${QT_VERSION_MAJOR}::Core @@ -34,5 +43,7 @@ target_link_libraries(notification-ukcc-plugin ukui-notification ukcc ) -install(TARGETS notification-ukcc-plugin DESTINATION /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/ukui-control-center) + +install(TARGETS notification-ukcc-plugin DESTINATION /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/ukui-control-center) +install(FILES ${TS_FILES} ${QM_FILES} DESTINATION /usr/share/ukui-notification/notification-ukcc-plugin/translations) diff --git a/notification-ukcc-plugin/notification-ukcc-plugin.cpp b/notification-ukcc-plugin/notification-ukcc-plugin.cpp index b920f6b..8aaae95 100644 --- a/notification-ukcc-plugin/notification-ukcc-plugin.cpp +++ b/notification-ukcc-plugin/notification-ukcc-plugin.cpp @@ -8,6 +8,8 @@ #include #include #include +#include +#include #define THEME_QT_SCHEMA "org.ukui.style" @@ -25,6 +27,12 @@ protected: Notice::Notice() { + QTranslator* translator = new QTranslator(this); + if(!translator->load("/usr/share/ukui-notification/notification-ukcc-plugin/translations/" + QLocale::system().name())) { + qWarning() << "/usr/share/ukui-notification/notification-ukcc-plugin/translations/" + QLocale::system().name() << "load failed"; + } + QApplication::installTranslator(translator); + m_pluginName = tr("Notice"); m_pluginType = SYSTEM; @@ -82,6 +90,11 @@ const QString Notice::name() const return QStringLiteral("Notice"); } +QString Notice::translationPath() const +{ + return QStringLiteral("/usr/share/ukui-notification/notification-ukcc-plugin/translations/%1.ts"); +} + bool Notice::isShowOnHomePage() const { return false; diff --git a/notification-ukcc-plugin/notification-ukcc-plugin.h b/notification-ukcc-plugin/notification-ukcc-plugin.h index ac219c0..81dbffd 100644 --- a/notification-ukcc-plugin/notification-ukcc-plugin.h +++ b/notification-ukcc-plugin/notification-ukcc-plugin.h @@ -36,6 +36,7 @@ public: int pluginTypes() Q_DECL_OVERRIDE; QWidget * pluginUi() Q_DECL_OVERRIDE; const QString name() const Q_DECL_OVERRIDE; + QString translationPath() const; bool isShowOnHomePage() const Q_DECL_OVERRIDE; QIcon icon() const Q_DECL_OVERRIDE; bool isEnable() const Q_DECL_OVERRIDE; diff --git a/notification-ukcc-plugin/translations/bo_CN.ts b/notification-ukcc-plugin/translations/bo_CN.ts new file mode 100644 index 0000000..be1a4e5 --- /dev/null +++ b/notification-ukcc-plugin/translations/bo_CN.ts @@ -0,0 +1,96 @@ + + + + + Notice + + + Notice + བརྡ་ཐོ། + + + + NotFaze Mode + མི་དམངས་ཀྱི་དཔེ་དབྱིབས་མིན་པ། + + + + (Notification banners, prompts will be hidden, and notification sounds will be muted) + (བརྡ་ཐོ་གཏོང་བའི་འཕྲེད་འགེལ་སྦྱར་ཡིག་དང་། བརྡ་གཏོང་ཡི་གེ་སྦས་སྐུང་བྱས་ནས་བརྡ་ཁྱབ་ཀྱི་སྒྲ་གྲགས་ཡོང་། ) + + + + Automatically turn on + རང་འགུལ་གྱིས་ཁ་ཕྱེ་བ། + + + + to + དེ་ལྟར་བྱས་ན་ + + + + Automatically turn on when multiple screens are connected + བརྙན་ཤེལ་མང་པོ་སྦྲེལ་མཐུད་བྱེད་སྐབས་རང་འགུལ་གྱིས་ཁ་ཕྱེ་བ། + + + + Automatically open in full screen mode + བརྙན་ཤེལ་ཧྲིལ་པོའི་རྣམ་པའི་ཐོག་ནས་རང་འགུལ་གྱིས་སྒོ་ + + + + Allow automatic alarm reminders in Do Not Disturb mode + རང་འགུལ་གྱིས་ཉེན་བརྡ་གཏོང་བའི་དྲན་སྐུལ་བྱེད་སྟངས་ལ་སུན་པོ་བཟོ་མི་རུང་། + + + + Notice Settings + བརྡ་ཐོའི་སྒྲིག་བཀོད། + + + + Get notifications from the app + ཉེར་སྤྱོད་གོ་རིམ་ཁྲོད་ནས་བརྡ་ཐོ་གཏོང་དགོས། + /notice/Get notifications from the app + + + + NoticeMenu + + + Beep sound when notified + བརྡ་ཐོ་གཏོང་སྐབས་སྐད་ཅོར་རྒྱག་པ། + + + + Show message on screenlock + བརྙན་ཤེལ་སྟེང་ནས་ཆ་འཕྲིན་མངོན་པ། + + + + Show noticfication on screenlock + བརྙན་ཤེལ་སྟེང་ནས་དོ་སྣང་བྱེད་པ། + + + + Notification Style + བརྡ་ཐོ་གཏོང་སྟངས། + + + + Banner: Appears in the upper right corner of the screen, and disappears automatically + འཕྲེད་འགེལ་ཡི་གེ། བརྙན་ཤེལ་གྱི་གཡས་ཟུར་དུ་མངོན་པ་མ་ཟད། རང་འགུལ་གྱིས་མེད་པར་གྱུར་པ། + + + + Tip:It will be kept on the screen until it is closed + རྩེ་མོ། འཆར་ངོས་སུ་ཉར་ཚགས་བྱས་ནས་སྒོ་མ་བརྒྱབ་གོང་ལ་ཉར་ཚགས་བྱེད་དགོས། + + + + None:Notifications will not be displayed on the screen, but will go to the notification center + གཅིག་ཀྱང་མ་ལུས་པར་འཆར་ངོས་སུ་བརྡ་ཐོ་མི་མངོན་པར་བརྡ་ཁྱབ་ལྟེ་གནས་སུ་འགྲོ་རྒྱུ་རེད། + + + diff --git a/notification-ukcc-plugin/translations/en_US.ts b/notification-ukcc-plugin/translations/en_US.ts new file mode 100644 index 0000000..eee95e1 --- /dev/null +++ b/notification-ukcc-plugin/translations/en_US.ts @@ -0,0 +1,96 @@ + + + + + Notice + + + Notice + Notice + + + + NotFaze Mode + NotFaze Mode + + + + (Notification banners, prompts will be hidden, and notification sounds will be muted) + (Notification banners, prompts will be hidden, and notification sounds will be muted) + + + + Automatically turn on + Automatically turn on + + + + to + to + + + + Automatically turn on when multiple screens are connected + Automatically turn on when multiple screens are connected + + + + Automatically open in full screen mode + Automatically open in full screen mode + + + + Allow automatic alarm reminders in Do Not Disturb mode + Allow automatic alarm reminders in Do Not Disturb mode + + + + Notice Settings + Notice Settings + + + + Get notifications from the app + Get notifications from the app + /notice/Get notifications from the app + + + + NoticeMenu + + + Beep sound when notified + Beep sound when notified + + + + Show message on screenlock + Show message on screenlock + + + + Show noticfication on screenlock + Show noticfication on screenlock + + + + Notification Style + Notification Style + + + + Banner: Appears in the upper right corner of the screen, and disappears automatically + Banner: Appears in the upper right corner of the screen, and disappears automatically + + + + Tip:It will be kept on the screen until it is closed + Tip:It will be kept on the screen until it is closed + + + + None:Notifications will not be displayed on the screen, but will go to the notification center + None:Notifications will not be displayed on the screen, but will go to the notification center + + + diff --git a/notification-ukcc-plugin/translations/zh_CN.ts b/notification-ukcc-plugin/translations/zh_CN.ts new file mode 100644 index 0000000..e4dcd86 --- /dev/null +++ b/notification-ukcc-plugin/translations/zh_CN.ts @@ -0,0 +1,96 @@ + + + + + Notice + + + Notice + 通知 + + + + NotFaze Mode + 勿扰模式 + + + + (Notification banners, prompts will be hidden, and notification sounds will be muted) + (通知横幅、提示将会隐藏,通知声音将会静音) + + + + Automatically turn on + 自动开启 + + + + to + + + + + Automatically turn on when multiple screens are connected + 多屏连接时自动开启 + + + + Automatically open in full screen mode + 全屏模式下自动开启 + + + + Allow automatic alarm reminders in Do Not Disturb mode + 勿扰模式下允许闹钟提示 + + + + Notice Settings + 通知 + + + + Get notifications from the app + 获取来自应用的通知 + /notice/Get notifications from the app + + + + NoticeMenu + + + Beep sound when notified + 通知时提示声音 + + + + Show message on screenlock + 在锁屏界面显示消息内容 + + + + Show noticfication on screenlock + 在锁屏界面显示通知 + + + + Notification Style + 通知样式 + + + + Banner: Appears in the upper right corner of the screen, and disappears automatically + 横幅:显示在屏幕右上角,会自动消失 + + + + Tip:It will be kept on the screen until it is closed + 提示:会保留在屏幕上,直到被关闭 + + + + None:Notifications will not be displayed on the screen, but will go to the notification center + 无:通知不会显示在屏幕上,但会进入通知中心 + + +