language_options << ',';
language_options << language->babel();
}
- if (lyxrc.language_global_options)
+ if (lyxrc.language_global_options && !language_options.str().empty())
clsoptions << language_options.str() << ',';
}
string const BufferParams::babelCall(string const & lang_opts) const
{
- string tmp = lyxrc.language_package;
- if (!lyxrc.language_global_options && tmp == "\\usepackage{babel}")
- tmp = string("\\usepackage[") + lang_opts + "]{babel}";
+ string lang_pack = lyxrc.language_package;
+ if (lang_pack != "\\usepackage{babel}")
+ return lang_pack;
// suppress the babel call when there is no babel language defined
- // in the lib/languages file
- if (lyxrc.language_global_options && tmp == "\\usepackage{babel}" &&
- language->babel().empty() ) {
- // if the armscii8 or a CJK encoding is used, babel has to be called
- // for foreign languages
- if (!lang_opts.empty())
- tmp = string("\\usepackage[") + lang_opts + "]{babel}";
- else
- tmp.clear();
- }
- return tmp;
+ // for the document language in the lib/languages file and if no
+ // other languages are used (lang_opts is then empty)
+ if (lang_opts.empty())
+ return string();
+ if (!lyxrc.language_global_options)
+ return "\\usepackage[" + lang_opts + "]{babel}";
+ return lang_pack;
}