changeset 6:dffc0e7049ad

Initial localization pass.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 18 Feb 2011 09:53:40 +0000
parents cf777d095730
children baf66f6dd093
files .pkgmeta AUTHOR_WARNING.txt GuildDelta.toc gd.lua locale-deDE.lua locale-enUS.lua locale-esES.lua locale-esMX.lua locale-frFR.lua locale-koKR.lua locale-ruRU.lua locale-zhCN.lua locale-zhTW.lua
diffstat 13 files changed, 146 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/.pkgmeta	Tue Dec 14 15:18:46 2010 +0000
+++ b/.pkgmeta	Fri Feb 18 09:53:40 2011 +0000
@@ -13,7 +13,12 @@
     url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
   libs/AceConsole-3.0:
     url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConsole-3.0
+  libs/AceLocale-3.0:
+    url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
   libs/AceGUI-3.0:
     url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
 
+ignore:
+  - AUTHOR_WARNING.txt
+
 # vim: et
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AUTHOR_WARNING.txt	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,3 @@
+
+Do not run the locale scraper on this project!
+
--- a/GuildDelta.toc	Tue Dec 14 15:18:46 2010 +0000
+++ b/GuildDelta.toc	Fri Feb 18 09:53:40 2011 +0000
@@ -10,9 +10,20 @@
 libs\LibStub\LibStub.lua
 libs\CallbackHandler-1.0\CallbackHandler-1.0.xml
 libs\AceAddon-3.0\AceAddon-3.0.xml
+libs\AceLocale-3.0\AceLocale-3.0.xml
 libs\AceConsole-3.0\AceConsole-3.0.xml
 libs\AceGUI-3.0\AceGUI-3.0.xml
 libs\AceConfig-3.0\AceConfig-3.0.xml
 #@end-no-lib-strip@
 
+locale-enUS.lua
+locale-deDE.lua
+locale-esES.lua
+locale-esMX.lua
+locale-frFR.lua
+locale-koKR.lua
+locale-ruRU.lua
+locale-zhCN.lua
+locale-zhTW.lua
+
 gd.lua
--- a/gd.lua	Tue Dec 14 15:18:46 2010 +0000
+++ b/gd.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -1,31 +1,13 @@
-
-local addon = CreateFrame("Frame") --select(2,...)
+local nametag = ...
+local addon = CreateFrame("Frame")
+local L = LibStub("AceLocale-3.0"):GetLocale(nametag)
 local SV
 
 local DEFAULT_CHAT = 2   -- combat log (no constant predefined for that)
 
---if GetLocale() == "enUS" then
-addon.l10n= {
-	["LEFT"] = "Players who have left the guild:  ",
-	["JOINED"] = "Players who have joined the guild:  ",
-	["RANK"] = "Players whose rank has changed:",
-	["LEVEL"] = "Players whose level has changed:",
-	["NOTES"] = "Players whose notes have changed:",
-
-	["Oabbrev"] = "O",       -- abbreviation for "Officer", specifically the non-public note
-	["FIELD_rank"] = "Rank",
-	["FIELD_level"] = "Level",
-	["FIELD_notes"] = "Player/Officer notes",
-
-	["NOCHANGE"] = "No changes to tracked fields have been detected.",
-
-	-- Something needs to be done about the walls of description text below.
-}
---elseif .... end
-
 local guild_selection, log_ever_shown
 addon.options = {
-	name = "Guild Delta",
+	--name = filled in during OnInit
 	type = 'group',
 	childGroups = 'tab',
 	handler = addon,    -- functions listed as strings called as addon:func
@@ -46,14 +28,14 @@
 			order = 2,
 		},
 		general = {
-			name = "General",
-			desc = "Tracking options",
+			name = GENERAL,
+			desc = L["Tracking options"],
 			type = 'group',
 			order = 10,
 			args = {
 				fields = {
-					name = "Fields",
-					desc = "Track changes to these player fields",
+					name = L["Attributes"],
+					desc = L["Track changes to these player attributes"],
 					type = 'multiselect',
 					order = 10,
 					-- these need to be of function type rather than string keys of members
@@ -62,15 +44,15 @@
 					set = function(info,x,val) SV.fields[x] = val end,
 				},
 				nochange = {
-					name = "No Change",
-					desc = "Print a message even when no changes are detected",
+					name = L"No Change"],
+					desc = L["Print a message even when no changes are detected"],
 					type = 'toggle',
 					order = 15,
 					get = function() return not not SV.notify_nochange end,
 					set = function(info,val) SV.notify_nochange = val end,
 				},
 				color = {
-					name = "Output text color",
+					name = L["Color of output text"],
 					type = 'color',
 					order = 17,
 					get = function() return SV.red, SV.green, SV.blue, 1 end,
@@ -84,8 +66,8 @@
 					order = 19,
 				},
 				guilds = {
-					name = "Guilds",
-					desc = "Guilds for which a roster is known",
+					name = L["Guilds"],
+					desc = L["Guilds for which a roster is known"],
 					type = 'select',
 					order = 20,
 					width = 'double',
@@ -94,8 +76,8 @@
 					set = function(info,val) guild_selection = val end,
 				},
 				clearguild = {
-					name = "Reset Guild",
-					desc = "Erase stored data for selected guild; information will be scanned from scratch on next login.",
+					name = L["Reset Guild"],
+					desc = L"Erase stored data for selected guild; information will be scanned from scratch on next login."],
 					type = 'execute',
 					order = 22,
 					disabled = function() return not guild_selection end,
@@ -106,21 +88,21 @@
 						if m then
 							m[g] = nil
 						else
-							addon:Print("Hm, error.", r, "can't be matched as a realm name.  Please report this as a bug, including the name of the realm and guild.")
+							addon:Printf(L["Error:  %s cannot be matched as a realm name.  Please report this as a bug, including the name of the realm and guild."], r)
 						end
 					end,
 				},
 			},
 		},
 		output = {
-			name = "Output",
-			desc = "What and where to print",
+			name = L["Output"],
+			desc = L["What and where to print"],
 			type = 'group',
 			order = 20,
 			args = {
 				reset = {
-					name = "Reset Output",
-					desc = "Restores default output settings",
+					name = L["Reset Output"],
+					desc = L["Restores default output settings"],
 					type = 'execute',
 					order = 10,
 					func = "SetChat",
@@ -134,15 +116,15 @@
 					order = 11,
 				},
 				print_chatframes = {
-					name = "Print Chatframe Numbers",
-					desc = "Print each chat window number in its frame, for easy reference in the next slider option",
+					name = L["Print Chatframe Numbers"],
+					desc = L["Print each chat window number in its frame, for easy reference in the next slider option"],
 					type = 'execute',
 					--func = print_chatframes filled in below
 					order = 20,
 				},
 				chatframe_num = {
-					name = "Output Chatframe",
-					desc = "Which chat window to prefer for printing all the output during login",
+					name = L["Output Chatframe"],
+					desc = L["Which chat window to prefer for printing all the output during login"],
 					type = 'range',
 					min  = 1,
 					max  = NUM_CHAT_WINDOWS,
@@ -152,8 +134,8 @@
 					order = 25,
 				},
 				chatframe_name = {
-					name = "Chatframe Override",
-					desc = "<Advanced>  If blank, uses the numerical slider.  If set, it is the NAME of a frame with AddMessage capability to use for output.",
+					name = L["Chatframe Override"],
+					desc = L["<Advanced>  If blank, uses the numerical slider.  If set, it is the NAME of a frame with AddMessage capability to use for output."],
 					type = 'input',
 					get = function()
 						return type(SV.chatframe) == 'string' and SV.chatframe or nil
@@ -164,8 +146,8 @@
 			},
 		},
 		persist = {
-			name = "Logging",
-			desc = "Storing changes for later review",
+			name = L["Logging"],
+			desc = L["Storing changes for later review"],
 			type = 'group',
 			order = 30,
 			args = {
@@ -177,8 +159,8 @@
 					order = 10,
 				},
 				enable = {
-					name = "Enable Logging",
-					desc = [[Accumulate all deltas, including a timestamp.  |cffFF0000WARNING|r: if logging was enabled and you turn it off, the log itself will not be saved when exiting the game.]],
+					name = L["Enable Logging"],
+					desc = L["Accumulate all deltas, including a timestamp.  |cffFF0000WARNING|r: if logging was enabled and you turn it off, the log itself will not be saved when exiting the game."],
 					type = 'toggle',
 					order = 15,
 					get = function() return SV.logging end,
@@ -188,8 +170,8 @@
 					end,
 				},
 				clearlog = {
-					name = "Reset Log",
-					desc = "Erase accumulated deltas.",
+					name = L["Reset Log"],
+					desc = L["Erase accumulated deltas"],
 					type = 'execute',
 					order = 20,
 					hidden = function() return not (SV.logging or log_ever_shown) end,
@@ -199,8 +181,8 @@
 					end,
 				},
 				log = {
-					name = "Log",
-					desc = "If you make changes, don't forget to click 'Accept' to save them.  Scroll down if needed.",
+					name = L["Log"],
+					desc = L["If you make changes, don't forget to click 'Accept' to save them.  Scroll down if needed."],
 					type = 'input',
 					order = 25,
 					multiline = 15,
@@ -255,10 +237,11 @@
 	for i = 1, NUM_CHAT_WINDOWS do
 		local cf = _G['ChatFrame'..i]
 		if not cf then break end
-		addon:Print(cf, "This is frame number", i)
+		addon:Printf(cf, L["This is frame number %d."], i)
 	end
 end
 
+-- Localize these?
 addon.options.args.note.name = 
 "You can use the '/guilddelta' command to open the options window.\n\n"..
 "The guild roster has already been scanned by the time you see this.  Therefore, "..
@@ -277,7 +260,7 @@
 
 
 -----------------------------------------------------------------------------
-addon = LibStub("AceAddon-3.0"):NewAddon(addon, "GuildDelta",
+addon = LibStub("AceAddon-3.0"):NewAddon(addon, nametag,
                 "AceConsole-3.0")
 
 function addon:OnInitialize()
@@ -313,7 +296,7 @@
 -- Remove everything.
 function addon:unload()
 	self:cleanup()
-	LibStub("AceAddon-3.0").addons["GuildDelta"] = nil
+	LibStub("AceAddon-3.0").addons[nametag] = nil
 	addon = nil;
 	-- put the userdata back so it counts as a Frame object again
 	local ud = self[0]
@@ -331,9 +314,9 @@
 	self:SetScript("OnEvent", self.GuildUpdate)
 
 	self.options.args.version.name =
-		"|cff30adffVersion " .. (GetAddOnMetadata("GuildDelta", "Version") or "?") .. "|r"
-	LibStub("AceConfig-3.0"):RegisterOptionsTable("GuildDelta", self.options)
-	--[[self.optionsFrame =]] LibStub("AceConfigDialog-3.0"):AddToBlizOptions("GuildDelta", "Guild Delta")
+		"|cff30adffVersion " .. (GetAddOnMetadata(nametag, "Version") or "?") .. "|r"
+	LibStub("AceConfig-3.0"):RegisterOptionsTable(nametag, self.options)
+	--[[self.optionsFrame =]] LibStub("AceConfigDialog-3.0"):AddToBlizOptions(nametag, "Guild Delta")
 	self:RegisterChatCommand("guilddelta", "OnChatCommand")
 	self:SetChat(self)
 	log_ever_shown = SV.logging
@@ -343,9 +326,9 @@
 
 function addon:OnChatCommand (input)
 	if not input or input:trim() == "" then
-		LibStub("AceConfigDialog-3.0"):Open("GuildDelta")
+		LibStub("AceConfigDialog-3.0"):Open(nametag)
 	else
-		LibStub("AceConfigCmd-3.0").HandleCommand(self, "guilddelta", "GuildDelta", input)
+		LibStub("AceConfigCmd-3.0").HandleCommand(self, "guilddelta", nametag, input)
 	end
 end
 
@@ -383,12 +366,12 @@
 	if type(nframe) == 'table' and type(nframe.AddMessage) == 'function' then
 		if not isauto then
 			SV.chatframe = n
-			self:Print("Now printing to chat frame", n,
+			self:Print(L["Now printing to chat frame"], n,
 				(type(nframe.name)=='string' and ("(".. nframe.name .. ")") or ""))
 		end
 		chatframe = nframe
 	else
-		self:Printf("EEEEEEEK!  '%s' was not a valid chat frame number/name, no change has been made.", n)
+		self:Printf(L["'%s' was not a valid chat frame number/name, no change has been made."], n)
 	end
 end
 
@@ -414,13 +397,12 @@
 	self.GuildUpdate = nil
 
 	if SV.logtext and #SV.logtext > 20000 then
-		self:Print("Your accumulated logfile has grown rather large; you should consider copying it out and clearing it.")
+		self:Print(L["Your accumulated logfile has grown rather large; you should consider copying it out and clearing it."])
 	end
 
 	local guild = assert((GetGuildInfo("player")), "GetGuildInfo returns nil?")
 	local realm = assert(GetRealmName(), "GetRealmName returns nil?")
 	local members = SV.members
-	local l10n = self.l10n
 	if members[realm] 
 	   and members[realm][guild]
 	   and #(members[realm][guild]) > 0
@@ -428,7 +410,7 @@
 		-- moved the normal case below
 	else
 		-- new user, or new guild, or any number of things
-		self:Print("GuildDelta initializing roster...")
+		self:Print(L["GuildDelta initializing roster..."])
 		members[realm] = members[realm] or {}
 		members[realm][guild] = self:current_guild_info(current_n)
 		return self:cleanup()
@@ -439,7 +421,7 @@
 	local function tins (t, x)
 		local s = x.name
 		if x.onote and (x.onote ~= "") then
-			s = s .. "(" .. l10n.Oabbrev .. ": " .. x.onote .. ")"
+			s = s .. "(" .. L["Oabbrev"] .. ": " .. x.onote .. ")"
 		end
 		if x.pnote and (x.pnote ~= "") then
 			s = s .. "(" .. x.pnote .. ")"
@@ -473,7 +455,7 @@
 				tinsert(notes, {C.name, C.pnote})
 			end
 			if C.onote and (P.onote ~= C.onote) then
-				tinsert(notes, {C.name, "["..l10n.Oabbrev.."]: "..C.onote})
+				tinsert(notes, {C.name, "["..L["Oabbrev"].."]: "..C.onote})
 			end
 
 		elseif P.name < C.name then
@@ -501,19 +483,19 @@
 	local m, changes
 	if #left > 0 then
 		changes = true
-		m = l10n.LEFT .. table.concat(left, ", ")
+		m = L["LEFT"] .. table.concat(left, ", ")
 		cprt(m)
 	end
 
 	if #joined > 0 then
 		changes = true
-		m = l10n.JOINED .. table.concat(joined, ", ")
+		m = L["JOINED"] .. table.concat(joined, ", ")
 		cprt(m)
 	end
 
 	if #rank > 0 then
 		changes = true
-		cprt(l10n.RANK)
+		cprt(L["RANK"])
 		for i = 1, #rank do
 			cprt(rank[i][1]..':  '..rank[i][2])
 		end
@@ -521,7 +503,7 @@
 
 	if #level > 0 then
 		changes = true
-		cprt(l10n.LEVEL)
+		cprt(L["LEVEL"])
 		for i = 1, #level do
 			cprt(level[i][1]..':  '..level[i][2])
 		end
@@ -529,14 +511,14 @@
 
 	if #notes > 0 then
 		changes = true
-		cprt(l10n.NOTES)
+		cprt(L["NOTES"])
 		for i = 1, #notes do
 			cprt(notes[i][1]..': "'..notes[i][2]..'"')
 		end
 	end
 
 	if SV.logging then self:FinishLog(guild,realm) end
-	if SV.notify_nochange and (not changes) then cprt(l10n.NOCHANGE) end
+	if SV.notify_nochange and (not changes) then cprt(L["NOCHANGE"]) end
 	members[realm][guild] = current
 	self:cleanup()
 end
@@ -546,7 +528,7 @@
 	if not fieldlist then
 		fieldlist = {}
 		for name in pairs(SV.fields) do
-			fieldlist[name] = self.l10n["FIELD_"..name]
+			fieldlist[name] = L["FIELD_"..name]
 		end
 	end
 	return fieldlist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-deDE.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "deDE")
+if not L then return end
+
+--@localization(locale="deDE", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-enUS.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,7 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "enUS", --[[default=]]true, --[[silent=]]true)
+
+--@localization(locale="enUS", format="lua_additive_table", same-key-is-true=true)@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-esES.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "esES")
+if not L then return end
+
+--@localization(locale="esES", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-esMX.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "esMX")
+if not L then return end
+
+--@localization(locale="esMX", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-frFR.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "frFR")
+if not L then return end
+
+--@localization(locale="frFR", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-koKR.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "koKR")
+if not L then return end
+
+--@localization(locale="koKR", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-ruRU.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "ruRU")
+if not L then return end
+
+--@localization(locale="ruRU", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-zhCN.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "zhCN")
+if not L then return end
+
+--@localization(locale="zhCN", format="lua_additive_table", handle-unlocalized="comment")@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locale-zhTW.lua	Fri Feb 18 09:53:40 2011 +0000
@@ -0,0 +1,8 @@
+-- Guild Delta Locale
+-- Please use the Localization App on WoWAce to Update this
+-- http://www.wowace.com/addons/guild-delta/localization/
+local nametag = ...
+local L = LibStub("AceLocale-3.0"):NewLocale(nametag, "zhTW")
+if not L then return end
+
+--@localization(locale="zhTW", format="lua_additive_table", handle-unlocalized="comment")@