}
-void LyX::setGuiLanguage(string const & language)
+void LyX::setRcGuiLanguage()
{
- pimpl_->messages_["GUI"] = Messages(language);
+ if (lyxrc.gui_language == "auto")
+ return;
+ Language const * language = languages.getLanguage(lyxrc.gui_language);
+ LYXERR(Debug::LOCALE, "Setting LANGUAGE to " << language->code());
+ if (!setEnv("LANGUAGE", language->code()))
+ 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();
}
// Let the frontend parse and remove all arguments that it knows
pimpl_->application_.reset(createApplication(argc, argv));
+ // Reestablish our defaults, as Qt overwrites them
+ // after createApplication()
+ locale_init();
+
// Parse and remove all known arguments in the LyX singleton
// Give an error for all remaining ones.
int exit_status = init(argc, argv);
return false;
// Set the language defined by the distributor.
- //setGuiLanguage(lyxrc.gui_language);
+ setRcGuiLanguage();
// Set the PATH correctly.
#if !defined (USE_POSIX_PACKAGING)
if (!readLanguagesFile("languages"))
return false;
+ // Set the language defined by the user.
+ setRcGuiLanguage();
+
// Load the layouts
LYXERR(Debug::INIT, "Reading layouts...");
if (!LyXSetStyle())
// because InsetInfo needs to know these to produce
// the correct output
- // Set the language defined by the user.
- //setGuiLanguage(lyxrc.gui_language);
-
// Set up command definitions
pimpl_->toplevel_cmddef_.read(lyxrc.def_file);