local old_QuestLog_UpdateQuestDetails=QuestLog_UpdateQuestDetails; local old_GossipFrameOptionsUpdate=GossipFrameOptionsUpdate; local old_GossipFrameUpdate=GossipFrameUpdate; local old_QuestLog_Update=QuestLog_Update; local old_GossipFrameAvailableQuestsUpdate=GossipFrameAvailableQuestsUpdate; local old_GossipFrameActiveQuestsUpdate=GossipFrameActiveQuestsUpdate; --TODO: Prohledat dbc soubory na texty rozhovodů NPC, commitnout ty error zprávy local trim=function(text) if not text then return nil; end return gsub(gsub(gsub(string.lower(text), "%s+", " "), "%s+$", ""), "^%s+", ""); end local Translate=function(text) local en = text; text = trim(text); for i=1, CZWOW_QuestTitle_count, 1 do if getglobal("CZWOW_QuestTitle_"..i)[text] then return getglobal("CZWOW_QuestTitle_"..i)[text]; end end for i=1, CZWOW_QuestObjective_count, 1 do if getglobal("CZWOW_QuestObjective_"..i)[text] then return getglobal("CZWOW_QuestObjective_"..i)[text]; end end for i=1, CZWOW_QuestDescription_count, 1 do if getglobal("CZWOW_QuestDescription_"..i)[text] then return getglobal("CZWOW_QuestDescription_"..i)[text]; end end for i=1, CZWOW_QuestProgress_count, 1 do if getglobal("CZWOW_QuestProgress_"..i)[text] then return getglobal("CZWOW_QuestProgress_"..i)[text]; end end for i=1, CZWOW_QuestReward_count, 1 do if getglobal("CZWOW_QuestReward_"..i)[text] then return getglobal("CZWOW_QuestReward_"..i)[text]; end end for i=1, CZWOW_NPCAction_count, 1 do if getglobal("CZWOW_NPCAction_"..i)[text] then return getglobal("CZWOW_NPCAction_"..i)[text]; end end for i=1, CZWOW_BookPage_count, 1 do if getglobal("CZWOW_BookPage_"..i)[text] then return getglobal("CZWOW_BookPage_"..i)[text]; end end for i=1, CZWOW_NPCText_count, 1 do if getglobal("CZWOW_NPCText_"..i)[text] then return getglobal("CZWOW_NPCText_"..i)[text]; end end return en; end CzWoW_OnLoad=function() DEFAULT_CHAT_FRAME:AddMessage("CzWoW načteno. Díky addonu by měl fungovat překlad výprav, NPC textů, textů knížek, rozhraní klienta, tutoriál, chybové hlášení uprostřed obrazovky. Pomoci překladu můžete na stránkách http://wowpreklad.zdechov.net/"); end CZWOW_OnUpdate=function() if QuestFrameProgressPanel:IsVisible() then QuestFrameProgressPanel_OnShow(); end if QuestFrameRewardPanel:IsVisible() then QuestFrameRewardPanel_OnShow(); end if QuestFrameDetailPanel:IsVisible() then QuestFrameDetailPanel_OnShow(); end if ItemTextFrame:IsVisible() then ItemTextFrame_OnEvent(); end end --formuláře výprav u NPC QuestFrameDetailPanel_OnShow=function() if getglobal("CZWOW_QuestTitle_1")[trim(GetTitleText())] then QuestTitleText:SetText(Translate(GetTitleText())); QuestObjectiveText:SetText(Translate(GetObjectiveText())); QuestDescription:SetText(Translate(GetQuestText())); end end QuestFrameProgressPanel_OnShow=function() if getglobal("CZWOW_QuestTitle_1")[trim(GetTitleText())] then QuestProgressTitleText:SetText(Translate(GetTitleText())); QuestProgressText:SetText(Translate(GetProgressText())); end end QuestFrameRewardPanel_OnShow=function() if getglobal("CZWOW_QuestTitle_1")[trim(GetTitleText())] then QuestRewardTitleText:SetText(Translate(GetTitleText())); QuestRewardText:SetText(Translate(GetRewardText())); end; end --konec formuláře výprav --questlog QuestLog_UpdateQuestDetails=function(...) old_QuestLog_UpdateQuestDetails(...); local questDescription; local questObjectives; questDescription, questObjectives=GetQuestLogQuestText(); questLogTitleText, _, _, _, _, _, _, _ = GetQuestLogTitle(GetQuestLogSelection()); if getglobal("CZWOW_QuestTitle_1")[trim(questLogTitleText)] then QuestLogQuestTitle:SetText(Translate(questLogTitleText)); QuestLogObjectivesText:SetText(Translate(questObjectives)); QuestLogQuestDescription:SetText(Translate(questDescription)); end end QuestLog_Update=function() old_QuestLog_Update(); local buttons = QuestLogScrollFrame.buttons; local numButtons = #buttons; local scrollOffset = HybridScrollFrame_GetOffset(QuestLogScrollFrame); local questIndex, questTitleTag, questNumGroupMates, questNormalText, questCheck; local title, level, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily; local partyMembersOnQuest, tempWidth, textWidth; for i=1, numButtons do local questLogTitle = buttons[i]; questIndex = i + scrollOffset; questLogTitle:SetID(questIndex); title, _, _, _, _, _, _, _ = GetQuestLogTitle(questIndex); if questLogTitle then questLogTitle:SetText(Translate(title)); end end end --konec questlog --Formuláře NPC postav GossipFrameOptionsUpdate=function(...) if select("#", ...)>0 then old_GossipFrameOptionsUpdate(...); for i=1, NUMGOSSIPBUTTONS, 1 do titleButton=getglobal("GossipTitleButton" .. i); local en=trim(titleButton:GetText()); if getglobal("CZWOW_NPCAction_1")[en] then titleButton:SetText(Translate(en)); GossipResize(titleButton); end -- TODO: kontrolovat také s bez "The" end end end GossipFrameUpdate=function() old_GossipFrameUpdate(); local en=trim(GossipGreetingText:GetText()); GossipGreetingText:SetText(Translate(en)); end; GossipFrameActiveQuestsUpdate=function(...) local titleButton; local titleIndex = 1; old_GossipFrameActiveQuestsUpdate(...); for i=1, select("#", ...), 3 do titleButton = _G["GossipTitleButton" .. titleIndex]; if getglobal("CZWOW_QuestTitle_1")[trim(select(i, ...))] then titleButton:SetText(Translate(select(i, ...))); end titleIndex = titleIndex + 1; end end GossipFrameAvailableQuestsUpdate=function(...) local titleButton; local titleIndex = 1; old_GossipFrameAvailableQuestsUpdate(...); for i=1, select("#", ...), 3 do titleButton = _G["GossipTitleButton" .. titleIndex]; if getglobal("CZWOW_QuestTitle_1")[trim(select(i, ...))] then titleButton:SetText(Translate(select(i, ...))); end titleIndex = titleIndex + 1; end end --konec formuláře NPC postav --page texty ItemTextFrame_OnEvent=function(self, event, ...) local en=ItemTextGetText(); if getglobal("CZWOW_BookPage_1")[trim(en)] then ItemTextPageText:SetText(Translate(en)); end end; --konec page texty --DEFAULT_CHAT_FRAME:AddMessage("NPC");