控制面板插件新增翻译文件;

This commit is contained in:
jixiaoxu 2023-03-28 15:20:03 +08:00
parent 15310ab084
commit 1bc2e4ff9d
6 changed files with 318 additions and 5 deletions

View File

@ -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)

View File

@ -8,6 +8,8 @@
#include <QToolButton>
#include <QFile>
#include <QThread>
#include <QApplication>
#include <QTranslator>
#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;

View File

@ -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;

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="bo_CN" sourcelanguage="en">
<context>
<name>Notice</name>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="35"/>
<source>Notice</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="126"/>
<source>NotFaze Mode</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="128"/>
<source>(Notification banners, prompts will be hidden, and notification sounds will be muted)</source>
<translation>( )</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="202"/>
<source>Automatically turn on</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="227"/>
<source>to</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="252"/>
<source>Automatically turn on when multiple screens are connected</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="257"/>
<source>Automatically open in full screen mode</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="262"/>
<source>Allow automatic alarm reminders in Do Not Disturb mode</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="292"/>
<source>Notice Settings</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="294"/>
<source>Get notifications from the app</source>
<translation></translation>
<extra-contents_path>/notice/Get notifications from the app</extra-contents_path>
</message>
</context>
<context>
<name>NoticeMenu</name>
<message>
<location filename="../noticemenu.cpp" line="86"/>
<source>Beep sound when notified</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="92"/>
<source>Show message on screenlock</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="98"/>
<source>Show noticfication on screenlock</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="102"/>
<source>Notification Style</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="110"/>
<source>Banner: Appears in the upper right corner of the screen, and disappears automatically</source>
<translation> </translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="115"/>
<source>Tip:It will be kept on the screen until it is closed</source>
<translation> </translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="120"/>
<source>None:Notifications will not be displayed on the screen, but will go to the notification center</source>
<translation></translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en" sourcelanguage="en">
<context>
<name>Notice</name>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="35"/>
<source>Notice</source>
<translation>Notice</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="126"/>
<source>NotFaze Mode</source>
<translation>NotFaze Mode</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="128"/>
<source>(Notification banners, prompts will be hidden, and notification sounds will be muted)</source>
<translation>(Notification banners, prompts will be hidden, and notification sounds will be muted)</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="202"/>
<source>Automatically turn on</source>
<translation>Automatically turn on</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="227"/>
<source>to</source>
<translation>to</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="252"/>
<source>Automatically turn on when multiple screens are connected</source>
<translation>Automatically turn on when multiple screens are connected</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="257"/>
<source>Automatically open in full screen mode</source>
<translation>Automatically open in full screen mode</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="262"/>
<source>Allow automatic alarm reminders in Do Not Disturb mode</source>
<translation>Allow automatic alarm reminders in Do Not Disturb mode</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="292"/>
<source>Notice Settings</source>
<translation>Notice Settings</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="294"/>
<source>Get notifications from the app</source>
<translation>Get notifications from the app</translation>
<extra-contents_path>/notice/Get notifications from the app</extra-contents_path>
</message>
</context>
<context>
<name>NoticeMenu</name>
<message>
<location filename="../noticemenu.cpp" line="86"/>
<source>Beep sound when notified</source>
<translation>Beep sound when notified</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="92"/>
<source>Show message on screenlock</source>
<translation>Show message on screenlock</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="98"/>
<source>Show noticfication on screenlock</source>
<translation>Show noticfication on screenlock</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="102"/>
<source>Notification Style</source>
<translation>Notification Style</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="110"/>
<source>Banner: Appears in the upper right corner of the screen, and disappears automatically</source>
<translation>Banner: Appears in the upper right corner of the screen, and disappears automatically</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="115"/>
<source>Tip:It will be kept on the screen until it is closed</source>
<translation>Tip:It will be kept on the screen until it is closed</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="120"/>
<source>None:Notifications will not be displayed on the screen, but will go to the notification center</source>
<translation>None:Notifications will not be displayed on the screen, but will go to the notification center</translation>
</message>
</context>
</TS>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN" sourcelanguage="en">
<context>
<name>Notice</name>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="35"/>
<source>Notice</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="126"/>
<source>NotFaze Mode</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="128"/>
<source>(Notification banners, prompts will be hidden, and notification sounds will be muted)</source>
<translation>()</translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="202"/>
<source>Automatically turn on</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="227"/>
<source>to</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="252"/>
<source>Automatically turn on when multiple screens are connected</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="257"/>
<source>Automatically open in full screen mode</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="262"/>
<source>Allow automatic alarm reminders in Do Not Disturb mode</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="292"/>
<source>Notice Settings</source>
<translation></translation>
</message>
<message>
<location filename="../notification-ukcc-plugin.cpp" line="294"/>
<source>Get notifications from the app</source>
<translation></translation>
<extra-contents_path>/notice/Get notifications from the app</extra-contents_path>
</message>
</context>
<context>
<name>NoticeMenu</name>
<message>
<location filename="../noticemenu.cpp" line="86"/>
<source>Beep sound when notified</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="92"/>
<source>Show message on screenlock</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="98"/>
<source>Show noticfication on screenlock</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="102"/>
<source>Notification Style</source>
<translation></translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="110"/>
<source>Banner: Appears in the upper right corner of the screen, and disappears automatically</source>
<translation>横幅:显示在屏幕右上角</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="115"/>
<source>Tip:It will be kept on the screen until it is closed</source>
<translation>提示:会保留在屏幕上</translation>
</message>
<message>
<location filename="../noticemenu.cpp" line="120"/>
<source>None:Notifications will not be displayed on the screen, but will go to the notification center</source>
<translation>:通知不会显示在屏幕上</translation>
</message>
</context>
</TS>