PetTracker

PetTracker

12M Downloads

Localizing all rival names

MrPollux opened this issue ยท 0 comments

commented

The following code can e.g. run in file rival.lua at line 21.

do local tooltipName = ("%sDatamineTooltip"):format(ADDON) local tooltip = _G.CreateFrame("GameTooltip", tooltipName, UIParent, "GameTooltipTemplate") local tooltipTitle = _G[("%sTextLeft1"):format(tooltipName)] tooltip:SetOwner(UIParent, "ANCHOR_NONE") function localizeAllNames() local count = 0 local found = 0 local info = Addon.RivalInfo for id, data in pairs(info) do count = count + 1 tooltip:SetHyperlink(("unit:Creature-0-0-0-0-%d"):format(id)) local name = tooltipTitle:GetText() if name then found = found + 1 info[id] = data:gsub("^[^:]+", name) end end if count > found then print("localizeAllNames hat nicht geklappt", count, found) end return count == found end if not localizeAllNames() then localizeAllNames() end tooltip:Hide() end

Regards