blender/intern/locale/osx_user_locale.mm
Jason Wilkins 8d084e8c8f Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
2014-10-07 15:47:32 -05:00

23 lines
525 B
Plaintext

#include "boost_locale_wrapper.h"
#import <Cocoa/Cocoa.h>
#include <cstdlib>
static char* user_locale = NULL;
// get current locale
const char* osx_user_locale()
{
::free(user_locale);
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
CFLocaleRef myCFLocale = CFLocaleCopyCurrent();
NSLocale * myNSLocale = (NSLocale *) myCFLocale;
[myNSLocale autorelease];
NSString *nsIdentifier = [myNSLocale localeIdentifier];
user_locale = ::strdup([nsIdentifier UTF8String]);
[pool drain];
return user_locale;
}