From dcca2d78d5c4a899dcf25c7ca9c357b544720f95 Mon Sep 17 00:00:00 2001 From: Serein <2075337935@qq.com> Date: Wed, 25 Sep 2024 17:05:42 +0800 Subject: [PATCH] feat: change locale file location --- src/Infrastructure/Utils/Config.h | 11 +++++++++++ src/main.cc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/Utils/Config.h b/src/Infrastructure/Utils/Config.h index f53465de..a634823a 100644 --- a/src/Infrastructure/Utils/Config.h +++ b/src/Infrastructure/Utils/Config.h @@ -35,6 +35,17 @@ const std::filesystem::path configDir = inline toml::table config; +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 +#endif // EVENTO_DEBUG + inline struct Settings { bool minimalToTray; bool noticeBegin; diff --git a/src/main.cc b/src/main.cc index 8a1ec686..1e116621 100644 --- a/src/main.cc +++ b/src/main.cc @@ -15,7 +15,7 @@ int main(int argc, char** argv) { evento::initConfig(); spdlog::info("SAST Evento version: v" VERSION_FULL); - bindtextdomain("sast-evento", LOCALE_DIR); + bindtextdomain("sast-evento", evento::localePath.string().c_str()); std::locale::global(std::locale("")); evento::UiBridge uiBridge(App::create());