author | koda |
Fri, 11 Oct 2013 17:43:13 +0200 | |
branch | webgl |
changeset 9521 | 8054d9d775fd |
parent 7568 | 75ba91f14ed5 |
permissions | -rw-r--r-- |
7568 | 1 |
-- Library for localizing strings in lua scripts |
2 |
||
3 |
local lang = loadfile(GetUserDataPath() .. "Locale/" .. tostring(L) .. ".lua") |
|
4 |
||
5 |
if lang ~= nil then |
|
6 |
lang() |
|
7 |
else |
|
8 |
lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua") |
|
9 |
if lang ~= nil then |
|
10 |
lang() |
|
11 |
end |
|
12 |
end |
|
13 |
||
14 |
function loc(text) |
|
15 |
if lang ~= nil and locale ~= nil and locale[text] ~= nil then return locale[text] |
|
16 |
else return text |
|
17 |
end |
|
18 |
end |