[LyX/master] Sort secondary babel languages alphabetically

Juergen Spitzmueller spitz at lyx.org
Sun Aug 23 07:42:16 UTC 2020


commit c3cac2048bfe68c074309e434e616b3efd46ffdf
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun Aug 23 10:04:07 2020 +0200

    Sort secondary babel languages alphabetically
---
 src/LaTeXFeatures.cpp |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 4f3b878..d40cd9f 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -990,22 +990,19 @@ vector<string> LaTeXFeatures::getBabelExclusiveLanguages() const
 
 string LaTeXFeatures::getBabelLanguages() const
 {
-	ostringstream langs;
-
-	bool first = true;
-	LanguageList::const_iterator const begin = UsedLanguages_.begin();
-	for (LanguageList::const_iterator cit = begin;
-	     cit != UsedLanguages_.end();
-	     ++cit) {
-		if ((*cit)->babel().empty())
-			continue;
-		if (!first)
-			langs << ',';
-		else
-			first = false;
-		langs << (*cit)->babel();
+	vector<string> blangs;
+	for (auto const & lang : UsedLanguages_) {
+		if (!lang->babel().empty())
+			blangs.push_back(lang->babel());
 	}
-	return langs.str();
+
+	// Sort alphabetically to assure consistent order
+	// (the order itself does not matter apart from
+	// some exceptions, e.g. hebrew must come after
+	// arabic and farsi)
+	sort(blangs.begin(), blangs.end());
+
+	return getStringFromVector(blangs);
 }
 
 


More information about the lyx-cvs mailing list