Loriana
Member
- Joined
- Dec 5, 2015
- Messages
- 3
- Reaction score
- 5
Hi! I created a system which translate all "you see" messages.
function to change language:
I will post source if I get enough help with translation to other languages.
demo works until 31 jan 2016
events\events.xml:
set <event class="Player" method="onLookInShop" enabled="0" /> to enabled ="1"
events\scripts\player.lua:
remove all Player: onLook functions and add this:
global.lua, add this below lib.lua:
data/lib/translate/dictionary.lua:
http://wklej.to/6L3HA
data/lib/translate/words.lua:
http://wklej.to/IozXD
function to change language:
Code:
player:setLang(-1) -- en
player:setLang(0) -- pl
player:setLang(1) -- swe - missing translation
player:setLang(2) -- pt - missing translation
player:setLang(3) -- es - missing translation
I will post source if I get enough help with translation to other languages.
demo works until 31 jan 2016
events\events.xml:
set <event class="Player" method="onLookInShop" enabled="0" /> to enabled ="1"
events\scripts\player.lua:
remove all Player: onLook functions and add this:
Code:
function Player:onLook(thing, position, distance)
self:sendTextMessage(MESSAGE_INFO_DESCR, self:getTranslatedDesc(thing, distance))
end
function Player:onLookInBattleList(creature, distance)
self:sendTextMessage(MESSAGE_INFO_DESCR, self:getTranslatedDesc(creature, distance))
end
function Player:onLookInTrade(partner, item, distance)
self:sendTextMessage(MESSAGE_INFO_DESCR, self:getTranslatedDesc(item, distance))
end
function Player:onLookInShop(itemType, count)
local thing = Item(doCreateItemEx(itemType:getId(), count))
local cid = self:getId()
local msg = self:getTranslatedDesc(thing, -1)
addEvent(doPlayerSendTextMessage, 100, cid, MESSAGE_INFO_DESCR, msg)
return true
end
global.lua, add this below lib.lua:
Code:
dofile('data/lib/translate/words.lua')
data/lib/translate/dictionary.lua:
http://wklej.to/6L3HA
data/lib/translate/words.lua:
http://wklej.to/IozXD