Ivan Savenko 7 månader sedan
förälder
incheckning
ca8dcf30ed
2 ändrade filer med 10 tillägg och 8 borttagningar
  1. 9 0
      lib/texts/TextOperations.cpp
  2. 1 8
      lib/texts/TextOperations.h

+ 9 - 0
lib/texts/TextOperations.cpp

@@ -306,6 +306,15 @@ DLL_LINKAGE std::string TextOperations::getLocaleName()
 	return Languages::getLanguageOptions(LIBRARY->generaltexth->getPreferredLanguage()).localeName;
 }
 
+DLL_LINKAGE bool TextOperations::compareLocalizedStrings(std::string_view str1, std::string_view str2)
+{
+	static const std::locale loc(getLocaleName());
+	static const std::collate<char> & col = std::use_facet<std::collate<char>>(loc);
+
+	return col.compare(str1.data(), str1.data() + str1.size(),
+					   str2.data(), str2.data() + str2.size()) < 0;
+}
+
 std::optional<int> TextOperations::textSearchSimilarityScore(const std::string & s, const std::string & t)
 {
 	static const std::locale loc = boost::locale::generator().generate(getLocaleName());

+ 1 - 8
lib/texts/TextOperations.h

@@ -80,14 +80,7 @@ namespace TextOperations
 	DLL_LINKAGE std::string getLocaleName();
 
 	/// Compares two strings using locale-aware collation based on the selected game language.
-	DLL_LINKAGE inline bool compareLocalizedStrings(std::string_view str1, std::string_view str2)
-	{
-		static const std::locale loc(getLocaleName());
-		static const std::collate<char> & col = std::use_facet<std::collate<char>>(loc);
-
-		return col.compare(str1.data(), str1.data() + str1.size(),
-			str2.data(), str2.data() + str2.size()) < 0;
-	}
+	DLL_LINKAGE bool compareLocalizedStrings(std::string_view str1, std::string_view str2);
 
 	/// Check if texts have similarity when typing into search boxes
 	/// 0 -> Exact match or starts with typed-in text, 1 -> Close match or substring match,