aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2020-04-25 15:44:32 +0200
committersfan5 <sfan5@live.de>2020-04-27 17:50:05 +0200
commitca8957f500980849fbd3e0c05b7cf3272b18ac97 (patch)
tree8c35776597ce8e0ecad7d5f39398e26129ebdec1 /src
parent13a8ea2dac2217cc898c7fc62c448f4ff6998d46 (diff)
downloadminetest-ca8957f500980849fbd3e0c05b7cf3272b18ac97.tar.gz
minetest-ca8957f500980849fbd3e0c05b7cf3272b18ac97.tar.bz2
minetest-ca8957f500980849fbd3e0c05b7cf3272b18ac97.zip
Fix detection of in-place path_locale when RUN_IN_PLACE=0
broken by 2349d31bae1bfc4d58fd88efbc88261e69b11dad (side effect) fixes #9745
Diffstat (limited to 'src')
-rw-r--r--src/gettext.cpp5
-rw-r--r--src/porting.cpp20
2 files changed, 14 insertions, 11 deletions
diff --git a/src/gettext.cpp b/src/gettext.cpp
index 81621ba89..6818004df 100644
--- a/src/gettext.cpp
+++ b/src/gettext.cpp
@@ -217,7 +217,10 @@ void init_gettext(const char *path, const std::string &configured_language,
#endif
#endif
- static std::string name = lowercase(PROJECT_NAME);
+ std::string name = lowercase(PROJECT_NAME);
+ infostream << "Gettext: domainname=\"" << name
+ << "\" path=\"" << path << "\"" << std::endl;
+
bindtextdomain(name.c_str(), path);
textdomain(name.c_str());
diff --git a/src/porting.cpp b/src/porting.cpp
index 76fd592d6..c0381ad06 100644
--- a/src/porting.cpp
+++ b/src/porting.cpp
@@ -598,18 +598,18 @@ void initializePaths()
#if USE_GETTEXT
bool found_localedir = false;
# ifdef STATIC_LOCALEDIR
- if (STATIC_LOCALEDIR[0] && fs::PathExists(STATIC_LOCALEDIR)) {
+ /* STATIC_LOCALEDIR may be a generalized path such as /usr/share/locale that
+ * doesn't necessarily contain our locale files, so check data path first. */
+ 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;
- } else {
- 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 "
- << "(RUN_IN_PLACE or CUSTOM_LOCALEDIR)." << std::endl;
- }
+ infostream << "Using static locale directory " << STATIC_LOCALEDIR
+ << std::endl;
}
# else
path_locale = getDataPath("locale");