Mercurial > wow > mailopener
diff Core.lua @ 68:eadff31e61e8
Localization of all files. Testing packager settings (especially automatic locale exports), localization is not yet finished.
| author | Zerotorescue |
|---|---|
| date | Wed, 15 Sep 2010 13:10:56 +0200 |
| parents | 4166a335ca81 |
| children | c15dbeb84ddc |
line wrap: on
line diff
--- a/Core.lua Tue Sep 14 11:17:38 2010 +0200 +++ b/Core.lua Wed Sep 15 13:10:56 2010 +0200 @@ -1,5 +1,6 @@ -- You can access this addon's object through: LibStub("AceAddon-3.0"):GetAddon("MailOpener") local MailOpener = LibStub("AceAddon-3.0"):NewAddon("MailOpener", "AceEvent-3.0", "AceTimer-3.0"); +local L = LibStub("AceLocale-3.0"):GetLocale("MailOpener"); -- You can check if MailOpener is busy with the global MailAddonBusy (if not MailAddonBusy then ...do something... end) -- MailAddonBusy will be nil when nothing is happening or filled with the addon name when MO is working @@ -99,9 +100,9 @@ for name, module in self:IterateModules() do if self.db.profile.modules[name] ~= nil then if self.db.profile.modules[name] then - self:Debug("|cff00ff00Enabling|r module: " .. name); + self:Debug(("|cff00ff00Enabling|r module: "):format(name)); else - self:Debug("|cffff0000Disabling|r module: " .. name); + self:Debug(("|cffff0000Disabling|r module: "):format(name)); end module:SetEnabledState(self.db.profile.modules[name]); @@ -175,7 +176,7 @@ -- Shift key = toggle addon on or off, since addon is already on there's only one option if not MailOpener:IsEnabled() then - print("|cff15ff00Mail Opener|r: Shift key was held down, so |cff00ff00enabling|r the entire addon as well as automatic opening of mail."); + self:Print(L["Shift key was held down, so |cff00ff00enabling|r the entire addon as well as automatic opening of mail."]); MailOpener:Enable(); @@ -184,7 +185,7 @@ self:SetChecked(true); else - print("|cff15ff00Mail Opener|r: Shift key was held down, so |cffff0000disabling|r the entire addon."); + self:Print(L["Shift key was held down, so |cffff0000disabling|r the entire addon."]); MailOpener:Disable(); @@ -194,19 +195,19 @@ -- Normal click if self:GetChecked() then - print("|cff15ff00Mail Opener|r: |cff00ff00Enabling|r automatic opening of mail."); + self:Print(L["|cff00ff00Enabling|r automatic opening of mail."]); AutoOpenMail = true; MailOpener:ScheduleOpen(false); else - print("|cff15ff00Mail Opener|r: |cffff0000Disabling|r automatic opening of mail."); + self:Print(L["|cffff0000Disabling|r automatic opening of mail."]); AutoOpenMail = false; end end end); - check.tooltipTitle = "Mail Opener status"; - check.tooltip = "Toggle automatic mail opening |cff00ff00on|r or |cffff0000off|r (you can also enforce this by holding shift when opening the mailbox).\n\nYou can toggle this addon |cff00ff00on|r or |cffff0000off|r by |cfffed000shift-clicking|r this checkbox."; + check.tooltipTitle = L["Mail Opener status"]; + check.tooltip = L["Toggle automatic mail opening |cff00ff00on|r or |cffff0000off|r (you can also enforce this by holding shift when opening the mailbox).\n\nYou can toggle this addon |cff00ff00on|r or |cffff0000off|r by |cfffed000shift-clicking|r this checkbox."]; check:SetScript("OnEnter", function(self) if MailOpener.db.profile.general.showHelpTooltips then GameTooltip:SetOwner(self, "ANCHOR_BOTTOM") @@ -226,7 +227,7 @@ -- Get reference to the text field local checkboxText = _G[check:GetName() .. "Text"]; - checkboxText:SetText("Mail Opener"); + checkboxText:SetText(L["Mail Opener"]); self.cbOpenAll = check; @@ -237,7 +238,7 @@ -- Make the config button local button = CreateFrame("Button", "btnMailOpenerConfig", MailFrame, "UIPanelButtonTemplate") - button:SetText("Config") + button:SetText(L["Config"]) button:SetHeight(23) button:SetWidth(55) button:SetPoint("TOPRIGHT", MailFrame, "TOPRIGHT", -55, -13); @@ -250,8 +251,8 @@ --BETA: MailOpener:ShowBetaPopup(); --BETA:end end); - button.tooltipTitle = "Mail Opener Config"; - button.tooltip = "Click to open the configuration window for Mail Opener."; + button.tooltipTitle = L["Mail Opener Config"]; + button.tooltip = L["Click to open the configuration window for Mail Opener."]; button:SetScript("OnEnter", function(self) if MailOpener.db.profile.general.showHelpTooltips then GameTooltip:SetOwner(self, "ANCHOR_BOTTOM") @@ -363,21 +364,21 @@ if self.db.profile.uses == 0 and MailOpener.db.profile.general.defaultStatus ~= "_enabled" then StaticPopupDialogs["MailOpenerFirstUseConfirmBox"] = { - text = "You are using |cff15ff00Mail Opener|r for the first time. Do you wish to always |cf00ff000enable|r |cfffed000automatic mail opening when you open the mailbox|r?\n\nYou can always change the standard behaviour in the General options.", - button1 = "Yes", - button2 = "No", + text = L["You are using |cff15ff00Mail Opener|r for the first time. Do you wish to always |cf00ff000enable|r |cfffed000automatic mail opening when you open the mailbox|r?\n\nYou can always change the standard behavior in the General options."], + button1 = L["Yes"], + button2 = L["No"], OnAccept = function() MailOpener.db.profile.general.defaultStatus = "_enabled"; - print("|cff15ff00Mail Opener|r: You can always change the default status in the General config (|cff00ffff/mo c|r)."); + self:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]); - print("|cff15ff00Mail Opener|r: |cff00ff00Enabling|r automatic opening of mail."); + self:Print(L["|cff00ff00Enabling|r automatic opening of mail."]); MailOpener.cbOpenAll:SetChecked(true); AutoOpenMail = true; MailOpener:ScheduleOpen(false); end, OnCancel = function (_,reason) - print("|cff15ff00Mail Opener|r: You can always change the default status in the General config (|cff00ffff/mo c|r)."); + self:Print(L["You can always change the default status in the General config (|cff00ffff/mo c|r)."]); end, timeout = 0, whileDead = 1, @@ -406,7 +407,7 @@ end if IsShiftKeyDown() then - print("|cff15ff00Mail Opener|r: |cffff0000Disabling|r automatic opening of mail, shift key was down when opening the mailbox."); + self:Print(L["|cffff0000Disabling|r automatic opening of mail, shift key was down when opening the mailbox."]); AutoOpenMail = false; self.cbOpenAll:SetChecked(false); @@ -429,15 +430,6 @@ end end - if self.db.profile.notifications.welcome then - -- Welcome notification - local _, c = UnitClass("player"); - c = RAID_CLASS_COLORS[c]; - c = string.format("|cff%02x%02x%02x", c.r * 255 + 0.5, c.g * 255 + 0.5, c.b * 255 + 0.5); - - print("|cff15ff00Mail Opener|r: Welcome back "..c..UnitName("player").."|r. Requesting new mail from the local Postal Service, your mail will automatically be opened when it becomes available."); - end - mailboxEmptySoundPlayed = nil; mailboxEmptySoundPlayedThisVisit = nil; @@ -664,10 +656,6 @@ -- Stop checking for new mail and unregister the events we needed function MailOpener:Stop() - if self.db.profile.notifications.bye then - print("|cff15ff00Mail Opener|r: Have a nice day. :)"); - end - if MailAddonBusy == self:GetName() then MailAddonBusy = nil; end @@ -707,6 +695,10 @@ end end +function MailOpener:Print(text) + print(L["|cff15ff00Mail Opener|r: %s"]:format(text)); +end + -- Enable our config module if it's disabled and make a reference to it function MailOpener:EnableConfigModule() if not MailOpenerConfig then @@ -758,7 +750,7 @@ -- General copy window for multiple things (clickable URLs, the time remaining, and such) StaticPopupDialogs["MailOpenerCopyWindow"] = { - text = "Please CTRL-C to copy.", + text = L["Press CTRL-C to copy."], button2 = CLOSE, hasEditBox = 1, hasWideEditBox = 1,
