Install the locale directory in a standard location

* fixed builds in linux distributions
* backported 2349d31bae
* related: https://github.com/minetest/minetest/pull/9618
* backported ca8957f500
* Fix detection of in-place path_locale when RUN_IN_PLACE=0
* related: https://github.com/minetest/minetest/issues/9745
This commit is contained in:
mckaygerhard 2023-01-05 11:36:23 -04:00
parent be06a8ad6b
commit 1d10314a6d
2 changed files with 7 additions and 2 deletions

View File

@ -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()

View File

@ -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;