using std::count;
using std::endl;
+using std::find;
using std::string;
using std::istringstream;
using std::ostream;
language_options << ',';
language_options << language->babel();
}
- if (lyxrc.language_global_options && !language_options.str().empty())
+ // when Vietnamese is used, babel must directly be loaded with the
+ // language options, not in the class options
+ int viet = language_options.str().find("vietnam");
+ // viet = string::npos when not found
+ if (lyxrc.language_global_options && !language_options.str().empty()
+ && viet == string::npos)
clsoptions << language_options.str() << ',';
}
// So load babel after the optional packages but before the user-defined
// preamble. This allows the users to redefine babel commands, e.g. to
// translate the word "Index" to the German "Stichwortverzeichnis".
+ // For more infos why this place was chosen, see
+ // http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg128425.html
+ // if you encounter problem, you can shift babel to its old place behind
+ // the user-defined preamble
if (use_babel && !features.isRequired("jurabib")) {
// FIXME UNICODE
lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
// other languages are used (lang_opts is then empty)
if (lang_opts.empty())
return string();
- if (!lyxrc.language_global_options)
+ // when Vietnamese is used, babel must directly be loaded with the
+ // language options
+ int viet = lang_opts.find("vietnam");
+ // viet = string::npos when not found
+ if (!lyxrc.language_global_options || viet != string::npos)
return "\\usepackage[" + lang_opts + "]{babel}";
return lang_pack;
}