更新前端翻译文件安装位置

This commit is contained in:
iaom 2023-08-25 10:00:07 +08:00
parent a8c400cdb0
commit 13b9eaa25f
2 changed files with 5 additions and 4 deletions

View File

@ -65,9 +65,10 @@ add_executable(ukui-search
${QRC_FILES}
${UKUI_SEARCH_QM_FILES}
${UKUI_SEARCH_APP_WIDGET_QM_FILES})
set(UKUI_SEARCH_QM_INSTALL_PATH /usr/share/ukui-search/translations/ukui-search)
target_compile_definitions(ukui-search PRIVATE
VERSION="${UKUI_SEARCH_VERSION}"
UKUI_SEARCH_QM_INSTALL_PATH="${UKUI_SEARCH_QM_INSTALL_PATH}"
)
target_link_libraries(ukui-search PRIVATE
@ -117,7 +118,7 @@ install(FILES ${UKUI_SEARCH_APP_WIDGET_QM_FILES} DESTINATION /usr/share/appwidge
#
install(TARGETS ukui-search RUNTIME DESTINATION /usr/bin)
#
install(FILES ${UKUI_SEARCH_QM_FILES} DESTINATION /usr/share/ukui-search/translations/)
install(FILES ${UKUI_SEARCH_QM_FILES} DESTINATION ${UKUI_SEARCH_QM_INSTALL_PATH})
#desktop
install(FILES ../data/ukui-search-menu.desktop DESTINATION /usr/share/applications)
install(FILES ../data/ukui-search.desktop DESTINATION /etc/xdg/autostart)

View File

@ -45,10 +45,10 @@ UkuiSearchGui::UkuiSearchGui(int &argc, char *argv[], const QString &application
//load translations.
QTranslator *translator = new QTranslator(this);
try {
if(! translator->load("/usr/share/ukui-search/translations/" + QLocale::system().name())) throw - 1;
if(! translator->load(UKUI_SEARCH_QM_INSTALL_PATH"/" + QLocale::system().name())) throw - 1;
this->installTranslator(translator);
} catch(...) {
qDebug() << "Load translations file" << QLocale() << "failed!";
qDebug() << "Load translations file: " << UKUI_SEARCH_QM_INSTALL_PATH << QLocale() << "failed!";
}
QTranslator *qt_translator = new QTranslator(this);