From 1c83bf9420f5a533ca1de25db1c937661234292d Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 25 Jun 2008 11:10:10 +0000 Subject: [PATCH] GUI language via RC: some bug corrections. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25386 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyX.cpp | 11 +++++++++-- src/frontends/qt4/GuiApplication.cpp | 3 +++ src/support/Messages.cpp | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index c424035024..6a6c140e1f 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -345,8 +345,15 @@ Messages & LyX::getGuiMessages() void LyX::setRcGuiLanguage() { - if (lyxrc.gui_language != "auto") - pimpl_->messages_["GUI"] = Messages(lyxrc.gui_language); + if (lyxrc.gui_language == "auto") + return; + LYXERR(Debug::LOCALE, "Setting LANGUAGE to " << lyxrc.gui_language); + if (!setEnv("LANGUAGE", lyxrc.gui_language)) + LYXERR(Debug::LOCALE, "\t... failed!"); + LYXERR(Debug::LOCALE, "Setting LC_ALL to en_US"); + if (!setEnv("LC_ALL", "en_US")) + LYXERR(Debug::LOCALE, "\t... failed!"); + pimpl_->messages_["GUI"] = Messages(); } diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 303087c71d..4b452848fb 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1023,6 +1023,9 @@ void GuiApplication::exit(int status) void GuiApplication::execBatchCommands() { + // Set the language defined by the user. + LyX::ref().setRcGuiLanguage(); + // Read menus if (!readUIFile(toqstr(lyxrc.ui_file))) // Gives some error box here. diff --git a/src/support/Messages.cpp b/src/support/Messages.cpp index 5a921953c2..aec3556d20 100644 --- a/src/support/Messages.cpp +++ b/src/support/Messages.cpp @@ -111,8 +111,8 @@ docstring const Messages::get(string const & m) const // The string was not found, use gettext to generate it - static string const oldLANGUAGE = getEnv("LANGUAGE"); - static string const oldLC_ALL = getEnv("LC_ALL"); + string const oldLANGUAGE = getEnv("LANGUAGE"); + string const oldLC_ALL = getEnv("LC_ALL"); if (!lang_.empty()) { // This GNU extension overrides any language locale // wrt gettext.