share/hedgewars/Data/Scripts/Locale.lua
changeset 5616 a96231121eac
parent 4854 881c8232b66a
child 8349 a1dbe148f10f
equal deleted inserted replaced
5614:a281dce3fafc 5616:a96231121eac
     1 -- Library for localizing strings in lua scripts
     1 -- Library for localizing strings in lua scripts
     2 
     2 
     3 local lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua")
     3 local lang = loadfile(GetUserDataPath() .. "Locale/" .. tostring(L) .. ".lua")
     4 
     4 
     5 if lang ~= nil then
     5 if lang ~= nil then
     6     lang()
     6     lang()
       
     7 else
       
     8     lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua")
       
     9     if lang ~= nil then
       
    10         lang()
       
    11     end
     7 end
    12 end
     8 
    13 
     9 function loc(text)
    14 function loc(text)
    10     if lang ~= nil and locale ~= nil and locale[text] ~= nil then return locale[text]
    15     if lang ~= nil and locale ~= nil and locale[text] ~= nil then return locale[text]
    11     else return text
    16     else return text