really reset the LANGUAGE variable to its old value, instead of some other guessed value

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28737 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2009-03-09 13:49:53 +00:00
parent fc1fb61336
commit 9c0b6cf700

View File

@ -133,11 +133,13 @@ docstring const Messages::get(string const & m) const
// The string was not found, use gettext to generate it // The string was not found, use gettext to generate it
static string oldLC_ALL; static string oldLC_ALL;
static string oldLANGUAGE;
if (!lang_.empty()) { if (!lang_.empty()) {
oldLC_ALL = getEnv("LC_ALL"); oldLC_ALL = getEnv("LC_ALL");
// This GNU extension overrides any language locale // This GNU extension overrides any language locale
// wrt gettext. // wrt gettext.
LYXERR(Debug::LOCALE, "Setting LANGUAGE to " << lang_); LYXERR(Debug::LOCALE, "Setting LANGUAGE to " << lang_);
oldLANGUAGE = getEnv("LANGUAGE");
if (!setEnv("LANGUAGE", lang_)) if (!setEnv("LANGUAGE", lang_))
LYXERR(Debug::LOCALE, "\t... failed!"); LYXERR(Debug::LOCALE, "\t... failed!");
// However, setting LANGUAGE does nothing when the // However, setting LANGUAGE does nothing when the
@ -173,9 +175,10 @@ docstring const Messages::get(string const & m) const
// Reset environment variables as they were. // Reset environment variables as they were.
if (!lang_.empty()) { if (!lang_.empty()) {
// Reset everything as it was. // Reset everything as it was.
LYXERR(Debug::LOCALE, "restoring LANGUAGE from " << getEnv("LANGUAGE") LYXERR(Debug::LOCALE, "restoring LANGUAGE from "
<< " to " << main_lang_); << getEnv("LANGUAGE")
if (!setEnv("LANGUAGE", main_lang_)) << " to " << oldLANGUAGE);
if (!setEnv("LANGUAGE", oldLANGUAGE))
LYXERR(Debug::LOCALE, "\t... failed!"); LYXERR(Debug::LOCALE, "\t... failed!");
LYXERR(Debug::LOCALE, "restoring LC_ALL from " << getEnv("LC_ALL") LYXERR(Debug::LOCALE, "restoring LC_ALL from " << getEnv("LC_ALL")
<< " to " << oldLC_ALL); << " to " << oldLC_ALL);