--- 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()
--- a/share/hedgewars/Data/Scripts/Locale.lua Sun Aug 21 13:06:23 2011 +0400
+++ b/share/hedgewars/Data/Scripts/Locale.lua Sun Aug 21 08:52:19 2011 -0400
@@ -1,9 +1,14 @@
-- Library for localizing strings in lua scripts
-local lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua")
+local lang = loadfile(GetUserDataPath() .. "Locale/" .. tostring(L) .. ".lua")
if lang ~= nil then
lang()
+else
+ lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua")
+ if lang ~= nil then
+ lang()
+ end
end
function loc(text)