diff options
author | bjarni <bjarni@openttd.org> | 2007-08-11 15:52:34 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2007-08-11 15:52:34 +0000 |
commit | 1a5a748973598f6406e1687ac642c1886a203074 (patch) | |
tree | 911efe699bec79b316408e9ee8cdbac856b49a07 /src/os/macosx | |
parent | 04824abac6f30403eaf934b11bee32c59c57ca79 (diff) | |
download | openttd-1a5a748973598f6406e1687ac642c1886a203074.tar.xz |
(svn r10851) -Feature [OSX]: OpenTTD will now pick the same language as finder is set to if no config file is found (ln-)
Diffstat (limited to 'src/os/macosx')
-rw-r--r-- | src/os/macosx/macos.mm | 13 |
1 files changed, 13 insertions, 0 deletions
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; +} |