Created
January 28, 2015 07:20
-
-
Save ronkorving/919774edae27631b2ece to your computer and use it in GitHub Desktop.
Extracting iOS system language for Unity in Assets/Plugins/iOS/GetSystemLanguage.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "UnityAppController.h" | |
/* | |
* This Plug in will set a "systemLanguage" string key in PlayerPrefs with the system language code. | |
*/ | |
@interface GetSystemLanguage : UnityAppController | |
@end | |
@implementation GetSystemLanguage | |
- (void)preStartUnity | |
{ | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
NSArray *languages = [defaults objectForKey:@"AppleLanguages"]; | |
NSString *currentLanguage = [languages objectAtIndex:0]; | |
[[NSUserDefaults standardUserDefaults] setObject:currentLanguage forKey:@"systemLanguage"]; | |
[[NSUserDefaults standardUserDefaults] synchronize]; | |
} | |
- (void)shouldAttachRenderDelegate | |
{ | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment