author | sheepluva |
Sun, 08 Dec 2019 02:09:19 +0100 | |
branch | hedgeroid |
changeset 15520 | de08a3ae4f8d |
parent 13731 | 247d1bcf3c5e |
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 |
|
13728
ade61b4eb63f
Don't load locale Lua script if LOCALE == "en"
Wuzzy <Wuzzy2@mail.ru>
parents:
13093
diff
changeset
|
3 |
if LOCALE ~= "en" then |
13731
247d1bcf3c5e
Add 2nd optional parameter to HedgewarsScriptLoad. If false, its OK if file does not exist. Also, return true/false on success
Wuzzy <Wuzzy2@mail.ru>
parents:
13728
diff
changeset
|
4 |
HedgewarsScriptLoad("Locale/" .. tostring(LOCALE) .. ".lua", false) |
13728
ade61b4eb63f
Don't load locale Lua script if LOCALE == "en"
Wuzzy <Wuzzy2@mail.ru>
parents:
13093
diff
changeset
|
5 |
end |
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
|
6 |
|
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
|
7 |
function loc(text) |
8824
fe9eacd390f2
Unbreak lua localisation, fix untranslated login prompt, update translations.
nemo
parents:
8349
diff
changeset
|
8 |
if locale ~= nil and locale[text] ~= nil then return locale[text] |
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
|
9 |
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
|
10 |
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
|
11 |
end |
12018
3e615852f36e
Add loc_noop to Locale Lua library
Wuzzy <almikes@aol.com>
parents:
8824
diff
changeset
|
12 |
|
3e615852f36e
Add loc_noop to Locale Lua library
Wuzzy <almikes@aol.com>
parents:
8824
diff
changeset
|
13 |
function loc_noop(text) |
3e615852f36e
Add loc_noop to Locale Lua library
Wuzzy <almikes@aol.com>
parents:
8824
diff
changeset
|
14 |
return text |
3e615852f36e
Add loc_noop to Locale Lua library
Wuzzy <almikes@aol.com>
parents:
8824
diff
changeset
|
15 |
end |