share/hedgewars/Data/Scripts/Locale.lua
author koda
Mon, 04 Mar 2013 13:44:33 +0100
changeset 8642 d7062e684466
parent 8349 a1dbe148f10f
child 8824 fe9eacd390f2
permissions -rw-r--r--
use rev info from the just created file when configuring without mercurial

-- Library for localizing strings in lua scripts

local lang = HedgewarsScriptLoad("Locale/" .. tostring(L) .. ".lua")

if lang ~= nil then
    lang()
else
    lang = HedgewarsScriptLoad("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