Quantcast

Created stored variable for retaining settings.

KyrosKrane [07-05-15 - 22:06]
Created stored variable for retaining settings.
Set up localization ... now I just have to remember to use it.
Added void storage as optional dependency.
Filename
AnnoyingPopupRemover.lua
AnnoyingPopupRemover.toc
diff --git a/AnnoyingPopupRemover.lua b/AnnoyingPopupRemover.lua
index b0bdfe5..febcbd1 100644
--- a/AnnoyingPopupRemover.lua
+++ b/AnnoyingPopupRemover.lua
@@ -34,17 +34,21 @@ local DebugMode = false;
 local APR_Version = "@project-version@";


+-- Load the saved variables, or initialize if they don't exist yet.
+APR_DB = APR_DB or { } ;
+
+
 -- Print debug output to the chat frame.
 function DebugPrint(...)
 	if (DebugMode) then
-		print ("APR Debug: ", ...);
+		print (L["APR"] .. " " .. L["Debug"] .. ": ", ...);
 	end
 end


 -- Print standard output to the chat frame.
 function ChatPrint(...)
-	print ("APR: ", ...);
+	print (L["APR"] ..": ", ...);
 end


@@ -60,7 +64,7 @@ function PrintVarArgs(...)
 end -- PrintVarArgs()

 -- Announce our load.
-print ("Annoying Popup Remover " .. APR_Version .. " loaded.");
+ChatPrint (L["Annoying Pop-up Remover"] .. " " .. APR_Version .. " " .. L["loaded"] .. ".");


 -- Force the default Void Storage frame to load.
@@ -162,3 +166,29 @@ StaticPopupDialogs["VOID_DEPOSIT_CONFIRM"] = nil;
 -- Curse-specific command to exclude this section from appearing for end users.
 DebugMode = true;
 --@end-do-not-package@
+
+
+-- Localizations
+-- Copied from Gladius; dunno what most of this does, honestly...
+local rawset = rawset
+local tostring = tostring
+
+local L = setmetatable({ }, {__index = function(t, k)
+	local v = tostring(k)
+	rawset(t, k, v)
+	return v
+end})
+
+-- Get the language used by the client.
+local locale = GetLocale();
+
+-- Set the strings used here.
+if locale == "enUS" or locale == "enGB" then
+	-- Not going to localize debug strings for now.
+	L["APR"] = "APR";
+	L["Debug"] = "Debug";
+	L["Annoying Pop-up Remover"] = "Annoying Pop-up Remover";
+	L["loaded"] = "loaded";
+-- elseif locale == "deDE" then
+	-- L["foobar"] = "German here";
+end
diff --git a/AnnoyingPopupRemover.toc b/AnnoyingPopupRemover.toc
index f0eaeac..ea6e6db 100644
--- a/AnnoyingPopupRemover.toc
+++ b/AnnoyingPopupRemover.toc
@@ -2,5 +2,8 @@
 ## Title: Annoying Popup Remover
 ## Notes: Removes the annoying confirmation popup that appears when looting or rolling on bind-on-pickup items, or depositing modified items into void storage.
 ## Author: KyrosKrane Sylvanblade
+## SavedVariables: APR_DB
+## OptionalDeps: Blizzard_VoidStorageUI
+

 AnnoyingPopupRemover.lua