From 0887aee8c54d0ed51bb2031431e2bcdafebb4c6e Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 18 Apr 2014 17:23:19 +0200 Subject: 5.13 --- lib/localization.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'lib/localization.cpp') diff --git a/lib/localization.cpp b/lib/localization.cpp index 78e03545..33494cf4 100644 --- a/lib/localization.cpp +++ b/lib/localization.cpp @@ -20,6 +20,10 @@ #include "parse_lng.h" #include "ffs_paths.h" +#ifdef FFS_MAC +#include +#endif + using namespace zen; @@ -129,8 +133,8 @@ struct LessTranslation : public std::binary_function CFStringRef //output not owned! + { + return ::CFStringCreateWithCString(nullptr, //CFAllocatorRef alloc, + utfCvrtTo(str).c_str(), //const char *cStr, + kCFStringEncodingUTF8); //CFStringEncoding encoding + }; + + CFStringRef langL = allocCFStringRef(lhs.languageName); + ZEN_ON_SCOPE_EXIT(::CFRelease(langL)); + + CFStringRef langR = allocCFStringRef(rhs.languageName); + ZEN_ON_SCOPE_EXIT(::CFRelease(langR)); + + return::CFStringCompare(langL, langR, kCFCompareLocalized | kCFCompareCaseInsensitive) == kCFCompareLessThan; //no-fail #endif } }; @@ -405,7 +426,7 @@ void zen::setLanguage(int language) //throw FileError catch (lngfile::ParsingError& e) { throw FileError(replaceCpy(replaceCpy(replaceCpy(_("Error parsing file %x, row %y, column %z."), - L"%x", fmtFileName(toZ(languageFile))), + L"%x", fmtFileName(utfCvrtTo(languageFile))), L"%y", numberTo(e.row + 1)), L"%z", numberTo(e.col + 1))); } -- cgit