GetPreferredLanguage.
This commit is contained in:
@@ -230,6 +230,21 @@ void ArchHooks_darwin::DumpDebugInfo()
|
|||||||
LOG->Info("Memory: %ld MB total, %ld MB swap", ram, vRam);
|
LOG->Info("Memory: %ld MB total, %ld MB swap", ram, vRam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In archutils/darwin/PreferredLanguage.m
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
extern char *GetPreferredLanguage();
|
||||||
|
}
|
||||||
|
|
||||||
|
CString ArchHooks_darwin::GetPreferredLanguage()
|
||||||
|
{
|
||||||
|
char *lang = ::GetPreferredLanguage();
|
||||||
|
CString ret = lang;
|
||||||
|
|
||||||
|
free(lang);
|
||||||
|
return ret.ToUpper();
|
||||||
|
}
|
||||||
|
|
||||||
void ArchHooks_darwin::EnterTimeCriticalSection()
|
void ArchHooks_darwin::EnterTimeCriticalSection()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
@@ -295,7 +310,7 @@ int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Steve Checkoway
|
* (c) 2003-2005 Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
#ifndef ARCH_HOOKS_DARWIN_H
|
#ifndef ARCH_HOOKS_DARWIN_H
|
||||||
#define ARCH_HOOKS_DARWIN_H
|
#define ARCH_HOOKS_DARWIN_H
|
||||||
/*
|
|
||||||
* ArchHooks_darwin.h
|
|
||||||
* stepmania
|
|
||||||
*
|
|
||||||
* Created by Steve Checkoway on Tue Jul 15 2003.
|
|
||||||
* Copyright (c) 2003 Steve Checkoway. All rights reserved.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "ArchHooks.h"
|
#include "ArchHooks.h"
|
||||||
class RageMutex;
|
class RageMutex;
|
||||||
@@ -18,7 +10,7 @@ public:
|
|||||||
ArchHooks_darwin();
|
ArchHooks_darwin();
|
||||||
~ArchHooks_darwin();
|
~ArchHooks_darwin();
|
||||||
void DumpDebugInfo();
|
void DumpDebugInfo();
|
||||||
|
CString GetPreferredLanguage();
|
||||||
void EnterTimeCriticalSection();
|
void EnterTimeCriticalSection();
|
||||||
void ExitTimeCriticalSection();
|
void ExitTimeCriticalSection();
|
||||||
|
|
||||||
@@ -34,7 +26,7 @@ protected:
|
|||||||
#endif /* ARCH_HOOKS_DARWIN_H */
|
#endif /* ARCH_HOOKS_DARWIN_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Steve Checkoway
|
* (c) 2003-2005 Steve Checkoway
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#import "Cocoa/Cocoa.h"
|
||||||
|
|
||||||
|
char *GetPreferredLanguage()
|
||||||
|
{
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
|
||||||
|
NSArray *languages = [def objectForKey:@"AppleLanguages"];
|
||||||
|
const char *lang = [[languages objectAtIndex:0] UTF8String];
|
||||||
|
char *ret = (char *)malloc( strlen(lang) + 1 );
|
||||||
|
|
||||||
|
strcpy(ret, lang);
|
||||||
|
[pool release];
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user