diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index f78b0fe..401c86a 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -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) diff --git a/frontend/ukui-search-gui.cpp b/frontend/ukui-search-gui.cpp index 8611627..9fab07b 100644 --- a/frontend/ukui-search-gui.cpp +++ b/frontend/ukui-search-gui.cpp @@ -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);