Skip to content

Commit

Permalink
Fix localized_comparator for macOS (#40100)
Browse files Browse the repository at this point in the history
  • Loading branch information
akirashirosawa authored May 3, 2020
1 parent fd7db4a commit 964fe80
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/translations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,5 +698,12 @@ std::string operator+( const translation &lhs, const translation &rhs )

bool localized_comparator::operator()( const std::string &l, const std::string &r ) const
{
#if defined(MACOSX)
CFStringRef lr = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault, l.c_str(),
kCFStringEncodingUTF8, kCFAllocatorNull );
CFStringRef rr = CFStringCreateWithCStringNoCopy( kCFAllocatorDefault, r.c_str(),
kCFStringEncodingUTF8, kCFAllocatorNull );
return CFStringCompare( lr, rr, kCFCompareLocalized ) < 0;
#endif
return std::locale()( l, r );
}

0 comments on commit 964fe80

Please sign in to comment.