>>>>> "Uwe" == Uwe Stöhr <[EMAIL PROTECTED]> writes:

Uwe> Jean-Marc Lasgouttes schrieb:
>> Note that the meaning of this variable is to decide whether the
>> languages should be passed as...

Uwe> I know this difference but didn't touched the first case yet
Uwe> although I know it. I first wanted to assure that the current
Uwe> solution works and so could reduce my testcases.

I propose the following to both correct and simplify your code.

JMarc

Index: src/BufferParams.cpp
===================================================================
--- src/BufferParams.cpp	(révision 18240)
+++ src/BufferParams.cpp	(copie de travail)
@@ -1378,21 +1378,18 @@ string const BufferParams::dvips_options
 
 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}";
+	string const & lang_pack = lyxrc.language_package;
+	if (lang_pack == "\\usepackage{babel}") {
+		// if lang_opts is empty, babel is not needed
+		if (lang_opts.empty())
+			return string();
+		// shall the languages be passed directly to babel?
+		if (lyxrc.language_global_options)
+			return lang_pack;
 		else
-			tmp.clear();
+			return "\\usepackage[" + lang_opts + "]{babel}";
 	}
-	return tmp;
+	return lang_pack;
 }
 
 

Reply via email to