From c3cac2048bfe68c074309e434e616b3efd46ffdf Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sun, 23 Aug 2020 10:04:07 +0200 Subject: [PATCH] Sort secondary babel languages alphabetically --- src/LaTeXFeatures.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 4f3b87886c..d40cd9fc4e 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -990,22 +990,19 @@ vector 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 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); }