hedgewars/hwengine.pas
changeset 5616 a96231121eac
parent 5565 1a326ba319c9
child 5644 4ad07103cfae
child 5662 99083392cd4f
--- a/hedgewars/hwengine.pas	Sun Aug 21 13:06:23 2011 +0400
+++ b/hedgewars/hwengine.pas	Sun Aug 21 08:52:19 2011 -0400
@@ -221,6 +221,8 @@
     val(gameArgs[2], cScreenHeight);
     val(gameArgs[3], cReducedQuality);
     cLocaleFName:= gameArgs[4];
+    if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5)
+    else cLocale := Copy(cLocaleFName,1,2);
     UserNick:= gameArgs[5];
     isSoundEnabled:= gameArgs[6] = '1';
     isMusicEnabled:= gameArgs[7] = '1';
@@ -267,8 +269,6 @@
 
     LoadLocale(UserPathz[ptLocale] + '/en.txt');  // Do an initial load with english
     LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
-    if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5)
-    else cLocale := Copy(cLocaleFName,1,2);
     if cLocaleFName <> 'en.txt' then
         begin
         // Try two letter locale first before trying specific locale overrides
@@ -479,6 +479,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 begin
     GetParams();
+    if (Length(cLocaleFName) > 6) then cLocale := Copy(cLocaleFName,1,5)
+    else cLocale := Copy(cLocaleFName,1,2);
 
     if GameType = gmtLandPreview then GenLandPreview()
     else if GameType = gmtSyntax then DisplayUsage()