sort languages by display value
Change-Id: I79d58fd680dd04161b89d42fed04a86a931defd3
Signed-off-by: Xuefer <xuefer@gmail.com>
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 4a4c523..cfe3067 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -36,6 +36,7 @@
#include "../partitions.hpp"
#include <string>
+#include <algorithm>
extern "C" {
#include "../twcommon.h"
@@ -1333,6 +1334,8 @@
} else {
LoadLanguageListDir(TWRES "languages/");
}
+
+ std::sort(Language_List.begin(), Language_List.end());
}
void PageManager::LoadLanguage(string filename) {
diff --git a/gui/pages.hpp b/gui/pages.hpp
index cf1afa1..927f3fc 100644
--- a/gui/pages.hpp
+++ b/gui/pages.hpp
@@ -34,6 +34,11 @@
std::string displayvalue;
};
+inline bool operator < (const language_struct& language1, const language_struct& language2)
+{
+ return language1.displayvalue < language2.displayvalue;
+}
+
extern std::vector<language_struct> Language_List;
// Utility Functions