From: Uwe Stöhr Date: Wed, 9 May 2007 21:10:55 +0000 (+0000) Subject: BufferParams.cpp: Simplify babel call X-Git-Tag: 1.6.10~9835 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0d555fa6750e31a71d4379dbf4c86c49426217f0;p=features.git BufferParams.cpp: Simplify babel call git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18251 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 4d8b0b6ea6..5e57303546 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1408,21 +1408,19 @@ string const BufferParams::dvips_options() const 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}"; - // 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(); + 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()) + lang_pack.clear(); + if (!lyxrc.language_global_options && !lang_opts.empty()) + lang_pack = string("\\usepackage[") + lang_opts + "]{babel}"; + if (lyxrc.language_global_options) + return lang_pack; } - return tmp; + return lang_pack; }