--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Tue Oct 20 00:51:45 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m Tue Oct 20 23:56:31 2015 +0200
@@ -100,9 +100,7 @@
CGFloat screenScale = [[UIScreen mainScreen] safeScale];
NSString *ipcString = [[NSString alloc] initWithFormat:@"%d",self.port];
- NSString *firstLanguage = [[NSLocale preferredLanguages] firstObject];
- NSString *language = [[firstLanguage componentsSeparatedByString:@"-"] firstObject];
- NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", language];
+ NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", [HWUtils languageID]];
NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
--- a/project_files/HedgewarsMobile/Classes/HWUtils.h Tue Oct 20 00:51:45 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.h Tue Oct 20 23:56:31 2015 +0200
@@ -41,6 +41,7 @@
+(NSInteger) randomPort;
+(void) freePort:(NSInteger) port;
+(BOOL) isNetworkReachable;
++(NSString *) languageID;
//+(UIView *)mainSDLViewInstance;
@end
--- a/project_files/HedgewarsMobile/Classes/HWUtils.m Tue Oct 20 00:51:45 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/HWUtils.m Tue Oct 20 23:56:31 2015 +0200
@@ -155,6 +155,12 @@
return ((isReachable && !needsConnection) || nonWiFi) ? testResult : NO;
}
++ (NSString *)languageID
+{
+ NSString *language = [[NSLocale preferredLanguages] firstObject];
+ return [[language componentsSeparatedByString:@"-"] firstObject];
+}
+
/*
+(UIView *)mainSDLViewInstance {
SDL_Window *window = HW_getSDLWindow();
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Tue Oct 20 00:51:45 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m Tue Oct 20 23:56:31 2015 +0200
@@ -37,9 +37,7 @@
[super viewDidLoad];
self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
- NSString *firstLanguage = [[NSLocale preferredLanguages] firstObject];
- NSString *language = [[firstLanguage componentsSeparatedByString:@"-"] firstObject];
- self.trFileName = [NSString stringWithFormat:@"%@.txt", language];
+ self.trFileName = [NSString stringWithFormat:@"%@.txt", [HWUtils languageID]];
// fill the data structure that we are going to read
LoadLocaleWrapper([self.trPath UTF8String], [self.trFileName UTF8String]);