Changeset 763


Ignore:
Timestamp:
Jan 25, 2014, 12:45:26 PM (11 years ago)
Author:
maron
Message:
  • Added: addon translation game object and item for 5.4.0
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Export/files/5.4.0/CzWoW/CzWoW.lua

    r757 r763  
    55
    66Debug = false;    --turn this when you want to compare trim english text with text database
    7 
     7 
    88-------------------
    99--global function--
     
    6464                end
    6565        end
    66      return en;
    67      
     66          for i=1, CZWOW_ItemName_count, 1 do
     67                  if getglobal("CZWOW_ItemName_"..i)[text] then
     68                        return getglobal("CZWOW_ItemName_"..i)[text];
     69                end
     70        end
     71          for i=1, CZWOW_ItemDescription_count, 1 do
     72                  if getglobal("CZWOW_ItemDescription_"..i)[text] then
     73                        return getglobal("CZWOW_ItemDescription_"..i)[text];
     74                end
     75        end
     76    for i=1, CZWOW_ObjectName_count, 1 do
     77            if getglobal("CZWOW_ObjectName_"..i)[text] then
     78        return getglobal("CZWOW_ObjectName_"..i)[text];
     79        end
     80          end
     81     
     82    return en;
     83 
    6884end   
    6985
     
    108124  self:RegisterEvent("QUEST_LOG_UPDATE");
    109125 
    110         if(GameTooltip:GetScript("OnTooltipSetItem")) then
     126 
     127  GameTooltip:HookScript("OnUpdate",GameObjectChange);
     128  if(GameTooltip:GetScript("OnTooltipSetItem")) then
    111129                GameTooltip:HookScript("OnTooltipSetItem",ItemChangeName);
    112130        else
    113131                GameTooltip:SetScript("OnTooltipSetItem",ItemChangeName);
    114132        end
    115  
     133  for nn, tooltip in ipairs(TooltipList) do
     134      if tooltip then
     135               for _, methodName in ipairs(MethodList) do
     136            hooksecurefunc(tooltip, methodName, ItemChangeName);
     137         end
     138      end
     139  end
     140 
     141end
     142
     143--------Translate item------------------
     144TooltipList = {
     145   ItemRefTooltip,
     146   GameTooltip,
     147   ShoppingTooltip1,
     148   ShoppingTooltip2,
     149   ComparisonTooltip1,
     150   ComparisonTooltip2,
     151}
     152
     153MethodList = {
     154   "SetLootItem",
     155   "SetHyperlink",
     156   "SetBagItem",
     157   "SetInventoryItem",
     158   "SetAuctionItem",
     159   "SetAuctionSellItem",
     160   "SetLootRollItem",
     161   "SetTradeSkillItem",
     162   "SetTrainerService",
     163   "SetInboxItem",
     164   "SetSendMailItem",
     165   "SetQuestItem",
     166   "SetQuestLogItem",
     167   "SetTradePlayerItem",
     168   "SetTradeTargetItem",
     169   "SetMerchantItem",
     170   "SetHyperlinkCompareItem",
     171   "SetBuybackItem",
     172}
     173
     174function TranslateTooltip(this)
     175  if this then
     176    local text = this:GetText();
     177          for i=1, CZWOW_ItemName_count, 1 do
     178                  if getglobal("CZWOW_ItemName_"..i)[trim(text)] then
     179                        text = getglobal("CZWOW_ItemName_"..i)[trim(text)];
     180                end
     181        end
     182 --   text = "bleble";
     183--    DEFAULT_CHAT_FRAME:AddMessage(text);
     184    this:SetText(text);
     185  end
    116186end
    117187
    118188function ItemChangeName(this)
    119         local name,link = this:GetItem();
    120 --  this:SetText("Fs");
    121 --  this:UpdateTooltip(this);
    122  -- this:SetText("Fa");
    123 
    124         --              this:AddLine("Item name: "..name);
    125         --              this:Show();
    126 end
     189  local name = "test ěščřžýáíéůú fsd fa";
     190  if CZWOW_ItemName_count > 0 then
     191   TranslateTooltip(GameTooltipTextLeft1);
     192   TranslateTooltip(ItemRefTooltipTextLeft1);
     193   TranslateTooltip(ShoppingTooltip1TextLeft2);
     194   TranslateTooltip(ShoppingTooltip2TextLeft2);
     195   TranslateTooltip(ComparisonTooltip1TextLeft4);
     196   TranslateTooltip(ComparisonTooltip2TextLeft6);
     197   --/run
     198  end
     199  if CZWOW_ItemDescription_count > 0 then
     200   for i=1,GameTooltip:NumLines()do
     201     local mytext=_G["GameTooltipTextLeft"..i];
     202     if "\"" == strsub(mytext:GetText(), 0,1) then
     203       local text = strsub(mytext:GetText(), 2,strlen(mytext:GetText())-2);
     204       text = text..".";
     205             for i=1, CZWOW_ItemDescription_count, 1 do
     206                    if getglobal("CZWOW_ItemDescription_"..i)[trim(text)] then
     207                        text = getglobal("CZWOW_ItemDescription_"..i)[trim(text)];
     208                end
     209         end
     210       mytext:SetText("\""..text.."\"");
     211     end
     212   end
     213  end
     214   
     215   this:Show();
     216end
     217---------item at vendor------
     218local old_MerchantFrame_UpdateMerchantInfo = MerchantFrame_UpdateMerchantInfo;
     219function MerchantFrame_UpdateMerchantInfo()
     220  old_MerchantFrame_UpdateMerchantInfo();
     221        local numMerchantItems = GetMerchantNumItems();
     222        for i=1, MERCHANT_ITEMS_PER_PAGE, 1 do
     223                local index = (((MerchantFrame.page - 1) * MERCHANT_ITEMS_PER_PAGE) + i);
     224                if ( index <= numMerchantItems ) then
     225                        name, texture, price, quantity, numAvailable, isUsable, extendedCost = GetMerchantItemInfo(index);
     226      local text = name;
     227            for i=1, CZWOW_ItemName_count, 1 do
     228                    if getglobal("CZWOW_ItemName_"..i)[trim(text)] then
     229                        text = getglobal("CZWOW_ItemName_"..i)[trim(text)];
     230                end
     231        end
     232                        getglobal("MerchantItem"..i.."Name"):SetText(text);
     233    end
     234  end
     235end
     236
     237-------item at loot--------------------
     238local old_LootFrame_Update = LootFrame_Update;
     239function LootFrame_Update()
     240  old_LootFrame_Update();
     241        local numLootItems = LootFrame.numLootItems;
     242        --Logic to determine how many items to show per page
     243        local numLootToShow = LOOTFRAME_NUMBUTTONS;
     244        if ( numLootItems > LOOTFRAME_NUMBUTTONS ) then
     245                numLootToShow = numLootToShow - 1;
     246        end
     247        local texture, item, quantity, quality;
     248        local button, countString, color;
     249        for index = 1, LOOTFRAME_NUMBUTTONS do
     250                local slot = (numLootToShow * (LootFrame.page - 1)) + index;
     251                                texture, item, quantity, quality = GetLootSlotInfo(slot);
     252
     253        local text = item;
     254              for i=1, CZWOW_ItemName_count, 1 do
     255                      if getglobal("CZWOW_ItemName_"..i)[trim(text)] then
     256                        text = getglobal("CZWOW_ItemName_"..i)[trim(text)];
     257                end
     258        end
     259
     260                                getglobal("LootButton"..index.."Text"):SetText(text);
     261        end
     262end
     263
     264---------translate gameobject----------
     265function GameObjectChange(this)
     266  if 1 == GameTooltip:NumLines() then
     267    if CZWOW_ObjectName_count > 0 then
     268            if GameTooltipTextLeft1 then
     269        for i=1, CZWOW_ObjectName_count, 1 do
     270          local text = GameTooltipTextLeft1:GetText();
     271                    if getglobal("CZWOW_ObjectName_"..i)[trim(text)] then
     272                        GameTooltipTextLeft1:SetText(getglobal("CZWOW_ObjectName_"..i)[trim(text)]);
     273                end
     274          end
     275        GameTooltip:Show();
     276      end;
     277    end
     278  end
     279end         
    127280
    128281
     
    245398                questLogTitle:SetID(questIndex);
    246399                        title, _, _, _, _, _, _, _ = GetQuestLogTitle(questIndex);
    247                         if questLogTitle then questLogTitle:SetText(Translate(title));  end
     400                        if questLogTitle then questLogTitle:SetText(Translate(title));  end 
    248401        end
    249402end
  • trunk/includes/Version.php

    r762 r763  
    66// and system will need database update.
    77
    8 $Revision = 762; // Subversion revision
     8$Revision = 763; // Subversion revision
    99$DatabaseRevision = 748; // Database structure revision
    10 $ReleaseTime = '2014-01-24';
     10$ReleaseTime = '2014-01-25';
Note: See TracChangeset for help on using the changeset viewer.