author | Henek |
Tue, 18 Jan 2011 22:55:58 +0100 | |
changeset 4854 | 881c8232b66a |
parent 4502 | 759c1a3bb156 |
child 5616 | a96231121eac |
permissions | -rw-r--r-- |
4854
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
4502
diff
changeset
|
1 |
-- Library for localizing strings in lua scripts |
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
4502
diff
changeset
|
2 |
|
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
|
3 |
local lang = loadfile(GetDataPath() .. "Locale/" .. tostring(L) .. ".lua") |
4854
881c8232b66a
adding my new Tracker library so mikade can use it with you guys on dev, still might change a bit though
Henek
parents:
4502
diff
changeset
|
4 |
|
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
|
5 |
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
|
6 |
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
|
7 |
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
|
8 |
|
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 |
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
|
10 |
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
|
11 |
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
|
12 |
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
|
13 |
end |