diff Modules/Collected.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 8d1a34cec258
children f01e0184a275
line wrap: on
line diff
--- a/Modules/Collected.lua	Tue Sep 14 11:17:38 2010 +0200
+++ b/Modules/Collected.lua	Wed Sep 15 13:10:56 2010 +0200
@@ -1,7 +1,7 @@
 local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener");
 local mod = MailOpener:NewModule("Collected", "AceEvent-3.0", "AceTimer-3.0");
 
-mod.moduleDescription = "Shows a simple summary of what has been collected at the mailbox.";
+mod.moduleDescription = L["Shows a simple summary of what has been collected at the mailbox."];
 mod.moduleRequired = false;
 
 -- Gold
@@ -239,40 +239,40 @@
 			local timeSpentMinutes = floor( timeSpent / 60 );
 			local timeSpentSeconds = ( timeSpent % 60 );
 			if timeSpentMinutes ~= 0 then
-				printMessage = printMessage .. format("Collected a total of %d mail within %d minutes and %d seconds. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
+				printMessage = printMessage .. format(L["Collected a total of %d mail within %d minutes and %d seconds."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " ";
 			else
-				printMessage = printMessage .. format("Collected a total of %d mail within %d seconds. ", mailOpened, timeSpentSeconds);
+				printMessage = printMessage .. format("Collected a total of %d mail within %d seconds.", mailOpened, timeSpentSeconds) .. " ";
 			end
 		else
-			printMessage = printMessage .. format("Collected a total of %d mail. ", mailOpened);
+			printMessage = printMessage .. format(L["Collected a total of %d mail."], mailOpened) .. " ";
 		end
 	elseif timeSpent and timeSpent > 0 then
 		local timeSpentMinutes = floor( timeSpent / 60 );
 		local timeSpentSeconds = ( timeSpent % 60 );
 		if timeSpentMinutes ~= 0 then
-			printMessage = printMessage .. format("Spent %d minutes and %d seconds collecting mail. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
+			printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " ";
 		else
-			printMessage = printMessage .. format("Spent %d seconds collecting mail. ", mailOpened, timeSpentSeconds);
+			printMessage = printMessage .. format(L["Spent %d seconds collecting mail."], mailOpened, timeSpentSeconds) .. " ";
 		end
 	end
 	
 	-- Did we record any items or gold being looted?
 	if (itemsGained and itemsGained > 0) and (earned and earned > 0) then
-		printMessage = printMessage .. format("You gained %d items and %s from this.", itemsGained, MailOpener:FormatMoney(earned));
+		printMessage = printMessage .. format(L["You gained %d items and %s from this."], itemsGained, MailOpener:FormatMoney(earned));
 	elseif itemsGained and itemsGained > 0 then
-		printMessage = printMessage .. format("You gained %d items from this.", itemsGained);
+		printMessage = printMessage .. format(L["You gained %d items from this."], itemsGained);
 	elseif earned and earned > 0 then
-		printMessage = printMessage .. format("You gained %s from this.", MailOpener:FormatMoney(earned));
+		printMessage = printMessage .. format(L["You gained %s from this."], MailOpener:FormatMoney(earned));
 	end
 	
 	-- Did we record anything? print that!
 	if printMessage ~= "" then
-		print("|cff15ff00Mail Opener|r: " .. printMessage);
+		MailOpener:Print(printMessage);
 	end
 	
 	if self.db.profile.sessionSummary and ((sessionMailOpened and (not mailOpened or sessionMailOpened > mailOpened)) or (sessionTimeSpent and (not timeSpent or sessionTimeSpent > timeSpent)) or (sessionEarned and (not earned or sessionEarned > earned)) or (sessionItemsgained and (not itemsGained or sessionItemsgained > itemsGained))) then
 		-- Message buffer, append details we have data for
-		printMessage = "|cff15ff00Mail Opener|r: (Session summary) ";
+		printMessage = "(Session summary)" .. " ";
 	
 		-- Did we record any mail being opened?
 		if sessionMailOpened and sessionMailOpened > 0 then
@@ -281,35 +281,35 @@
 				local timeSpentMinutes = floor( sessionTimeSpent / 60 );
 				local timeSpentSeconds = ( sessionTimeSpent % 60 );
 				if timeSpentMinutes ~= 0 then
-					printMessage = printMessage .. format("Collected a total of %d mail within %d minutes and %d seconds this session. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
+					printMessage = printMessage .. format(L["Collected a total of %d mail within %d minutes and %d seconds this session."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " ";
 				else
-					printMessage = printMessage .. format("Collected a total of %d mail within %d seconds this session. ", mailOpened, timeSpentSeconds);
+					printMessage = printMessage .. format(L["Collected a total of %d mail within %d seconds this session."], mailOpened, timeSpentSeconds) .. " ";
 				end
 			else
-				printMessage = printMessage .. format("Collected a total of %d mail this session. ", sessionMailOpened);
+				printMessage = printMessage .. format(L["Collected a total of %d mail this session."], sessionMailOpened) .. " ";
 			end
 		elseif sessionTimeSpent then
 			local timeSpentMinutes = floor( sessionTimeSpent / 60 );
 			local timeSpentSeconds = ( sessionTimeSpent % 60 );
 			if timeSpentMinutes ~= 0 then
-				printMessage = printMessage .. format("Spent %d minutes and %d seconds collecting mail this session. ", mailOpened, timeSpentMinutes, timeSpentSeconds);
+				printMessage = printMessage .. format(L["Spent %d minutes and %d seconds collecting mail this session."], mailOpened, timeSpentMinutes, timeSpentSeconds) .. " ";
 			else
-				printMessage = printMessage .. format("Spent %d seconds collecting mail this session. ", mailOpened, timeSpentSeconds);
+				printMessage = printMessage .. format(L["Spent %d seconds collecting mail this session."], mailOpened, timeSpentSeconds) .. " ";
 			end
 		end
 		
 		-- Did we record any items or gold being looted?
 		if (sessionItemsgained and sessionItemsgained > 0) and (sessionEarned and sessionEarned > 0) then
-			printMessage = printMessage .. format("You gained %d items and %s from this.", sessionItemsgained, MailOpener:FormatMoney(sessionEarned));
+			printMessage = printMessage .. format(L["You gained %d items and %s from this."], sessionItemsgained, MailOpener:FormatMoney(sessionEarned));
 		elseif sessionItemsgained and sessionItemsgained > 0 then
-			printMessage = printMessage .. format("You gained %d items from this.", sessionItemsgained);
+			printMessage = printMessage .. format(L["You gained %d items from this."], sessionItemsgained);
 		elseif sessionEarned and sessionEarned > 0 then
-			printMessage = printMessage .. format("You gained %s from this.", MailOpener:FormatMoney(sessionEarned));
+			printMessage = printMessage .. format(L["You gained %s from this."], MailOpener:FormatMoney(sessionEarned));
 		end
 	
 		-- Did we record anything? print that!
 		if printMessage ~= "" then
-			print(printMessage);
+			MailOpener:Print(printMessage);
 		end
 	end
 end
@@ -327,25 +327,25 @@
 	local configGroup = {
 		order = 0,
 		type = "modulesSubGroup",
-		name = "Collected",
-		desc = "Change settings for the collected module.",
+		name = L["Collected"],
+		desc = L["Change settings for the collected module."],
 		args = {
 			General = {
 				order = 10,
 				type = "group",
 				inline = true,
-				name = "General",
+				name = L["General"],
 				args = {
 					description = {
 						order = 10,
 						type = "description",
 						name = function()
-							local descText = "With this button you can completely toggle this module |cff00ff00on|r or |cffff0000off|r. This setting will be remembered and the module will be automatically toggled |cff00ff00on|r or |cffff0000off|r upon logon as it was last set.\n\n";
+							local descText = L["With this button you can completely toggle this module |cff00ff00on|r or |cffff0000off|r. This setting will be remembered and the module will be automatically toggled |cff00ff00on|r or |cffff0000off|r upon logon as it was last set."] .. "\n\n";
 							
 							if self:IsEnabled() then
-								descText = descText .. "Status: |cff00ff00Enabled|r";
+								descText = descText .. L["Status: %s"]:format(L["|cff00ff00Enabled|r"]);
 							else
-								descText = descText .. "Status: |cffff0000Disabled|r";
+								descText = descText .. L["Status: %s"]:format(L["|cffff0000Disabled|r"]);
 							end
 							
 							return descText;
@@ -356,12 +356,12 @@
 						type = "execute",
 						name = function()
 							if self:IsEnabled() then
-								return "Disable Module";
+								return L["Disable Module"];
 							else
-								return "Enable Module";
+								return L["Enable Module"];
 							end
 						end,
-						desc = "Click here to completely toggle this module on or off.",
+						desc = L["Click here to completely toggle this module on or off."],
 						width = "double",
 						func = function()
 							if self:IsEnabled() then
@@ -381,12 +381,12 @@
 				order = 20,
 				type = "group",
 				inline = true,
-				name = "Track Stats",
+				name = L["Track Stats"],
 				args = {
 					description = {
 						order = 10,
 						type = "description",
-						name = "You can select what things to track. Toggling something off will stop tracking of it completely and reduce the resources used by Mail Opener (although you shouldn't notice a difference).",
+						name = L["You can select what things to track. Toggling something off will stop tracking of it completely and reduce the resources used by Mail Opener (although you shouldn't notice a difference)."],
 					},
 					AHHeader = {
 						order = 15,
@@ -396,8 +396,8 @@
 					trackGold = {
 						order = 20,
 						type = "toggle",
-						name = "Track |cfffed000gold gained|r",
-						desc = "Track the amount of gold gained and display it when closing the mailbox.",
+						name = L["Track |cfffed000gold gained|r"],
+						desc = L["Track the amount of gold gained and display it when closing the mailbox."],
 						set = function(i, v)
 							self.db.profile.trackGold = v;
 							
@@ -410,8 +410,8 @@
 					trackItems = {
 						order = 30,
 						type = "toggle",
-						name = "Track |cfffed000items gained|r",
-						desc = "Track the amount of items gained and display it when closing the mailbox.",
+						name = L["Track |cfffed000items gained|r"],
+						desc = L["Track the amount of items gained and display it when closing the mailbox."],
 						set = function(i, v)
 							self.db.profile.trackItems = v;
 							
@@ -424,8 +424,8 @@
 					trackMail = {
 						order = 40,
 						type = "toggle",
-						name = "Track |cfffed000mail opened|r",
-						desc = "Track the amount of mail received and display it when closing the mailbox.",
+						name = L["Track |cfffed000mail opened|r"],
+						desc = L["Track the amount of mail received and display it when closing the mailbox."],
 						set = function(i, v)
 							self.db.profile.trackMail = v;
 							
@@ -438,8 +438,8 @@
 					trackTimeSpent = {
 						order = 50,
 						type = "toggle",
-						name = "Track |cfffed000time spent|r",
-						desc = "Track the amount of time spent at the mailbox.",
+						name = L["Track |cfffed000time spent|r"],
+						desc = L["Track the amount of time spent at the mailbox."],
 						set = function(i, v)
 							self.db.profile.trackTimeSpent = v;
 							
@@ -455,13 +455,13 @@
 				order = 30,
 				type = "group",
 				inline = true,
-				name = "Summarize",
+				name = L["Summarize"],
 				args = {
 					sessionSummary = {
 						order = 20,
 						type = "toggle",
-						name = "Also show a summary of the recorded stats within the entire session",
-						desc = "Also show a summary of the recorded stats within the entire session (since your last login or /reload).",
+						name = L["Also show a summary of the recorded stats within the entire session"],
+						desc = L["Also show a summary of the recorded stats within the entire session (since your last login or /reload)."],
 						set = function(i, v)
 							self.db.profile.sessionSummary = v;
 							
@@ -475,8 +475,8 @@
 					batchSummary = {
 						order = 30,
 						type = "toggle",
-						name = "Show a summary of the recorded stats whenever it updated after opening the current batch has finished",
-						desc = "Show a summary of the recorded stats whenever it has been updated after opening the current batch of mails has finished.",
+						name = L["Show a summary of the recorded stats whenever it updated after opening the current batch has finished"],
+						desc = L["Show a summary of the recorded stats whenever it has been updated after opening the current batch of mails has finished."],
 						set = function(i, v)
 							self.db.profile.batchSummary = v;