aboutsummaryrefslogtreecommitdiff
path: root/util
Commit message (Expand)AuthorAge
* Release test build to Android beta programrubenwardy2020-06-25
* Rename “Minimal development test” to “Development Test” (#9928)Wuzzy2020-05-26
* ci: Update Github Actions workflows (#9774)sfan52020-05-02
* Add MetricsBackend with prometheus counter supportLoic Blot2020-04-29
* Replace travis with github actions (#9641)Loïc Blot2020-04-20
* Update wireshark dissector (#9621)sfan52020-04-14
* Refactor texture overrides and add new features (#9600)Hugues Ross2020-04-14
* Drop content_sao.{cpp,h}Loic Blot2020-04-11
* Move serveractiveobject & unitsaoLoic Blot2020-04-11
* Drop genericobject.{cpp,h} (#9629)Loïc Blot2020-04-10
* Travis: Build clang jobs with LuaJIT enabled for better coveragesfan52020-04-08
* Utility script to help with Weblate commit importsfan52020-04-03
* Travis: Correct Linux dependencies so that PostgreSQL is found by CMakesfan52020-03-28
* Add comments for translators (#9510)Wuzzy2020-03-20
* Update clang-tidy configuration and scriptssfan52020-03-12
* buildbot: Update to newer MinGW gcc 9.2sfan52020-03-12
* Update travis build infrastructuresfan52020-03-12
* Add animated_image[] formspec element (#9258)Hugues Ross2020-02-15
* Update some libraries for buildbotsfan52020-02-12
* Formspec: Create a new class for inventorylists (#9287)DS2020-02-01
* Add 9-slice background support to button formspec elements (#9290)Hugues Ross2020-01-26
* Refactor to centralize GUIButton styling/rendering code (#9090)Hugues Ross2019-12-09
* Fix clang-tidy and lint travis checkssfan52019-11-11
* Silence invalid Clang Format report (#9095)Paramat2019-11-09
* Formspec: add hypertext elementPierre-Yves Rollo2019-11-03
* Move Quicktune code to util/ (#8871)ANAND2019-09-29
* Update curl dependency in buildbotsfan52019-08-05
* Add custom colorable GUIButton implementationrubenwardy2019-08-03
* Silence invalid clang format warnings in guiScrollBar.cpp (#8724)Paramat2019-07-31
* Improve buildbot scriptPierre-Yves Rollo2019-06-21
* Update our tooling (Clang 5 -> 7, GCC 7 -> 8)Loïc Blot2019-03-14
* Update a few dependency versions for buildbot (#8319)sfan52019-03-07
* Revert "Revert CSM particles commit to fix particle spawner bug for 5.0.0 (#8...Loïc Blot2019-02-26
* Revert CSM particles commit to fix particle spawner bug for 5.0.0 (#8288)Paramat2019-02-26
* Attend to LINT sillyness (#8276)Paramat2019-02-23
* Fix fake LINT check success (#8092)Jozef Behran2019-01-12
* Fix dissector script to work with newer versions of Wireshark (#7957)meme2018-12-10
* Move client-specific files to 'src/client' (#7902)Quentin Bazin2018-11-28
* Make non-formspec modal menus respect gui scale (#7850)stujones112018-11-26
* Add release information to appdata file (#7771)Carles Pastor Badosa2018-10-16
* Revert 6587 - Optimize entity-entity collision (#7539)lhofhansl2018-07-08
* Fix release scriptLoïc Blot2018-06-14
* Disable clang-tidy when no C/C++ files has been modified.Loic Blot2018-06-10
* [clang-tidy] Promote some performance-* as a coding error (#7194)Loïc Blot2018-04-04
* Optimize entity-entity collision (#6587)Vitaliy2018-04-03
* 'fix' LINT, use InventoryLocation==SmallJoker2018-04-02
* LINT: add clang-tidy step (#6295)Loïc Blot2018-04-01
* Client eventmanager refactor (#7179)Loïc Blot2018-03-30
* Cleanup sound manager class (#7158)Loïc Blot2018-03-24
* [CSM] Add functions to create particles and particlespawners. (#6072)red-0012018-01-20
_supported_locales[name] = languagename; glb_supported_locales[name + L"_" + country] = languagename; } return true; } /******************************************************************************/ const char* MSVC_LocaleLookup(const char* raw_shortname) { /* NULL is used to read locale only so we need to return it too */ if (raw_shortname == NULL) return NULL; std::string shortname(raw_shortname); if (shortname == "C") return "C"; if (shortname == "") return ""; static std::string last_raw_value = ""; static std::string last_full_name = ""; static bool first_use = true; if (last_raw_value == shortname) { return last_full_name.c_str(); } if (first_use) { EnumSystemLocalesA(UpdateLocaleCallback, LCID_SUPPORTED | LCID_ALTERNATE_SORTS); first_use = false; } last_raw_value = shortname; if (glb_supported_locales.find(utf8_to_wide(shortname)) != glb_supported_locales.end()) { last_full_name = wide_to_utf8( glb_supported_locales[utf8_to_wide(shortname)]); return last_full_name.c_str(); } /* empty string is system default */ errorstream << "MSVC_LocaleLookup: unsupported locale: \"" << shortname << "\" switching to system default!" << std::endl; return ""; } #endif /******************************************************************************/ void init_gettext(const char *path, const std::string &configured_language, int argc, char *argv[]) { #if USE_GETTEXT // First, try to set user override environment if (!configured_language.empty()) { #ifndef _WIN32 // Add user specified locale to environment setenv("LANGUAGE", configured_language.c_str(), 1); // Reload locale with changed environment setlocale(LC_ALL, ""); #elif defined(_MSC_VER) std::string current_language; const char *env_lang = getenv("LANGUAGE"); if (env_lang) current_language = env_lang; _putenv(("LANGUAGE=" + configured_language).c_str()); SetEnvironmentVariableA("LANGUAGE", configured_language.c_str()); #ifndef SERVER // Hack to force gettext to see the right environment if (current_language != configured_language) { errorstream << "MSVC localization workaround active. " "Restarting " PROJECT_NAME_C " in a new environment!" << std::endl; std::string parameters; for (unsigned int i = 1; i < argc; i++) { if (!parameters.empty()) parameters += ' '; parameters += argv[i]; } const char *ptr_parameters = NULL; if (!parameters.empty()) ptr_parameters = parameters.c_str(); // Allow calling without an extension std::string app_name = argv[0]; if (app_name.compare(app_name.size() - 4, 4, ".exe") != 0) app_name += ".exe"; STARTUPINFO startup_info = {0}; PROCESS_INFORMATION process_info = {0}; bool success = CreateProcess(app_name.c_str(), (char *)ptr_parameters, NULL, NULL, false, DETACHED_PROCESS | CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &startup_info, &process_info); if (success) { exit(0); // NOTREACHED } else { char buffer[1024]; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT), buffer, sizeof(buffer) - 1, NULL); errorstream << "*******************************************************" << std::endl; errorstream << "CMD: " << app_name << std::endl; errorstream << "Failed to restart with current locale: " << std::endl; errorstream << buffer; errorstream << "Expect language to be broken!" << std::endl; errorstream << "*******************************************************" << std::endl; } } #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()); #else // Mingw _putenv(("LANGUAGE=" + configured_language).c_str()); setlocale(LC_ALL, ""); #endif // ifndef _WIN32 } else { /* set current system default locale */ setlocale(LC_ALL, ""); } #if defined(_WIN32) if (getenv("LANGUAGE") != 0) { setlocale(LC_ALL, getenv("LANGUAGE")); } #ifdef _MSC_VER else if (getenv("LANG") != 0) { setlocale(LC_ALL, getenv("LANG")); } #endif #endif std::string name = lowercase(PROJECT_NAME); infostream << "Gettext: domainname=\"" << name << "\" path=\"" << path << "\"" << std::endl; bindtextdomain(name.c_str(), path); textdomain(name.c_str()); #if defined(_WIN32) // Set character encoding for Win32 char *tdomain = textdomain( (char *) NULL ); if( tdomain == NULL ) { errorstream << "Warning: domainname parameter is the null pointer" << ", default domain is not set" << std::endl; tdomain = (char *) "messages"; } /* char *codeset = */bind_textdomain_codeset( tdomain, "UTF-8" ); //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; }