[LyX/master] Make counter items translatable and sort properly

Juergen Spitzmueller spitz at lyx.org
Sun May 3 07:27:43 UTC 2020


commit fba67710d8f658495180ab3d19235f4dcd6308f3
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sun May 3 09:44:55 2020 +0200

    Make counter items translatable and sort properly
---
 src/frontends/qt/GuiCounter.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/frontends/qt/GuiCounter.cpp b/src/frontends/qt/GuiCounter.cpp
index 9b8fbb6..5ab3bbf 100644
--- a/src/frontends/qt/GuiCounter.cpp
+++ b/src/frontends/qt/GuiCounter.cpp
@@ -25,6 +25,8 @@
 #include "support/gettext.h"
 #include "support/lstrings.h"
 
+#include "qt_helpers.h"
+
 #include <map>
 //#include <vector>
 
@@ -88,10 +90,15 @@ void GuiCounter::fillCombos()
 	Counters const & cntrs =
 		bv->buffer().params().documentClass().counters();
 	std::vector<docstring> counts = cntrs.listOfCounters();
+	// We use an intermediate map in order to sort at translated GUI strings.
+	QMap<QString, QString> items;
 	for (auto const & c : counts) {
 		docstring const & guiname = cntrs.guiName(c);
-		counterCB->addItem(toqstr(guiname), toqstr(c));
+		items.insert(qt_(toqstr(guiname)), toqstr(c));
 	}
+	for (QMap<QString, QString>::const_iterator it = items.constBegin();
+	     it != items.constEnd(); ++it)
+		counterCB->addItem(it.key(), it.value());
 }
 
 


More information about the lyx-cvs mailing list