From 1a5a748973598f6406e1687ac642c1886a203074 Mon Sep 17 00:00:00 2001 From: bjarni Date: Sat, 11 Aug 2007 15:52:34 +0000 Subject: (svn r10851) -Feature [OSX]: OpenTTD will now pick the same language as finder is set to if no config file is found (ln-) --- src/os/macosx/macos.mm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/os') diff --git a/src/os/macosx/macos.mm b/src/os/macosx/macos.mm index 6d25cee77..5defc392d 100644 --- a/src/os/macosx/macos.mm +++ b/src/os/macosx/macos.mm @@ -158,3 +158,16 @@ void ShowMacErrorDialog(const char *error) ShowMacDialog(error, buffer, "Quit"); abort(); } + + +/** Determine the current user's locale. */ +const char *GetCurrentLocale(const char *) +{ + static char retbuf[32] = { '\0' }; + NSUserDefaults* defs = [NSUserDefaults standardUserDefaults]; + NSArray* languages = [defs objectForKey:@"AppleLanguages"]; + NSString* preferredLang = [languages objectAtIndex:0]; + /* preferredLang is either 2 or 5 characters long ("xx" or "xx_YY"). */ + strncpy(retbuf, [preferredLang cString], 31); + return retbuf; +} -- cgit v1.2.3-70-g09d2