diff options
author | Adam <Adam@anope.org> | 2012-09-10 21:39:04 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-09-10 21:39:04 -0400 |
commit | f391100586375fdf83c3e73cab173f08125920f3 (patch) | |
tree | 4e717c03f03bf945212c116ac3af178124b9b17e | |
parent | c4a1e1bb0c82c954657dc39c5abbc29978bef701 (diff) |
Fixed gettext on freebsd/any other system that uses LANG not LANGUAGE
-rw-r--r-- | src/language.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/language.cpp b/src/language.cpp index 2b41d755e..c62a950aa 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -82,13 +82,14 @@ const char *anope_gettext(const char *lang, const char *string) #ifdef _WIN32 SetThreadLocale(MAKELCID(MAKELANGID(WindowsGetLanguage(lang), SUBLANG_DEFAULT), SORT_DEFAULT)); #else - /* First, set LANGUAGE env variable. + /* First, set LANG and LANGUAGE env variables. * Some systems (Debian) don't care about this, so we must setlocale LC_ALL aswell. * BUT if this call fails because the LANGUAGE env variable is set, setlocale resets * the locale to "C", which short circuits gettext and causes it to fail on systems that * use the LANGUAGE env variable. We must reset the locale to en_US (or, anything not * C or POSIX) then. */ + setenv("LANG", lang, 1); setenv("LANGUAGE", lang, 1); if (setlocale(LC_ALL, lang) == NULL) setlocale(LC_ALL, "en_US"); @@ -100,6 +101,7 @@ const char *anope_gettext(const char *lang, const char *string) SetThreadLocale(MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), SORT_DEFAULT)); #else unsetenv("LANGUAGE"); + unsetenv("LANG"); setlocale(LC_ALL, ""); #endif |