Welcome to mirror list, hosted at ThFree Co, Russian Federation.

osx_user_locale.mm « locale « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2f65d39df911ae6b5f2601d8cec0337c5cb4f30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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;
}