- Fix for locale string passed to engine (like "ru-FR") ios-revival
authorantonc27 <antonc27@mail.ru>
Mon, 05 Oct 2015 19:17:40 +0200
branchios-revival
changeset 11199 3465047397da
parent 11195 0fc91fc320aa
child 11200 08c6ccc28007
- Fix for locale string passed to engine (like "ru-FR")
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Sep 28 01:31:47 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Oct 05 19:17:40 2015 +0200
@@ -99,7 +99,11 @@
     CGFloat width, height;
     CGFloat screenScale = [[UIScreen mainScreen] safeScale];
     NSString *ipcString = [[NSString alloc] initWithFormat:@"%d",self.port];
-    NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt",[[NSLocale preferredLanguages] objectAtIndex:0]];
+    
+    NSString *firstLanguage = [[NSLocale preferredLanguages] firstObject];
+    NSString *language = [[firstLanguage componentsSeparatedByString:@"-"] firstObject];
+    NSString *localeString = [[NSString alloc] initWithFormat:@"%@.txt", language];
+    
     NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];
 
     CGRect screenBounds = [[UIScreen mainScreen] safeBounds];