author | dag10 |
Mon, 14 Jan 2013 11:19:59 +0100 | |
changeset 8377 | 869f80966a77 |
parent 8349 | a1dbe148f10f |
child 8824 | fe9eacd390f2 |
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 |
|
8349
a1dbe148f10f
move onNewTurn, onGameTick and onGameTick20 to try and avoid ParseCommand breakage after nextturn call. Needs testing, but should be safe for most scripts. Also fix locale loading.
nemo
parents:
5616
diff
changeset
|
3 |
local lang = HedgewarsScriptLoad("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() |
5616 | 7 |
else |
8349
a1dbe148f10f
move onNewTurn, onGameTick and onGameTick20 to try and avoid ParseCommand breakage after nextturn call. Needs testing, but should be safe for most scripts. Also fix locale loading.
nemo
parents:
5616
diff
changeset
|
8 |
lang = HedgewarsScriptLoad("Locale/" .. tostring(L) .. ".lua") |
5616 | 9 |
if lang ~= nil then |
10 |
lang() |
|
11 |
end |
|
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
|
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 |
|
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
|
14 |
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
|
15 |
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
|
16 |
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
|
17 |
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
|
18 |
end |