- Fix for locale string in SingleWeaponViewController ios-revival
authorantonc27 <antonc27@mail.ru>
Mon, 05 Oct 2015 20:31:46 +0200
branchios-revival
changeset 11204 08c6ccc28007
parent 11203 3465047397da
child 11209 9fd7b8d3cf4d
- Fix for locale string in SingleWeaponViewController - Init of vars in LoadLocaleWrapper in order to get right ammo names
hedgewars/uLocale.pas
project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m
--- a/hedgewars/uLocale.pas	Mon Oct 05 19:17:40 2015 +0200
+++ b/hedgewars/uLocale.pas	Mon Oct 05 20:31:46 2015 +0200
@@ -138,11 +138,13 @@
     PathPrefix := Strpas(path);
  
     uUtils.initModule(false);
+    uVariables.initModule;
     uPhysFSLayer.initModule;
  
     LoadLocale(Strpas(filename));
  
     uPhysFSLayer.freeModule;
+    uVariables.freeModule;
     uUtils.freeModule;
 end;
 {$ENDIF}
--- a/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Mon Oct 05 19:17:40 2015 +0200
+++ b/project_files/HedgewarsMobile/Classes/SingleWeaponViewController.m	Mon Oct 05 20:31:46 2015 +0200
@@ -37,7 +37,9 @@
     [super viewDidLoad];
 
     self.trPath = [NSString stringWithFormat:@"%@", LOCALE_DIRECTORY()];
-    self.trFileName = [NSString stringWithFormat:@"%@.txt", [[NSLocale preferredLanguages] firstObject]];
+    NSString *firstLanguage = [[NSLocale preferredLanguages] firstObject];
+    NSString *language = [[firstLanguage componentsSeparatedByString:@"-"] firstObject];
+    self.trFileName = [NSString stringWithFormat:@"%@.txt", language];
     // fill the data structure that we are going to read
     LoadLocaleWrapper([self.trPath UTF8String], [self.trFileName UTF8String]);