source: trunk/Modules/Export/files/4.3.4/CzWoW/Localization.lua

Last change on this file was 683, checked in by maron, 11 years ago
  • Added: Export/files/4.3.4
File size: 4.0 KB
Line 
1local i=CzWoW_interface;
2local n=CzWoW_interface_entoname;
3local CanTranslate = true;
4local BadText = {};
5local BadPartText = {};
6local BadIndex = {};
7local BadPartIndex = {};
8
9
10
11local Translate=function(index)
12 if i[index] then
13 return(i[index])
14 else
15 return(getglobal(index))
16 end
17end
18
19local DoTranslateByText=function(text)
20 if i[n[text]] then
21 return(i[n[text]])
22 else
23 return(text)
24 end
25end
26
27local 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
39end
40
41
42BadText["0"] = " ";
43BadText["1"] = " ";
44BadText["2"] = " ";
45BadText["3"] = " ";
46BadText["-"] = " ";
47BadText[" - "] = " ";
48BadText["..."] = " ";
49
50BadPartText["/"] = " ";
51BadPartText["\\"] = " ";
52BadPartText["$"] = " ";
53BadPartText["|"] = " ";
54BadPartText["\""] = " ";
55BadPartText["http"] = " ";
56
57BadPartIndex["%dx%s"] = " ";
58BadPartIndex["LOOT"] = " ";
59BadPartIndex["SPELL_FAILED"] = " ";
60BadPartIndex["ERR"] = " ";
61
62BadIndex["COPPER_AMOUNT_TEXTURE"] = " ";
63BadIndex["SPELL_REAGENTS"] = " ";
64BadIndex["SHOW_CASTABLE_DEBUFFS_TEXT"] = " ";
65BadIndex["XP_TEXT"] = " ";
66BadIndex["SPELL_REAGENTS"] = " ";
67BadIndex["SPELL_RANGE"] = " ";
68BadIndex["KEY_ESCAPE"] = " ";
69
70
71---------------------------------------------------------------------
72 -------zacátek hlavní funkce prekladu rozhraní
73---------------------------------------------------------------------
74
75TranslateInterface=function()
76
77--error message in the middle screen
78local old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent;
79local 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
86end
87UIErrorsFrame:SetScript('OnEvent', onEvent)
88
89--tutotial
90local old_TutorialFrame_Update = TutorialFrame_Update;
91TutorialFrame_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
99end
100
101--GameTooltipFrame begin
102local oldTooltipSetText=GameTooltip["SetText"];
103GameTooltip["SetText"]=function(object, text, r, g, b, alphaValue, textWrap)
104 text=TranslateByText(text);
105 oldTooltipSetText(object, text, r, g, b, alphaValue, textWrap);
106end
107
108local oldTooltipAddLine=GameTooltip["AddLine"];
109GameTooltip["AddLine"]=function(object, text, r, g, b, alphaValue, textWrap)
110 text=TranslateByText(text);
111 oldTooltipAddLine(object, text, r, g, b, alphaValue, textWrap);
112end
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
144end
145
146---------------------------------------------------------------------
147 -------konec hlavní funkce prekladu rozhraní
148---------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.