From f391100586375fdf83c3e73cab173f08125920f3 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 10 Sep 2012 21:39:04 -0400 Subject: Fixed gettext on freebsd/any other system that uses LANG not LANGUAGE --- src/language.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/language.cpp') 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 -- cgit