Refactor hwengine: Rename cLocale to cLanguage
authorWuzzy <Wuzzy2@mail.ru>
Wed, 16 Jan 2019 00:01:29 +0100
changeset 14603 62dea281e4d5
parent 14602 6d2954037e57
child 14604 b86e6e4f3c58
Refactor hwengine: Rename cLocale to cLanguage Required so the clocale unit can be added
hedgewars/ArgParsers.pas
hedgewars/hwengine.pas
hedgewars/uGearsRender.pas
hedgewars/uScript.pas
hedgewars/uSound.pas
hedgewars/uVariables.pas
--- a/hedgewars/ArgParsers.pas	Tue Jan 15 21:28:54 2019 +0100
+++ b/hedgewars/ArgParsers.pas	Wed Jan 16 00:01:29 2019 +0100
@@ -258,7 +258,7 @@
     case cmdIndex of
         {--prefix}               0 : PathPrefix        := getstringParameter (arg, paramIndex, parseParameter);
         {--user-prefix}          1 : UserPathPrefix    := getstringParameter (arg, paramIndex, parseParameter);
-        {--locale}               2 : cLocaleFName      := getstringParameter (arg, paramIndex, parseParameter);
+        {--locale}               2 : cLanguageFName    := getstringParameter (arg, paramIndex, parseParameter);
         {--fullscreen-width}     3 : cFullscreenWidth  := max(getLongIntParameter(arg, paramIndex, parseParameter), cMinScreenWidth);
         {--fullscreen-height}    4 : cFullscreenHeight := max(getLongIntParameter(arg, paramIndex, parseParameter), cMinScreenHeight);
         {--width}                5 : cWindowedWidth    := max(2 * (getLongIntParameter(arg, paramIndex, parseParameter) div 2), cMinScreenWidth);
--- a/hedgewars/hwengine.pas	Tue Jan 15 21:28:54 2019 +0100
+++ b/hedgewars/hwengine.pas	Wed Jan 16 00:01:29 2019 +0100
@@ -399,16 +399,16 @@
     if not allOK then exit;
 
     LoadLocale(cPathz[ptLocale] + '/en.txt');  // Do an initial load with english
-    if cLocaleFName <> 'en.txt' then
+    if cLanguageFName <> 'en.txt' then
         begin
         // Try two letter locale first before trying specific locale overrides
-        if (Length(cLocale) > 3) and (Copy(cLocale, 1, 2) <> 'en') then
+        if (Length(cLanguage) > 3) and (Copy(cLanguage, 1, 2) <> 'en') then
             begin
-            LoadLocale(cPathz[ptLocale] + '/' + Copy(cLocale, 1, 2) + '.txt')
+            LoadLocale(cPathz[ptLocale] + '/' + Copy(cLanguage, 1, 2) + '.txt')
             end;
-        LoadLocale(cPathz[ptLocale] + '/' + cLocaleFName)
+        LoadLocale(cPathz[ptLocale] + '/' + cLanguageFName)
         end
-    else cLocale := 'en';
+    else cLanguage := 'en';
 
     if not allOK then exit;
     WriteLnToConsole(msgGettingConfig);
--- a/hedgewars/uGearsRender.pas	Tue Jan 15 21:28:54 2019 +0100
+++ b/hedgewars/uGearsRender.pas	Wed Jan 16 00:01:29 2019 +0100
@@ -695,7 +695,7 @@
                                 0);
                         // sprCensored contains English text, so only show it for English locales
                         // TODO: Make text translatable. But how?
-                        if Copy(cLocale, 1, 2) = 'en' then
+                        if Copy(cLanguage, 1, 2) = 'en' then
                             DrawSprite(sprCensored, ox - 32, oy - 20, 0);
                         end;
                     defaultPos:= false
--- a/hedgewars/uScript.pas	Tue Jan 15 21:28:54 2019 +0100
+++ b/hedgewars/uScript.pas	Wed Jan 16 00:01:29 2019 +0100
@@ -4145,7 +4145,7 @@
 luaopen_table(luaState);
 
 // import some variables
-ScriptSetString(_S'LOCALE', cLocale);
+ScriptSetString(_S'LOCALE', cLanguage);
 
 {$IFDEF USE_TOUCH_INTERFACE}
 ScriptSetString(_S'INTERFACE', 'touch');
--- a/hedgewars/uSound.pas	Tue Jan 15 21:28:54 2019 +0100
+++ b/hedgewars/uSound.pas	Wed Jan 16 00:01:29 2019 +0100
@@ -335,24 +335,24 @@
 
 function  AskForVoicepack(name: shortstring): Pointer;
 var i: Longword;
-    locName, path: shortstring;
+    langName, path: shortstring;
 begin
     i:= 0;
 
     // Adjust voicepack name if there's a localised version version of the voice
-    if cLocale <> 'en' then
+    if cLanguage <> 'en' then
         begin
-        locName:= name+'_'+cLocale;
-        path:= cPathz[ptVoices] + '/' + locName;
+        langName:= name+'_'+cLanguage;
+        path:= cPathz[ptVoices] + '/' + langName;
         if pfsExists(path) then
-            name:= locName
+            name:= langName
         else
-            if Length(cLocale) > 3 then
+            if Length(cLanguage) > 3 then
                 begin
-                locName:= name+'_'+Copy(cLocale,1,2);
-                path:= cPathz[ptVoices] + '/' + locName;
+                langName:= name+'_'+Copy(cLanguage,1,2);
+                path:= cPathz[ptVoices] + '/' + langName;
                 if pfsExists(path) then
-                    name:= locName
+                    name:= langName
                 end
         end;
 
--- a/hedgewars/uVariables.pas	Tue Jan 15 21:28:54 2019 +0100
+++ b/hedgewars/uVariables.pas	Wed Jan 16 00:01:29 2019 +0100
@@ -41,8 +41,8 @@
     ipcPort            : Word;
     AprilOne           : boolean;
     cFullScreen        : boolean;
-    cLocaleFName       : shortstring;
-    cLocale            : shortstring;
+    cLanguageFName     : shortstring;
+    cLanguage          : shortstring;
     cTimerInterval     : LongInt;
     PathPrefix         : ansistring;
     UserPathPrefix     : ansistring;
@@ -2606,7 +2606,7 @@
     cAltDamage      := false;
     cTimerInterval  := 8;
     cReducedQuality := rqNone;
-    cLocaleFName    := 'en.txt';
+    cLanguageFName  := 'en.txt';
     cFullScreen     := false;
 
     UserPathPrefix  := '';
@@ -2661,8 +2661,8 @@
     Move(AmmozInit, Ammoz, sizeof(Ammoz));
 
 
-    cLocale:= cLocaleFName;
-    SplitByChar(cLocale, s, '.');
+    cLanguage:= cLanguageFName;
+    SplitByChar(cLanguage, s, '.');
 
     cFlattenFlakes      := false;
     cFlattenClouds      := false;