}
-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);
if (document_path.exists() && document_path.isDirectory())
package().document_dir() = document_path;
- package().temp_dir() = createLyXTmpDir(FileName(lyxrc.tempdir_path));
+ package().set_temp_dir(createLyXTmpDir(FileName(lyxrc.tempdir_path)));
if (package().temp_dir().empty()) {
Alert::error(_("Could not create temporary directory"),
bformat(_("Could not create a temporary directory in\n"
- "%1$s. Make sure that this\n"
- "path exists and is writable and try again."),
+ "\"%1$s\"\n"
+ "Make sure that this path exists and is writable and try again."),
from_utf8(lyxrc.tempdir_path)));
// createLyXTmpDir() tries sufficiently hard to create a
// usable temp dir, so the probability to come here is