Skip to content

Commit

Permalink
fix: package locale files location
Browse files Browse the repository at this point in the history
  • Loading branch information
Serein207 committed Sep 25, 2024
1 parent dcca2d7 commit 3dc1841
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/3rdpart/sast-link-cxx-sdk/CMakeLists
message(FATAL_ERROR "Git submodule not found. Run `git submodule update --init` from the source tree to fetch the submodule contents.")
endif()

#i18n
set(SOURCE_LOCALE_DIR "${CMAKE_SOURCE_DIR}/ui/locale")

# source code
add_subdirectory(src)
# sast-link-sdk
Expand All @@ -78,6 +81,8 @@ set(BUILD_SHARED_LIBS ON)
file(WRITE ${CMAKE_BINARY_DIR}/sast-evento-version.txt ${VERSION_SEMANTIC})
install(FILES ${CMAKE_BINARY_DIR}/sast-evento-version.txt DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION .)
install(FILES ${SOURCE_LOCALE_DIR}/en/LC_MESSAGES/sast-evento.mo DESTINATION ./locale/en/LC_MESSAGES)
install(FILES ${SOURCE_LOCALE_DIR}/zh/LC_MESSAGES/sast-evento.mo DESTINATION ./locale/zh/LC_MESSAGES)
install(TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
8 changes: 4 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ if (WIN32)
endif()

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/ui/locale/en/LC_MESSAGES
COMMAND msgfmt ${CMAKE_SOURCE_DIR}/ui/locale/en.po -o ${CMAKE_SOURCE_DIR}/ui/locale/en/LC_MESSAGES/sast-evento.mo
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/ui/locale/en/LC_MESSAGES
COMMAND msgfmt ${CMAKE_SOURCE_DIR}/ui/locale/zh.po -o ${CMAKE_SOURCE_DIR}/ui/locale/zh/LC_MESSAGES/sast-evento.mo
COMMAND ${CMAKE_COMMAND} -E make_directory ${SOURCE_LOCALE_DIR}/en/LC_MESSAGES
COMMAND msgfmt ${SOURCE_LOCALE_DIR}/en.po -o ${SOURCE_LOCALE_DIR}/en/LC_MESSAGES/sast-evento.mo
COMMAND ${CMAKE_COMMAND} -E make_directory ${SOURCE_LOCALE_DIR}/zh/LC_MESSAGES
COMMAND msgfmt ${SOURCE_LOCALE_DIR}/zh.po -o ${SOURCE_LOCALE_DIR}/zh/LC_MESSAGES/sast-evento.mo
)

add_subdirectory(Tray)
7 changes: 2 additions & 5 deletions src/Infrastructure/Utils/Config.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <boost/dll.hpp>
#include <chrono>
#include <ctime>
#include <filesystem>
Expand Down Expand Up @@ -39,11 +40,7 @@ const std::filesystem::path localePath =
#ifdef EVENTO_DEBUG
LOCALE_DIR;
#else
#ifdef PLATFORM_LINUX
std::filesystem::path("/usr/share/locale");
#else
std::filesystem::current_path() / "locale";
#endif // PLATFORM_LINUX
boost::dll::program_location().parent_path() / "locale";
#endif // EVENTO_DEBUG

inline struct Settings {
Expand Down

0 comments on commit 3dc1841

Please sign in to comment.