]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Use context-sensitive command termination
[lyx.git] / src / BufferParams.cpp
index 50870c57b2e826065de252e82530658e374b7e26..7832b268d21d8f29952c644fd48732eca09c7ef9 100644 (file)
@@ -1452,7 +1452,7 @@ void BufferParams::validate(LaTeXFeatures & features) const
 
        // some languages are only available via polyglossia
        if (features.hasPolyglossiaExclusiveLanguages())
-          features.require("polyglossia");
+               features.require("polyglossia");
 
        if (useNonTeXFonts && fontsMath() != "auto")
                features.require("unicode-math");
@@ -2182,14 +2182,17 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                        os << "[" << from_ascii(language->polyglossiaOpts()) << "]";
                os << "{" << from_ascii(language->polyglossia()) << "}\n";
                // now setup the other languages
-               std::map<std::string, std::string> const polylangs =
+               set<string> const polylangs =
                        features.getPolyglossiaLanguages();
-               for (std::map<std::string, std::string>::const_iterator mit = polylangs.begin();
+               for (set<string>::const_iterator mit = polylangs.begin();
                     mit != polylangs.end() ; ++mit) {
+                       // We do not output the options here; they are output in
+                       // the language switch commands. This is safer if multiple
+                       // varieties are used.
+                       if (*mit == language->polyglossia())
+                               continue;
                        os << "\\setotherlanguage";
-                       if (!mit->second.empty())
-                               os << "[" << from_ascii(mit->second) << "]";
-                       os << "{" << from_ascii(mit->first) << "}\n";
+                       os << "{" << from_ascii(*mit) << "}\n";
                }
        }