Uwe, it is a bit annoying to have you change code without discussion instead of looking at my points. But OK, let's adapt to the moving target.
[EMAIL PROTECTED] a écrit :
+ string lang_pack = lyxrc.language_package; + if (lang_pack == "\\usepackage{babel}") { + // suppress the babel call when there is no babel language defined + // for the document language in the lib/languages file and if no + // other languages are used + if (language->babel().empty() && lang_opts.empty())
when lang_opts.empty() is true, language->babel().empty() is true too (since lang_opts is the full list of languages to pass to babel, it has to contain the document language, right?; and you can trace the code as I did to check this fact).
+ lang_pack.clear();
or directly "return string()", since you know nothing is going to happen.
+ if (!lyxrc.language_global_options && !lang_opts.empty())
we know that !lang_opts.empty() (because of the change above)
+ lang_pack = string("\\usepackage[") + lang_opts + "]{babel}";
+ return string("\\usepackage[") + lang_opts + "]{babel}"; It is easier to return at this point since it makes tracing the code easier (in my eyes at least).
+ if (lyxrc.language_global_options)
or just a "else" instead.
+ return lang_pack; + } + return lang_pack; }
The logic of your above code is really weird. I think it works, but it is somewhat by chance.
JMarc