X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fgettext.cpp;h=0c0e520ca169e4322834edc5cfb647e0f92e6959;hb=9e4e7072da8f565eef37da7558053a436b9cbba3;hp=455c78584034eebe365e3dc024065dcebb9bec6b;hpb=22a59b3912ff5e7bb1516faa06f1841545a8117c;p=oweals%2Fminetest.git diff --git a/src/gettext.cpp b/src/gettext.cpp index 455c78584..0c0e520ca 100644 --- a/src/gettext.cpp +++ b/src/gettext.cpp @@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "gettext.h" #include "util/string.h" -#if USE_GETTEXT and defined(_MSC_VER) +#if USE_GETTEXT && defined(_MSC_VER) #include #include #include @@ -142,13 +142,14 @@ void init_gettext(const char *path,std::string configured_language) { SetEnvironmentVariableA("LANGUAGE",configured_language.c_str()); +#ifndef SERVER //very very dirty workaround to force gettext to see the right environment if (current_language_var != configured_language) { STARTUPINFO startupinfo; PROCESS_INFORMATION processinfo; memset(&startupinfo,0,sizeof(startupinfo)); memset(&processinfo,0,sizeof(processinfo)); - errorstream << "MSVC localization workaround aktive restating minetest in new environment!" << std::endl; + errorstream << "MSVC localization workaround active restating minetest in new environment!" << std::endl; std::string parameters = ""; @@ -199,6 +200,13 @@ void init_gettext(const char *path,std::string configured_language) { else { exit(0); } +#else + errorstream << "*******************************************************" << std::endl; + errorstream << "Can't apply locale workaround for server!" << std::endl; + errorstream << "Expect language to be broken!" << std::endl; + errorstream << "*******************************************************" << std::endl; + +#endif } setlocale(LC_ALL,configured_language.c_str()); @@ -243,15 +251,17 @@ void init_gettext(const char *path,std::string configured_language) { //errorstream << "Gettext debug: domainname = " << tdomain << "; codeset = "<< codeset << std::endl; #endif // defined(_WIN32) +#else + /* set current system default locale */ + setlocale(LC_ALL, ""); +#endif // if USE_GETTEXT + /* no matter what locale is used we need number format to be "C" */ /* to ensure formspec parameters are evaluated correct! */ - setlocale(LC_NUMERIC,"C"); infostream << "Message locale is now set to: " << setlocale(LC_ALL,0) << std::endl; - -#endif // if USE_GETTEXT }