local i=CzWoW_interface; local n=CzWoW_interface_entoname; local CanTranslate = true; local BadText = {}; local BadPartText = {}; local BadIndex = {}; local BadPartIndex = {}; local Translate=function(index) if i[index] then return(i[index]) else return(getglobal(index)) end end local DoTranslateByText=function(text) if i[n[text]] then return(i[n[text]]) else return(text) end end local TranslateByText=function(text) if Debug then if (text == nil) then else print("En: "..text); text = DoTranslateByText(text); print("Cz: "..text); print(text); return text; end else return DoTranslateByText(text); end end BadText["0"] = " "; BadText["1"] = " "; BadText["2"] = " "; BadText["3"] = " "; BadText["-"] = " "; BadText[" - "] = " "; BadText["..."] = " "; BadPartText["/"] = " "; BadPartText["\\"] = " "; BadPartText["$"] = " "; BadPartText["|"] = " "; BadPartText["\""] = " "; BadPartText["http"] = " "; BadPartIndex["%dx%s"] = " "; BadPartIndex["LOOT"] = " "; BadPartIndex["SPELL_FAILED"] = " "; BadPartIndex["ERR"] = " "; BadIndex["COPPER_AMOUNT_TEXTURE"] = " "; BadIndex["SPELL_REAGENTS"] = " "; BadIndex["SHOW_CASTABLE_DEBUFFS_TEXT"] = " "; BadIndex["XP_TEXT"] = " "; BadIndex["SPELL_REAGENTS"] = " "; BadIndex["SPELL_RANGE"] = " "; BadIndex["KEY_ESCAPE"] = " "; --------------------------------------------------------------------- -------zacátek hlavní funkce prekladu rozhraní --------------------------------------------------------------------- TranslateInterface=function() --error message in the middle screen local old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent; local function onEvent(self, event, ...) local arg1, arg2, arg3, arg4 = ... if(event == 'UI_ERROR_MESSAGE') then self:AddMessage(TranslateByText(arg1), 1.0, 0.1, 0.1, 1.0); else old_UIErrorsFrame_OnEvent(self, event, ...); end end UIErrorsFrame:SetScript('OnEvent', onEvent) --tutotial local old_TutorialFrame_Update = TutorialFrame_Update; TutorialFrame_Update=function(currentTutorial) old_TutorialFrame_Update(currentTutorial); local title = _G["TUTORIAL_TITLE"..currentTutorial]; local text = _G["TUTORIAL"..currentTutorial]; if ( title and text) then TutorialFrameTitle:SetText(TranslateByText(title)); TutorialFrameText:SetText(TranslateByText(text)); end end --GameTooltipFrame begin local oldTooltipSetText=GameTooltip["SetText"]; GameTooltip["SetText"]=function(object, text, r, g, b, alphaValue, textWrap) text=TranslateByText(text); oldTooltipSetText(object, text, r, g, b, alphaValue, textWrap); end local oldTooltipAddLine=GameTooltip["AddLine"]; GameTooltip["AddLine"]=function(object, text, r, g, b, alphaValue, textWrap) text=TranslateByText(text); oldTooltipAddLine(object, text, r, g, b, alphaValue, textWrap); end --Set global var with CZ texts -- export: vyexportovávat pouze určenou verzi indexu for index, value in pairs(i) do CanTranslate = true; en_text = GetText(index); if (n[en_text]) then else CanTranslate = false; end if (i[index] == en_text) then CanTranslate = false; end if (i[index]) then else CanTranslate = false; end if (BadText[i[index]]) then CanTranslate = false; end if (BadIndex[index]) then CanTranslate = false; end for index_BadPartText in pairs(BadPartText) do if (string.find(i[index],index_BadPartText) == 1) then CanTranslate = false; end end for index_BadPartIndex in pairs(BadPartIndex) do if (string.find(index,index_BadPartIndex) == 1) then CanTranslate = false; end end if (CanTranslate) then setglobal(index,i[index]); end end end --------------------------------------------------------------------- -------konec hlavní funkce prekladu rozhraní ---------------------------------------------------------------------