| 1 | local i=CzWoW_interface;
|
|---|
| 2 | local n=CzWoW_interface_entoname;
|
|---|
| 3 | local CanTranslate = true;
|
|---|
| 4 | local BadText = {};
|
|---|
| 5 | local BadPartText = {};
|
|---|
| 6 | local BadIndex = {};
|
|---|
| 7 | local BadPartIndex = {};
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | local Translate=function(index)
|
|---|
| 12 | if i[index] then
|
|---|
| 13 | return(i[index])
|
|---|
| 14 | else
|
|---|
| 15 | return(getglobal(index))
|
|---|
| 16 | end
|
|---|
| 17 | end
|
|---|
| 18 |
|
|---|
| 19 | local DoTranslateByText=function(text)
|
|---|
| 20 | if i[n[text]] then
|
|---|
| 21 | return(i[n[text]])
|
|---|
| 22 | else
|
|---|
| 23 | return(text)
|
|---|
| 24 | end
|
|---|
| 25 | end
|
|---|
| 26 |
|
|---|
| 27 | local TranslateByText=function(text)
|
|---|
| 28 | if Debug then
|
|---|
| 29 | if (text == nil) then else
|
|---|
| 30 | print("En: "..text);
|
|---|
| 31 | text = DoTranslateByText(text);
|
|---|
| 32 | print("Cz: "..text);
|
|---|
| 33 | print(text);
|
|---|
| 34 | return text;
|
|---|
| 35 | end
|
|---|
| 36 | else
|
|---|
| 37 | return DoTranslateByText(text);
|
|---|
| 38 | end
|
|---|
| 39 | end
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 | BadText["0"] = " ";
|
|---|
| 43 | BadText["1"] = " ";
|
|---|
| 44 | BadText["2"] = " ";
|
|---|
| 45 | BadText["3"] = " ";
|
|---|
| 46 | BadText["-"] = " ";
|
|---|
| 47 | BadText[" - "] = " ";
|
|---|
| 48 | BadText["..."] = " ";
|
|---|
| 49 |
|
|---|
| 50 | BadPartText["/"] = " ";
|
|---|
| 51 | BadPartText["\\"] = " ";
|
|---|
| 52 | BadPartText["$"] = " ";
|
|---|
| 53 | BadPartText["|"] = " ";
|
|---|
| 54 | BadPartText["\""] = " ";
|
|---|
| 55 | BadPartText["http"] = " ";
|
|---|
| 56 |
|
|---|
| 57 | BadPartIndex["%dx%s"] = " ";
|
|---|
| 58 | BadPartIndex["LOOT"] = " ";
|
|---|
| 59 | BadPartIndex["SPELL_FAILED"] = " ";
|
|---|
| 60 | BadPartIndex["ERR"] = " ";
|
|---|
| 61 |
|
|---|
| 62 | BadIndex["COPPER_AMOUNT_TEXTURE"] = " ";
|
|---|
| 63 | BadIndex["SPELL_REAGENTS"] = " ";
|
|---|
| 64 | BadIndex["SHOW_CASTABLE_DEBUFFS_TEXT"] = " ";
|
|---|
| 65 | BadIndex["XP_TEXT"] = " ";
|
|---|
| 66 | BadIndex["SPELL_REAGENTS"] = " ";
|
|---|
| 67 | BadIndex["SPELL_RANGE"] = " ";
|
|---|
| 68 | BadIndex["KEY_ESCAPE"] = " ";
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 | ---------------------------------------------------------------------
|
|---|
| 72 | -------zacátek hlavní funkce prekladu rozhraní
|
|---|
| 73 | ---------------------------------------------------------------------
|
|---|
| 74 |
|
|---|
| 75 | TranslateInterface=function()
|
|---|
| 76 |
|
|---|
| 77 | --error message in the middle screen
|
|---|
| 78 | local old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent;
|
|---|
| 79 | local function onEvent(self, event, ...)
|
|---|
| 80 | local arg1, arg2, arg3, arg4 = ...
|
|---|
| 81 | if(event == 'UI_ERROR_MESSAGE') then
|
|---|
| 82 | self:AddMessage(TranslateByText(arg1), 1.0, 0.1, 0.1, 1.0);
|
|---|
| 83 | else
|
|---|
| 84 | old_UIErrorsFrame_OnEvent(self, event, ...);
|
|---|
| 85 | end
|
|---|
| 86 | end
|
|---|
| 87 | UIErrorsFrame:SetScript('OnEvent', onEvent)
|
|---|
| 88 |
|
|---|
| 89 | --tutotial
|
|---|
| 90 | local old_TutorialFrame_Update = TutorialFrame_Update;
|
|---|
| 91 | TutorialFrame_Update=function(currentTutorial)
|
|---|
| 92 | old_TutorialFrame_Update(currentTutorial);
|
|---|
| 93 | local title = _G["TUTORIAL_TITLE"..currentTutorial];
|
|---|
| 94 | local text = _G["TUTORIAL"..currentTutorial];
|
|---|
| 95 | if ( title and text) then
|
|---|
| 96 | TutorialFrameTitle:SetText(TranslateByText(title));
|
|---|
| 97 | TutorialFrameText:SetText(TranslateByText(text));
|
|---|
| 98 | end
|
|---|
| 99 | end
|
|---|
| 100 |
|
|---|
| 101 | --GameTooltipFrame begin
|
|---|
| 102 | local oldTooltipSetText=GameTooltip["SetText"];
|
|---|
| 103 | GameTooltip["SetText"]=function(object, text, r, g, b, alphaValue, textWrap)
|
|---|
| 104 | text=TranslateByText(text);
|
|---|
| 105 | oldTooltipSetText(object, text, r, g, b, alphaValue, textWrap);
|
|---|
| 106 | end
|
|---|
| 107 |
|
|---|
| 108 | local oldTooltipAddLine=GameTooltip["AddLine"];
|
|---|
| 109 | GameTooltip["AddLine"]=function(object, text, r, g, b, alphaValue, textWrap)
|
|---|
| 110 | text=TranslateByText(text);
|
|---|
| 111 | oldTooltipAddLine(object, text, r, g, b, alphaValue, textWrap);
|
|---|
| 112 | end
|
|---|
| 113 |
|
|---|
| 114 | --Set global var with CZ texts
|
|---|
| 115 | -- export: vyexportovávat pouze určenou verzi indexu
|
|---|
| 116 |
|
|---|
| 117 | for index, value in pairs(i) do
|
|---|
| 118 | CanTranslate = true;
|
|---|
| 119 | en_text = GetText(index);
|
|---|
| 120 |
|
|---|
| 121 | if (n[en_text]) then else CanTranslate = false; end
|
|---|
| 122 | if (i[index] == en_text) then CanTranslate = false; end
|
|---|
| 123 | if (i[index]) then else CanTranslate = false; end
|
|---|
| 124 | if (BadText[i[index]]) then CanTranslate = false; end
|
|---|
| 125 | if (BadIndex[index]) then CanTranslate = false; end
|
|---|
| 126 |
|
|---|
| 127 | for index_BadPartText in pairs(BadPartText) do
|
|---|
| 128 | if (string.find(i[index],index_BadPartText) == 1) then CanTranslate = false; end
|
|---|
| 129 | end
|
|---|
| 130 |
|
|---|
| 131 | for index_BadPartIndex in pairs(BadPartIndex) do
|
|---|
| 132 | if (string.find(index,index_BadPartIndex) == 1) then CanTranslate = false; end
|
|---|
| 133 | end
|
|---|
| 134 |
|
|---|
| 135 | if (CanTranslate) then
|
|---|
| 136 | setglobal(index,i[index]);
|
|---|
| 137 | end
|
|---|
| 138 |
|
|---|
| 139 | end
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
|
|---|
| 143 |
|
|---|
| 144 | end
|
|---|
| 145 |
|
|---|
| 146 | ---------------------------------------------------------------------
|
|---|
| 147 | -------konec hlavní funkce prekladu rozhraní
|
|---|
| 148 | ---------------------------------------------------------------------
|
|---|