fix: 修复任务栏上应用右键菜单存在英文的问题

修复任务栏上应用右键菜单存在英文的问题

Log:
Task: https://pms.uniontech.com/task-view-146103.html
Influence: 任务栏应用右键菜单语言显示正常
Change-Id: I4ea46b1ee756be66f9a2dc5cf00b692d6e335634
This commit is contained in:
weizhixiang 2022-06-09 10:38:21 +08:00
parent 78a345855a
commit 58e15c84bf
6 changed files with 38 additions and 7 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
CMakeLists.txt.user
build/
# translations files
*.qm

View File

@ -7,3 +7,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(src)
add_subdirectory(misc)
if (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug"))
# generate qm
execute_process(COMMAND bash "translate_generation.sh"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif ()
# qm files
file(GLOB QM_FILES "translations/*.qm")
install(FILES ${QM_FILES}
DESTINATION share/dde-application-manager/translations)

View File

@ -741,7 +741,7 @@ AppMenuItem Entry::getMenuItemLaunch()
if (hasWindow()) {
itemName = getName();
} else {
itemName = "Open";
itemName = tr("Open");
}
AppMenuAction fn = [this](uint32_t timestamp) {
@ -780,7 +780,7 @@ AppMenuItem Entry::getMenuItemCloseAll()
};
AppMenuItem item;
item.text = "Close All";
item.text = tr("Close All");
item.action = fn;
item.isActive = true;
return item;
@ -795,7 +795,7 @@ AppMenuItem Entry::getMenuItemForceQuit()
};
AppMenuItem item;
item.text = "Force Quit";
item.text = tr("Force Quit");
item.action = fn;
item.isActive = active;
return item;
@ -817,7 +817,7 @@ AppMenuItem Entry::getMenuItemForceQuitAndroid()
}
AppMenuItem item;
item.text = "Force Quit";
item.text = tr("Force Quit");
item.action = fn;
item.isActive = active;
return item;
@ -826,7 +826,7 @@ AppMenuItem Entry::getMenuItemForceQuitAndroid()
AppMenuItem Entry::getMenuItemDock()
{
AppMenuItem item;
item.text = "Dock";
item.text = tr("Dock");
item.action = [this](uint32_t) {
qInfo() << "do MenuItem: Dock";
requestDock();
@ -839,7 +839,7 @@ AppMenuItem Entry::getMenuItemDock()
AppMenuItem Entry::getMenuItemUndock()
{
AppMenuItem item;
item.text = "Undock";
item.text = tr("Undock");
item.action = [this](uint32_t) {
qInfo() << "do MenuItem: Undock";
requestUndock();
@ -852,7 +852,7 @@ AppMenuItem Entry::getMenuItemUndock()
AppMenuItem Entry::getMenuItemAllWindows()
{
AppMenuItem item;
item.text = "All Windows";
item.text = tr("All Windows");
item.action = [this](uint32_t) {
qInfo() << "do MenuItem: All Windows";
presentWindows();

View File

@ -59,4 +59,6 @@ target_include_directories(deepin-application-manager PUBLIC
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
)
# binary file
install(TARGETS deepin-application-manager DESTINATION bin)

View File

@ -72,6 +72,10 @@ int main(int argc, char *argv[])
DLogManager::registerConsoleAppender();
DLogManager::registerFileAppender();
QTranslator *translator = new QTranslator();
translator->load(QString("/usr/share/dde-application-manager/translations/dde-application-manager_%1.qm").arg(QLocale::system().name()));
QCoreApplication::installTranslator(translator);
new AppManager(ApplicationManager::instance());
new LauncherManager(ApplicationManager::instance());
new DockManager(ApplicationManager::instance());

11
translate_generation.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# this file is used to auto-generate .qm file from .ts file.
# author: shibowen at linuxdeepin.com
ts_list=(`ls translations/*.ts`)
for ts in "${ts_list[@]}"
do
printf "\nprocess ${ts}\n"
lrelease "${ts}"
done