mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-21 11:39:57 +03:00
parent
deb564e5a6
commit
e96dfadae7
@ -14,6 +14,7 @@
|
||||
// Needed for _NSGetProgname
|
||||
#include <crt_externs.h>
|
||||
#include <objc/runtime.h>
|
||||
#include <xlocale.h>
|
||||
|
||||
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 101200)
|
||||
#define NSWindowStyleMaskResizable NSResizableWindowMask
|
||||
@ -419,7 +420,13 @@ - (void)openFilesFromPasteboard:(NSPasteboard *)pasteboard type:(int)type {
|
||||
locale = [[NSLocale currentLocale] localeIdentifier];
|
||||
}
|
||||
if (!locale) { Py_RETURN_NONE; }
|
||||
return Py_BuildValue("s", [locale UTF8String]);
|
||||
// Make sure the locale value is valid, that is it can be used
|
||||
// to construct an actual locale
|
||||
const char* locale_utf8 = [locale UTF8String];
|
||||
locale_t test_locale = newlocale(LC_ALL_MASK, locale_utf8, NULL);
|
||||
if (!test_locale) { Py_RETURN_NONE; }
|
||||
freelocale(test_locale);
|
||||
return Py_BuildValue("s", locale_utf8);
|
||||
|
||||
} // autoreleasepool
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user