summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPevernow <3450354617@qq.com>2021-08-09 00:59:07 +0800
committerGitHub <noreply@github.com>2021-08-08 18:59:07 +0200
commitc6eddb0bae32c43ffff46e9c1e3f293d0fd9ed73 (patch)
treec8cfd861330d8be7970ed67ae4e70d92b703e3f5 /src
parent4a3728d828fa8896b49e80fdc68f5d7647bf45b7 (diff)
downloadminetest-c6eddb0bae32c43ffff46e9c1e3f293d0fd9ed73.tar.gz
minetest-c6eddb0bae32c43ffff46e9c1e3f293d0fd9ed73.tar.bz2
minetest-c6eddb0bae32c43ffff46e9c1e3f293d0fd9ed73.zip
Gettext support on Android (#11435)
Co-authored-by: sfan5 <sfan5@live.de> Co-authored-by: =?UTF-8?q?Olivier=20Samyn=20=F0=9F=8E=BB?= <code@oleastre.be>
Diffstat (limited to 'src')
-rw-r--r--src/gettext.cpp4
-rw-r--r--src/gui/modalMenu.cpp2
-rw-r--r--src/porting_android.cpp1
3 files changed, 6 insertions, 1 deletions
diff --git a/src/gettext.cpp b/src/gettext.cpp
index 6818004df..de042cf35 100644
--- a/src/gettext.cpp
+++ b/src/gettext.cpp
@@ -127,6 +127,10 @@ void init_gettext(const char *path, const std::string &configured_language,
// Add user specified locale to environment
setenv("LANGUAGE", configured_language.c_str(), 1);
+#ifdef __ANDROID__
+ setenv("LANG", configured_language.c_str(), 1);
+#endif
+
// Reload locale with changed environment
setlocale(LC_ALL, "");
#elif defined(_MSC_VER)
diff --git a/src/gui/modalMenu.cpp b/src/gui/modalMenu.cpp
index 0d3fb55f0..1016de389 100644
--- a/src/gui/modalMenu.cpp
+++ b/src/gui/modalMenu.cpp
@@ -268,7 +268,7 @@ bool GUIModalMenu::preprocessEvent(const SEvent &event)
std::string label = wide_to_utf8(getLabelByID(hovered->getID()));
if (label.empty())
label = "text";
- message += gettext(label) + ":";
+ message += strgettext(label) + ":";
// single line text input
int type = 2;
diff --git a/src/porting_android.cpp b/src/porting_android.cpp
index f5870c174..29e95b8ca 100644
--- a/src/porting_android.cpp
+++ b/src/porting_android.cpp
@@ -190,6 +190,7 @@ void initializePathsAndroid()
path_user = path_storage + DIR_DELIM + PROJECT_NAME_C;
path_share = path_storage + DIR_DELIM + PROJECT_NAME_C;
+ path_locale = path_share + DIR_DELIM + "locale";
path_cache = getAndroidPath(nativeActivity,
app_global->activity->clazz, mt_getAbsPath, "getCacheDir");
migrateCachePath();