This should ensure zsm doesn't screw up locale, hopefully.
authornemo
Tue, 06 Nov 2012 11:01:18 -0500
changeset 7984 619a399bece8
parent 7982 dfba2515d601
child 7986 53b1da5ee7f4
This should ensure zsm doesn't screw up locale, hopefully.
hedgewars/hwengine.pas
hedgewars/uSound.pas
hedgewars/uVariables.pas
--- a/hedgewars/hwengine.pas	Tue Nov 06 10:52:21 2012 -0500
+++ b/hedgewars/hwengine.pas	Tue Nov 06 11:01:18 2012 -0500
@@ -386,7 +386,7 @@
     if cLocaleFName <> 'en.txt' then
         begin
         // Try two letter locale first before trying specific locale overrides
-        if (Length(cLocale) > 2) and (Copy(cLocale,1,2) <> 'en') then
+        if (Length(cLocale) > 3) and (Copy(cLocale,1,2) <> 'en') then
             begin
             LoadLocale(UserPathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt');
             LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocale,1,2)+'.txt')
--- a/hedgewars/uSound.pas	Tue Nov 06 10:52:21 2012 -0500
+++ b/hedgewars/uSound.pas	Tue Nov 06 11:01:18 2012 -0500
@@ -139,7 +139,7 @@
             path:= Pathz[ptVoices] + '/' + locName;
             if DirectoryExists(path) then
                 name:= locName
-            else if Length(cLocale) > 2
+            else if Length(cLocale) > 3
                 then
                 begin
                 locName:= name+'_'+Copy(cLocale,1,2);
--- a/hedgewars/uVariables.pas	Tue Nov 06 10:52:21 2012 -0500
+++ b/hedgewars/uVariables.pas	Tue Nov 06 11:01:18 2012 -0500
@@ -21,7 +21,7 @@
 unit uVariables;
 interface
 
-uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile;
+uses SDLh, uTypes, uFloat, GLunit, uConsts, Math, uMobile, uUtils;
 
 var
 /////// init flags ///////
@@ -2578,10 +2578,7 @@
 procedure initModule;
 begin
 
-    if (Length(cLocaleFName) > 6) then
-        cLocale := Copy(cLocaleFName,1,5)
-    else
-        cLocale := Copy(cLocaleFName,1,2);
+    SplitByChar(cLocaleFName, cLocale, '.');
 
     cFlattenFlakes      := false;
     cFlattenClouds      := false;