fix bug #8211: \setotherlanguage not set for non-babel languages

This commit is contained in:
Juergen Spitzmueller 2012-06-23 13:50:40 +02:00
parent 89b8f380cc
commit f42c9e50df
4 changed files with 14 additions and 8 deletions

View File

@ -1375,7 +1375,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
bool const use_polyglossia = features.usePolyglossia(); bool const use_polyglossia = features.usePolyglossia();
bool const global = lyxrc.language_global_options; bool const global = lyxrc.language_global_options;
if (use_babel || (use_polyglossia && global)) { if (use_babel || (use_polyglossia && global)) {
language_options << features.getLanguages(); language_options << features.getBabelLanguages();
if (!language->babel().empty()) { if (!language->babel().empty()) {
if (!language_options.str().empty()) if (!language_options.str().empty())
language_options << ','; language_options << ',';

View File

@ -701,9 +701,10 @@ void Font::validate(LaTeXFeatures & features) const
// FIXME: Do something for background and soul package? // FIXME: Do something for background and soul package?
if (lang_->babel() != doc_language->babel() && if (((features.usePolyglossia() && lang_->polyglossia() != doc_language->polyglossia())
lang_ != ignore_language && || (features.useBabel() && lang_->babel() != doc_language->babel()))
lang_ != latex_language) && lang_ != ignore_language
&& lang_ != latex_language)
{ {
features.useLanguage(lang_); features.useLanguage(lang_);
LYXERR(Debug::LATEX, "Found language " << lang_->lang()); LYXERR(Debug::LATEX, "Found language " << lang_->lang());

View File

@ -451,7 +451,7 @@ void LaTeXFeatures::useFloat(string const & name, bool subfloat)
void LaTeXFeatures::useLanguage(Language const * lang) void LaTeXFeatures::useLanguage(Language const * lang)
{ {
if (!lang->babel().empty()) if (!lang->babel().empty() || !lang->polyglossia().empty())
UsedLanguages_.insert(lang); UsedLanguages_.insert(lang);
if (!lang->requires().empty()) if (!lang->requires().empty())
require(lang->requires()); require(lang->requires());
@ -503,16 +503,21 @@ bool LaTeXFeatures::hasPolyglossiaExclusiveLanguages() const
} }
string LaTeXFeatures::getLanguages() const string LaTeXFeatures::getBabelLanguages() const
{ {
ostringstream languages; ostringstream languages;
bool first = true;
LanguageList::const_iterator const begin = UsedLanguages_.begin(); LanguageList::const_iterator const begin = UsedLanguages_.begin();
for (LanguageList::const_iterator cit = begin; for (LanguageList::const_iterator cit = begin;
cit != UsedLanguages_.end(); cit != UsedLanguages_.end();
++cit) { ++cit) {
if (cit != begin) if ((*cit)->babel().empty())
continue;
if (!first)
languages << ','; languages << ',';
else
first = false;
languages << (*cit)->babel(); languages << (*cit)->babel();
} }
return languages.str(); return languages.str();

View File

@ -110,7 +110,7 @@ public:
/// check if a language is supported only by polyglossia /// check if a language is supported only by polyglossia
bool hasPolyglossiaExclusiveLanguages() const; bool hasPolyglossiaExclusiveLanguages() const;
/// ///
std::string getLanguages() const; std::string getBabelLanguages() const;
/// ///
std::map<std::string, std::string> getPolyglossiaLanguages() const; std::map<std::string, std::string> getPolyglossiaLanguages() const;
/// ///