1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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>
This commit is contained in:
Pevernow 2021-08-09 00:59:07 +08:00 committed by GitHub
parent 4a3728d828
commit c6eddb0bae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 6 deletions

View file

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

View file

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

View file

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