Ignore:
Timestamp:
Feb 20, 2010, 10:34:38 PM (15 years ago)
Author:
maron
Message:

Úprava addonu: vyžší stabilita, odstranění chyby špatného zobrazování vzdálenosti v Gridu, naprogramováno překládání textu tooltipů (nejen názvů), oprava tutoriálu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/files/3.3.0/CzWoW/Localization.lua

    r325 r327  
    11local i=CzWoW_interface;
    22local n=CzWoW_interface_entoname;
    3 
    4 local old_TutorialFrame_Update = TutorialFrame_Update;
    5 local old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent;
     3local CanTranslate = true;
     4local BadText = {};
     5local BadPartText = {};
     6local BadIndex = {};
     7
    68
    79local Translate=function(index) 
     
    1315end
    1416
    15 local test_Translate=function(index) 
    16     return("test")
    17 end
    18 
    1917local TranslateByText=function(text)
    2018    if i[n[text]] then
     
    2422    end
    2523end
    26              
     24
     25
     26
     27BadText["0"] = " ";
     28BadText["1"] = " ";
     29BadText["2"] = " ";
     30BadText["3"] = " ";
     31BadText["-"] = " ";
     32BadText[" - "] = " ";
     33BadText["..."] = " ";
     34
     35BadPartText["/"] = " ";
     36BadPartText["\\"] = " ";
     37BadPartText["$"] = " ";
     38BadPartText["|"] = " ";
     39BadPartText["\""] = " ";
     40BadPartText["SPELL_FAILED"] = " ";
     41BadPartText["ERR"] = " ";
     42BadPartText["http"] = " ";
     43BadPartText["%dx%s"] = " ";
     44BadPartText["LOOT"] = " ";
     45
     46BadIndex["COPPER_AMOUNT_TEXTURE"] = " ";
     47BadIndex["SPELL_REAGENTS"] = " ";
     48BadIndex["SHOW_CASTABLE_DEBUFFS_TEXT"] = " ";
     49BadIndex["XP_TEXT"] = " ";
     50BadIndex["SPELL_REAGENTS"] = " ";
     51BadIndex["SPELL_RANGE"] = " ";
    2752
    2853
     
    3459
    3560--error message in the middle screen
     61local old_UIErrorsFrame_OnEvent = UIErrorsFrame_OnEvent;
    3662local function onEvent(self, event, ...)
    3763        local arg1, arg2, arg3, arg4 = ...
     
    4470UIErrorsFrame:SetScript('OnEvent', onEvent)
    4571
    46 --tutotial TODO:Opravil
     72--tutotial
     73local old_TutorialFrame_Update = TutorialFrame_Update;
    4774TutorialFrame_Update=function(currentTutorial)
    4875  old_TutorialFrame_Update(currentTutorial);
     
    5380                TutorialFrameText:SetText(TranslateByText(text));
    5481        end
    55         TutorialFrame:SetHeight(TutorialFrameText:GetHeight() + 62);
    5682end
    5783
     
    5985local oldTooltipSetText=GameTooltip["SetText"];
    6086GameTooltip["SetText"]=function(object, text, r, g, b, alphaValue, textWrap)
    61                 text=TranslateByText(text);
    62         oldTooltipSetText(object, text, r, g, b, alphaValue, textWrap);
     87         text=TranslateByText(text);
     88         oldTooltipSetText(object, text, r, g, b, alphaValue, textWrap);
    6389end
    64 --hooksecurefunc(GameTooltip, "SetText", print);
    65 
    66 
    67 
     90
     91local oldTooltipAddLine=GameTooltip["AddLine"];
     92GameTooltip["AddLine"]=function(object, text, r, g, b, alphaValue, textWrap)
     93         text=TranslateByText(text);
     94   oldTooltipAddLine(object, text, r, g, b, alphaValue, textWrap);
     95end
    6896
    6997--Set global var with CZ texts
    70   for index, value in pairs(i) do       
    71     if (i[index] == "") or (i[index] == getglobal(index)) or (string.find(index,"ERR") == 1) or (string.find(index,"SPELL_FAILED") == 1) or (string.find(i[index],"/") == 1) or (string.find(i[index],"\"") == 1)
    72     then
    73     else
    74       if (i[index]) then
     98-- export: vyexportovávat pouze určenou verzi   indexu
     99
     100  for index, value in pairs(i) do
     101   CanTranslate = true;     
     102   en_text = GetText(index);
     103   
     104
     105   if (n[en_text]) then else CanTranslate = false; end
     106   if (en_text == i[index]) then CanTranslate = false; end
     107   if (BadText[i[index]]) then CanTranslate = false; end
     108   if (BadIndex[index]) then CanTranslate = false; end
     109   if (i[index] == getglobal(index)) then CanTranslate = false; end
     110   if (i[index]) then else CanTranslate = false; end
     111
     112      for index_BadPartText in pairs(BadPartText) do
     113        if (string.find(index,index_BadPartText) == 1) then CanTranslate = false; end
     114        if (string.find(i[index],index_BadPartText) == 1) then CanTranslate = false; end
     115      end       
     116 
     117      if (CanTranslate) then
    75118        setglobal(index,i[index]);
    76119      end
    77     end
     120   
    78121  end
     122
    79123
    80124--AlertFrames.xml
     
    814858end 
    815859
    816 
     860---------------------------------------------------------------------
     861 -------konec hlavní  funkce prekladu rozhraní
     862---------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.