From ca8dcf30edce3d2d26091eee25b97dd30294a699 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 18 Mar 2025 11:56:22 +0000 Subject: [PATCH] Fix build --- lib/texts/TextOperations.cpp | 9 +++++++++ lib/texts/TextOperations.h | 9 +-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/texts/TextOperations.cpp b/lib/texts/TextOperations.cpp index 259aea474..4c4c5129e 100644 --- a/lib/texts/TextOperations.cpp +++ b/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 & col = std::use_facet>(loc); + + return col.compare(str1.data(), str1.data() + str1.size(), + str2.data(), str2.data() + str2.size()) < 0; +} + std::optional TextOperations::textSearchSimilarityScore(const std::string & s, const std::string & t) { static const std::locale loc = boost::locale::generator().generate(getLocaleName()); diff --git a/lib/texts/TextOperations.h b/lib/texts/TextOperations.h index dd0568f0b..3c526b362 100644 --- a/lib/texts/TextOperations.h +++ b/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 & col = std::use_facet>(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,