share/hedgewars/Data/Scripts/Locale.lua
author mikade <redgrinner@gmail.com>
Sun, 25 Mar 2012 17:34:40 +0200
changeset 6819 07e8de67c3c2
parent 5616 a96231121eac
child 8349 a1dbe148f10f
permissions -rw-r--r--
Added a missing loc Fixed rader bug Four new achievements Some provisional changes

-- Library for localizing strings in lua scripts

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)
    if lang ~= nil and locale ~= nil and locale[text] ~= nil then return locale[text]
    else return text
    end
end