Add wxUILocale::CompareStrings() function
This function allows comparing strings using the sort order of the specified locale, represented by the new wxLocaleIdent class. It is implemented using CompareStringEx()[1] under MSW and NSString::compare:options:range:locale:[2] under macOS, generic implementation for the other platforms is upcoming. [1]: https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-comparestringex [2]: https://developer.apple.com/documentation/foundation/nsstring/1414561-compare?language=objc
This commit is contained in:
committed by
Vadim Zeitlin
parent
9f43ec03e6
commit
c8269210a2
@@ -54,6 +54,26 @@ private:
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
wxString wxLocaleIdent::GetName() const
|
||||
{
|
||||
// Construct name in the standard Unix format:
|
||||
// language[_territory][.codeset][@modifier]
|
||||
|
||||
wxString name;
|
||||
if ( !m_language.empty() )
|
||||
{
|
||||
name << m_language;
|
||||
|
||||
if ( !m_region.empty() )
|
||||
name << "_" << m_region;
|
||||
|
||||
if ( !m_modifier.empty() )
|
||||
name << "@" << m_modifier;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// Helper of wxSetlocaleTryAll() below which tries setting the given locale
|
||||
// with and without UTF-8 suffix. Don't use this one directly.
|
||||
static const char *wxSetlocaleTryUTF8(int c, const wxString& lc)
|
||||
|
Reference in New Issue
Block a user