mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-26 23:28:35 +00:00
i18n: Add case-insenstitive icompare() function, document compare()
This commit is contained in:
parent
c89b7596ec
commit
0cd131b537
@ -76,8 +76,13 @@ namespace translation
|
||||
void set_language(const std::string& language, const std::vector<std::string>* alternates);
|
||||
|
||||
void init();
|
||||
|
||||
/** Case-sensitive lexicographical comparison. */
|
||||
int compare(const std::string& s1,const std::string& s2);
|
||||
|
||||
/** Case-insensitive lexicographical comparison. */
|
||||
int icompare(const std::string& s1,const std::string& s2);
|
||||
|
||||
std::string strftime(const std::string& format, const std::tm* time);
|
||||
}
|
||||
|
||||
|
@ -267,14 +267,19 @@ void set_language(const std::string& language, const std::vector<std::string>* /
|
||||
LOG_G << "setting language to '" << language << "' \n";
|
||||
get_manager().set_language(language);
|
||||
}
|
||||
|
||||
int compare(const std::string& s1, const std::string& s2)
|
||||
{
|
||||
return std::use_facet<std::collate<char> >(get_manager().get_locale()).compare(s1.c_str(), s1.c_str() + s1.size(), s2.c_str(), s2.c_str() + s2.size());
|
||||
}
|
||||
|
||||
int icompare(const std::string& s1, const std::string& s2)
|
||||
{
|
||||
return std::use_facet<bl::collator<char> >(get_manager().get_locale()).compare(bl::collator_base::secondary, s1, s2);
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::string strftime(const std::string& format, const std::tm* time)
|
||||
|
Loading…
x
Reference in New Issue
Block a user