GUI language via RC: some bug corrections.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25386 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-06-25 11:10:10 +00:00
parent 39393bf788
commit 1c83bf9420
3 changed files with 14 additions and 4 deletions

View File

@ -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();
}

View File

@ -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.

View File

@ -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.