From e2de8ef0acb56b1684b56e1c21c7b01073d24e51 Mon Sep 17 00:00:00 2001 From: Jamie Schembri Date: Thu, 6 Feb 2014 22:19:52 +0100 Subject: [PATCH] Handle unknown locales, better structure. --- core.lua | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/core.lua b/core.lua index 9d6fb83..c6855a6 100644 --- a/core.lua +++ b/core.lua @@ -1,20 +1,35 @@ -local L = { - enUS = "Fishing Bobber", - deDE = "Angelschwimmer", - esES = "Corcho de pesca", - frFR = "Flotteur", - ruRU = "поплавок", - ptBR = "Flutador para Pesca" -} +local frame = CreateFrame("Frame") -GameTooltip:HookScript("OnShow", function() - local localized = L[GetLocale()] +frame:RegisterEvent("PLAYER_LOGIN") +frame:SetScript("OnEvent", function() + local L = { + deDE = "Angelschwimmer", + enUS = "Fishing Bobber", + esES = "Corcho de pesca", + frFR = "Flotteur", + ptBR = "Flutador para Pesca", + ruRU = "поплавок" - -- don't do anything if we don't have a string for this locale - if not localized then return end + -- itIT = "", + -- esMX = "", + -- koKR = "", + -- zhCN = "", + -- zhTW = "", + } + local localized = L[GetLocale()] - local tooltipText = GameTooltipTextLeft1 - if tooltipText and tooltipText:GetText() == localized then - GameTooltip:Hide() + if not localized then + print("|cFFFF0000HideFishingBobberTooltip does not work under your locale. " .. + "You can help to fix this by leaving a comment on the Curse or " .. + "WoWInterface addon page with the name of the fishing bobber in your language.") + return end + + GameTooltip:HookScript("OnShow", function() + local tooltipText = GameTooltipTextLeft1 + if tooltipText and tooltipText:GetText() == localized then + GameTooltip:Hide() + end + end) end) + -- 1.7.9.5