Hello,
The attached patch allow to set the language used in the GUI via the the
lyxrc mechanism. If the new 'gui_language' setting is empty or non
present, the language will be taken from the environment variables as usual.
With this patch it is now possible the GUI language at run time and we
don't need anymore the lyx.bat file to set the language before launching
lyx.
I believe that the first feature will a time saver for translators. The
logical place to put this language choice would be in Preference->Look&Feel.
Objection?
Abdel.
Index: lyx_main.C
===================================================================
--- lyx_main.C (revision 16673)
+++ lyx_main.C (working copy)
@@ -851,7 +851,7 @@
if (use_gui) {
// Set the User Interface language.
- pimpl_->messages_["GUI"] = Messages();
+ pimpl_->messages_["GUI"] = Messages(lyxrc.gui_language);
// Set up bindings
pimpl_->toplevel_keymap_.reset(new kb_keymap);
Index: lyxfunc.C
===================================================================
--- lyxfunc.C (revision 16672)
+++ lyxfunc.C (working copy)
@@ -2139,6 +2139,7 @@
case LyXRC::RC_ESC_CHARS:
case LyXRC::RC_FONT_ENCODING:
case LyXRC::RC_FORMAT:
+ case LyXRC::RC_GUI_LANGUAGE:
case LyXRC::RC_INDEX_COMMAND:
case LyXRC::RC_INPUT:
case LyXRC::RC_KBMAP:
Index: lyxrc.C
===================================================================
--- lyxrc.C (revision 16672)
+++ lyxrc.C (working copy)
@@ -94,6 +94,7 @@
{ "\\escape_chars", LyXRC::RC_ESC_CHARS },
{ "\\font_encoding", LyXRC::RC_FONT_ENCODING },
{ "\\format", LyXRC::RC_FORMAT },
+ { "\\gui_language", LyXRC::RC_GUI_LANGUAGE },
{ "\\index_command", LyXRC::RC_INDEX_COMMAND },
{ "\\input", LyXRC::RC_INPUT },
{ "\\kbmap", LyXRC::RC_KBMAP },
@@ -626,6 +627,12 @@
}
break;
+ case RC_GUI_LANGUAGE:
+ if (lexrc.next()) {
+ gui_language = lexrc.getString();
+ }
+ break;
+
case RC_INDEX_COMMAND:
if (lexrc.next()) {
index_command = lexrc.getString();
@@ -1382,6 +1389,11 @@
bibtex_command != system_lyxrc.bibtex_command) {
os << "\\bibtex_command \"" << bibtex_command << "\"\n";
}
+ case RC_GUI_LANGUAGE:
+ if (ignore_system_lyxrc ||
+ gui_language != system_lyxrc.gui_language) {
+ os << "\\gui_language \"" << gui_language << "\"\n";
+ }
case RC_INDEX_COMMAND:
if (ignore_system_lyxrc ||
index_command != system_lyxrc.index_command) {
@@ -2268,6 +2280,10 @@
case RC_FORMAT:
break;
+ case RC_GUI_LANGUAGE:
+ str = _("The Graphical User Interface will use this language.");
+ break;
+
case RC_INDEX_COMMAND:
str = _("Define the options of makeindex (cf. man makeindex) or
select an alternative compiler. E.g., using xindy/make-rules, the command
string would be \"makeindex.sh -m $$lang\".");
break;
Index: lyxrc.h
===================================================================
--- lyxrc.h (revision 16672)
+++ lyxrc.h (working copy)
@@ -66,6 +66,7 @@
RC_ESC_CHARS,
RC_FONT_ENCODING,
RC_FORMAT,
+ RC_GUI_LANGUAGE,
RC_INDEX_COMMAND,
RC_INPUT,
RC_KBMAP,
@@ -223,6 +224,8 @@
std::string chktex_command;
/// command to run bibtex incl. options
std::string bibtex_command;
+ /// Language used for UI elements.
+ std::string gui_language;
/// command to run makeindex incl. options or other index programs
std::string index_command;
///