12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- //
- // XSTool.m
- // XenonSDK
- //
- // Created by fq on 2020/12/10.
- // Copyright © 2020 SAGESSE. All rights reserved.
- //
- #import "XSTool.h"
- @implementation XSTool
- +(NSString *)getCurrentSystemLauguage {
-
- NSString *str = @"";
-
- NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
- NSArray* languages = [defs objectForKey:@"AppleLanguages"];
- NSString* preferredLang = [languages objectAtIndex:0];
-
- if ([preferredLang hasPrefix:@"en"]) {
- str = @"us"; //英文
- }
-
- if ([preferredLang containsString:@"zh-HK"] || [preferredLang containsString:@"zh-Hant-HK"]) {
- str = @"hk"; //香港繁体中文
- }
-
- if ([preferredLang containsString:@"zh-TW"] || [preferredLang containsString:@"zh-Hant-TW"]) {
- str = @"tw"; //台湾繁体中文
- }
-
-
- if ([preferredLang containsString:@"zh-Hans"] || [preferredLang containsString:@"zh-Hans-CN"]) {
- str = @"zh"; //简体中文
-
- }
- return str;
- }
- @end
|