From 1d10314a6d1b6a0a845a5f0c316c09fda030974b Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 5 Jan 2023 11:36:23 -0400 Subject: [PATCH] Install the locale directory in a standard location * fixed builds in linux distributions * backported https://github.com/minetest/minetest/commit/2349d31bae1bfc4d58fd88efbc88261e69b11dad * related: https://github.com/minetest/minetest/pull/9618 * backported https://github.com/minetest/minetest/commit/ca8957f500980849fbd3e0c05b7cf3272b18ac97 * Fix detection of in-place path_locale when RUN_IN_PLACE=0 * related: https://github.com/minetest/minetest/issues/9745 --- CMakeLists.txt | 2 +- src/porting.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce79725bf..a7fd713fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,7 +135,7 @@ elseif(UNIX) # Linux, BSD etc set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo") set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") - set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale") + set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/locale") endif() endif() diff --git a/src/porting.cpp b/src/porting.cpp index 0a9de2a59..e8b7a2df3 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -577,7 +577,12 @@ void initializePaths() #ifdef USE_GETTEXT bool found_localedir = false; # ifdef STATIC_LOCALEDIR - if (STATIC_LOCALEDIR[0] && fs::PathExists(STATIC_LOCALEDIR)) { + path_locale = getDataPath("locale"); + if (fs::PathExists(path_locale)) { + found_localedir = true; + infostream << "Using in-place locale directory " << path_locale + << " even though a static one was provided." << std::endl; + } else if (STATIC_LOCALEDIR[0] && fs::PathExists(STATIC_LOCALEDIR)) { found_localedir = true; path_locale = STATIC_LOCALEDIR; infostream << "Using locale directory " << STATIC_LOCALEDIR << std::endl;