share/hedgewars/Data/Scripts/Locale.lua
author Henek
Fri, 10 Dec 2010 23:58:15 +0100
changeset 4502 759c1a3bb156
child 4854 881c8232b66a
permissions -rw-r--r--
lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4502
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     1
local lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua")
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     2
if lang ~= nil then
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     3
    lang()
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     4
end
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     5
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     6
function loc(text)
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     7
    if lang ~= nil and locale ~= nil and locale[text] ~= nil then return locale[text]
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     8
    else return text
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
     9
    end
759c1a3bb156 lua access to data dir by GetDataPath and made a new scripting translation system with Locale.lua as library and .lua files under Locale. Updated maps Basketball and Knockball to this new system.
Henek
parents:
diff changeset
    10
end