Quantcast

-Completely redid the localization. The localization is now using metatables.

Xruptor [07-26-10 - 14:23]
-Completely redid the localization.  The localization is now using metatables.
-Reworked some code here and there.
-Fixed an issue with the toggles where it wouldn't immediately take effect.
-Added a new option, /bgs guild  - this will toggle guild display on tooltips.
Filename
BagSync.lua
BagSync.toc
BagSync_Profiles.lua
BagSync_Search.lua
BagSync_Tokens.lua
localization/localization.lua
diff --git a/BagSync.lua b/BagSync.lua
index 28927ec..129a5e6 100644
--- a/BagSync.lua
+++ b/BagSync.lua
@@ -17,6 +17,7 @@

 --]]

+local L = BAGSYNC_L
 local lastItem
 local lastDisplayed = {}
 local currentPlayer = UnitName('player')
@@ -50,9 +51,9 @@ if IsLoggedIn() then BagSync:PLAYER_LOGIN() else BagSync:RegisterEvent('PLAYER_L
 function BagSync:PLAYER_LOGIN()

 	 BINDING_HEADER_BAGSYNC = "BagSync"
-	 BINDING_NAME_BAGSYNCTOGGLESEARCH = BAGSYNC_BINDING_SEARCH
-	 BINDING_NAME_BAGSYNCTOGGLETOKENS = BAGSYNC_BINDING_TOKEN
-	 BINDING_NAME_BAGSYNCTOGGLEPROFILES = BAGSYNC_BINDING_PROFILES
+	 BINDING_NAME_BAGSYNCTOGGLESEARCH = L["Toggle Search"]
+	 BINDING_NAME_BAGSYNCTOGGLETOKENS = L["Toggle Tokens"]
+	 BINDING_NAME_BAGSYNCTOGGLEPROFILES = L["Toggle Profiles"]

 	local ver = GetAddOnMetadata("BagSync","Version") or 0

@@ -113,58 +114,75 @@ function BagSync:PLAYER_LOGIN()
 		local a,b,c=strfind(msg, "(%S+)"); --contiguous string of non-space characters

 		if a then
-			if c and c:lower() == BAGSYNC_SLASH_CMD2 then
+			if c and c:lower() == L["search"] then
 				if BagSync_SearchFrame:IsVisible() then
 					BagSync_SearchFrame:Hide()
 				else
 					BagSync_SearchFrame:Show()
 				end
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD3 then
+			elseif c and c:lower() == L["gold"] then
 				self:ShowMoneyTooltip()
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD4 then
+			elseif c and c:lower() == L["tokens"] then
 				if BagSync_TokensFrame:IsVisible() then
 					BagSync_TokensFrame:Hide()
 				else
 					BagSync_TokensFrame:Show()
 				end
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD5 then
+			elseif c and c:lower() == L["profiles"] then
 				if BagSync_ProfilesFrame:IsVisible() then
 					BagSync_ProfilesFrame:Hide()
 				else
 					BagSync_ProfilesFrame:Show()
 				end
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD6 then
+			elseif c and c:lower() == L["fixdb"] then
 				self:FixDB_Data()
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD7 then
+			elseif c and c:lower() == L["total"] then
+				lastDisplayed = {}
+				lastItem = nil
 				if BagSyncOpt.showTotal then
 					BagSyncOpt.showTotal = false
-					print("|cFFFF0000BagSync: "..BAGSYNC_SEARCH_TOTAL.." "..BAGSYNC_SWITCH_OFF)
+					print("|cFFFF0000BagSync: "..L["Total:"].." "..L["OFF"])
 				else
 					BagSyncOpt.showTotal = true
-					print("|cFFFF0000BagSync: "..BAGSYNC_SEARCH_TOTAL.." "..BAGSYNC_SWITCH_ON)
+					print("|cFFFF0000BagSync: "..L["Total:"].." "..L["ON"])
 				end
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD8 then
+			elseif c and c:lower() == L["guildname"] then
+				lastDisplayed = {}
+				lastItem = nil
 				if BagSyncOpt.showGuildNames then
 					BagSyncOpt.showGuildNames = false
-					print("|cFFFF0000BagSync: "..BAGSYNC_SLASH_CMD8.." "..BAGSYNC_SWITCH_OFF)
+					print("|cFFFF0000BagSync: "..L["guildname"]..": "..L["OFF"])
 				else
 					BagSyncOpt.showGuildNames = true
-					print("|cFFFF0000BagSync: "..BAGSYNC_SLASH_CMD8.." "..BAGSYNC_SWITCH_ON)
+					print("|cFFFF0000BagSync: "..L["guildname"]..": "..L["ON"])
 				end
 				return true
-			elseif c and c:lower() == BAGSYNC_SLASH_CMD9 then
+			elseif c and c:lower() == L["throttle"] then
+				lastDisplayed = {}
+				lastItem = nil
 				if BagSyncOpt.enableThrottle then
 					BagSyncOpt.enableThrottle = false
-					print("|cFFFF0000BagSync: "..BAGSYNC_SLASH_CMD9.." "..BAGSYNC_SWITCH_OFF)
+					print("|cFFFF0000BagSync: "..L["throttle"]..": "..L["OFF"])
 				else
 					BagSyncOpt.enableThrottle = true
-					print("|cFFFF0000BagSync: "..BAGSYNC_SLASH_CMD9.." "..BAGSYNC_SWITCH_ON)
+					print("|cFFFF0000BagSync: "..L["throttle"]..": "..L["ON"])
+				end
+				return true
+			elseif c and c:lower() == L["guild"] then
+				lastDisplayed = {}
+				lastItem = nil
+				if BagSyncOpt.enableGuild then
+					BagSyncOpt.enableGuild = false
+					print("|cFFFF0000BagSync: "..L["guild"]..": "..L["OFF"])
+				else
+					BagSyncOpt.enableGuild = true
+					print("|cFFFF0000BagSync: "..L["guild"]..": "..L["ON"])
 				end
 				return true
 			elseif c and c:lower() ~= "" then
@@ -179,16 +197,24 @@ function BagSync:PLAYER_LOGIN()
 		end

 		DEFAULT_CHAT_FRAME:AddMessage("BAGSYNC")
-		for i=1, 9 do
-			DEFAULT_CHAT_FRAME:AddMessage(_G["BAGSYNC_SLASH"..i])
-		end
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs [itemname] - Does a quick search for an item"])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs search - Opens the search window"])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs gold - Displays a tooltip with the amount of gold on each character."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs tokens - Opens the tokens/currency window."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs profiles - Opens the profiles window."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs fixdb - Runs the database fix (FixDB) on BagSync."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs total - Toggles the [Total] display in tooltips and gold display."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs guildname - Toggles the [Guild Name] display in tooltips."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs throttle - Toggles the throttle when displaying tooltips. (ON = Prevents Lag)."])
+		DEFAULT_CHAT_FRAME:AddMessage(L["/bgs guild - Toggles the displaying of guild information."])
+
 	end

-	DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33BagSync|r [v|cFFDF2B2B"..ver.."|r] loaded:   /bgs, /bagsync")
+	DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33BagSync|r [v|cFFDF2B2B"..ver.."|r]   /bgs, /bagsync")

 	--we deleted someone with the Profile Window, display name of user deleted
 	if BagSyncOpt.delName then
-		print("|cFFFF0000BagSync: "..BAGSYNC_PROFILES.." "..BAGSYNC_PROFILES_DELETE.." ["..BagSyncOpt.delName.."]!|r")
+		print("|cFFFF0000BagSync: "..L["Profiles"].." "..L["Delete"].." ["..BagSyncOpt.delName.."]!|r")
 		BagSyncOpt.delName = nil
 	end

@@ -281,6 +307,7 @@ function BagSync:StartupDB()
 	if BagSyncOpt.showTotal == nil then BagSyncOpt.showTotal = true end
 	if BagSyncOpt.showGuildNames == nil then BagSyncOpt.showGuildNames = false end
 	if BagSyncOpt.enableThrottle == nil then BagSyncOpt.enableThrottle = true end
+	if BagSyncOpt.enableGuild == nil then BagSyncOpt.enableGuild = true end

 	BagSyncGUILD_DB = BagSyncGUILD_DB or {}
 	BagSyncGUILD_DB[currentRealm] = BagSyncGUILD_DB[currentRealm] or {}
@@ -389,7 +416,7 @@ function BagSync:FixDB_Data()
 		end
 	end

-	DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33BagSync:|r |cFFFF9900"..BAGSYNC_DATABASE_FIX_ALERT.."|r")
+	DEFAULT_CHAT_FRAME:AddMessage("|cFF99CC33BagSync:|r |cFFFF9900"..L["A FixDB has been performed on BagSync!  The database is now optimized!"].."|r")
 end

 ----------------------
@@ -724,7 +751,7 @@ function BagSync:ShowMoneyTooltip()
 	end
 	if BagSyncOpt.showTotal and gldTotal > 0 then
 		tooltip:AddLine(" ")
-		tooltip:AddDoubleLine(format(TTL_C, BAGSYNC_SEARCH_TOTAL), self:buildMoneyString(gldTotal, false), 1, 1, 1, 1, 1, 1)
+		tooltip:AddDoubleLine(format(TTL_C, L["Total:"]), self:buildMoneyString(gldTotal, false), 1, 1, 1, 1, 1, 1)
 	end

 	tooltip:AddLine(" ")
@@ -888,11 +915,11 @@ local function CountsToInfoString(invCount, bankCount, equipCount, guildCount, m
 	local total = invCount + bankCount + equipCount + guildCount + mailboxCount

 	if invCount > 0 then
-		info = BAGSYNC_NUM_BAGS:format(invCount)
+		info = L["Bags: %d"]:format(invCount)
 	end

 	if bankCount > 0 then
-		local count = BAGSYNC_NUM_BANK:format(bankCount)
+		local count = L["Bank: %d"]:format(bankCount)
 		if info then
 			info = strjoin(', ', info, count)
 		else
@@ -901,7 +928,7 @@ local function CountsToInfoString(invCount, bankCount, equipCount, guildCount, m
 	end

 	if equipCount > 0 then
-		local count = BAGSYNC_EQUIPPED:format(equipCount)
+		local count = L["Equipped: %d"]:format(equipCount)
 		if info then
 			info = strjoin(', ', info, count)
 		else
@@ -909,8 +936,8 @@ local function CountsToInfoString(invCount, bankCount, equipCount, guildCount, m
 		end
 	end

-	if guildCount > 0 and not BagSyncOpt.showGuildNames then
-		local count = BAGSYNC_NUM_GUILDBANK:format(guildCount)
+	if guildCount > 0 and BagSyncOpt.enableGuild and not BagSyncOpt.showGuildNames then
+		local count = L["Guild: %d"]:format(guildCount)
 		if info then
 			info = strjoin(', ', info, count)
 		else
@@ -919,7 +946,7 @@ local function CountsToInfoString(invCount, bankCount, equipCount, guildCount, m
 	end

 	if mailboxCount > 0 then
-		local count = BAGSYNC_NUM_MAILBOX:format(mailboxCount)
+		local count = L["Mailbox: %d"]:format(mailboxCount)
 		if info then
 			info = strjoin(', ', info, count)
 		else
@@ -1010,29 +1037,31 @@ local function AddOwners(frame, link)
 			end
 		end

-		local guildN = v.guild or nil
-
-		--check the guild bank if the character is in a guild
-		if BS_GD and guildN and BS_GD[guildN] then
-			--check to see if this guild has already been done through this run (so we don't do it multiple times)
-			if not previousGuilds[guildN] then
-				--we only really need to see this information once per guild
-				local tmpCount = 0
-				for q, r in pairs(BS_GD[guildN]) do
-					if itemLink then
-						local dblink, dbcount = strsplit(',', r)
-						if dblink and dblink == itemLink then
-							guildCount = guildCount + (dbcount or 1)
-							tmpCount = tmpCount + (dbcount or 1)
+		if BagSyncOpt.enableGuild then
+			local guildN = v.guild or nil
+
+			--check the guild bank if the character is in a guild
+			if BS_GD and guildN and BS_GD[guildN] then
+				--check to see if this guild has already been done through this run (so we don't do it multiple times)
+				if not previousGuilds[guildN] then
+					--we only really need to see this information once per guild
+					local tmpCount = 0
+					for q, r in pairs(BS_GD[guildN]) do
+						if itemLink then
+							local dblink, dbcount = strsplit(',', r)
+							if dblink and dblink == itemLink then
+								guildCount = guildCount + (dbcount or 1)
+								tmpCount = tmpCount + (dbcount or 1)
+							end
 						end
 					end
+					previousGuilds[guildN] = tmpCount
 				end
-				previousGuilds[guildN] = tmpCount
 			end
 		end

 		infoString = CountsToInfoString(invCount or 0, bankCount or 0, equipCount or 0, guildCount or 0, mailboxCount or 0)
-		grandTotal = grandTotal + ((invCount or 0) + (bankCount or 0) + (equipCount or 0) + (guildCount or 0) + (mailboxCount or 0))
+		grandTotal = grandTotal + (invCount or 0) + (bankCount or 0) + (equipCount or 0) + (guildCount or 0) + (mailboxCount or 0)

 		if infoString and infoString ~= '' then
 			frame:AddDoubleLine(format(MOSS, k), infoString)
@@ -1042,7 +1071,7 @@ local function AddOwners(frame, link)
 	end

 	--show guildnames last
-	if BagSyncOpt.showGuildNames then
+	if BagSyncOpt.enableGuild and BagSyncOpt.showGuildNames then
 		for k, v in pairsByKeys(previousGuilds) do
 			--only print stuff higher then zero
 			if v > 0 then
@@ -1055,8 +1084,8 @@ local function AddOwners(frame, link)
 	--show grand total if we have something
 	--don't show total if there is only one item
 	if BagSyncOpt.showTotal and grandTotal > 0 and getn(lastDisplayed) > 1 then
-		frame:AddDoubleLine(format(TTL_C, BAGSYNC_SEARCH_TOTAL), format(SILVER, grandTotal))
-		table.insert(lastDisplayed, format(TTL_C, BAGSYNC_SEARCH_TOTAL).."@"..format(SILVER, grandTotal))
+		frame:AddDoubleLine(format(TTL_C, L["Total:"]), format(SILVER, grandTotal))
+		table.insert(lastDisplayed, format(TTL_C, L["Total:"]).."@"..format(SILVER, grandTotal))
 	end

 	frame:Show()
diff --git a/BagSync.toc b/BagSync.toc
index fe5deb6..8325896 100644
--- a/BagSync.toc
+++ b/BagSync.toc
@@ -2,7 +2,7 @@
 ## Title: BagSync
 ## Notes: BagSync tracks your characters items and displays it within tooltips.
 ## Author: Xruptor
-## Version: 3.8.1
+## Version: 3.9
 ## SavedVariables: BagSyncDB, BagSyncOpt, BagSyncGUILD_DB, BagSyncTOKEN_DB

 localization\localization.lua
diff --git a/BagSync_Profiles.lua b/BagSync_Profiles.lua
index d883c4c..0d8c7c0 100644
--- a/BagSync_Profiles.lua
+++ b/BagSync_Profiles.lua
@@ -1,3 +1,4 @@
+local L = BAGSYNC_L
 local currentPlayer = UnitName('player')
 local currentRealm = GetRealmName()

@@ -26,7 +27,7 @@ bgProfiles:SetPoint("CENTER", UIParent, "CENTER", 0, 0)

 local addonTitle = bgProfiles:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
 addonTitle:SetPoint("CENTER", bgProfiles, "TOP", 0, -20)
-addonTitle:SetText("|cFF99CC33BagSync|r |cFFFFFFFF("..BAGSYNC_PROFILES..")|r")
+addonTitle:SetText("|cFF99CC33BagSync|r |cFFFFFFFF("..L["Profiles"]..")|r")

 local closeButton = CreateFrame("Button", nil, bgProfiles, "UIPanelCloseButton");
 closeButton:SetPoint("TOPRIGHT", bgProfiles, -15, -8);
@@ -35,14 +36,14 @@ bgProfiles.deleteButton = CreateFrame("Button", nil, bgProfiles, "UIPanelButtonT
 bgProfiles.deleteButton:SetPoint("BOTTOM", bgProfiles, "BOTTOM", -70, 20);
 bgProfiles.deleteButton:SetHeight(21);
 bgProfiles.deleteButton:SetWidth(100);
-bgProfiles.deleteButton:SetText(BAGSYNC_PROFILES_DELETE);
+bgProfiles.deleteButton:SetText(L["Delete"]);
 bgProfiles.deleteButton:SetScript("OnClick", function() BagSync_ProfilesFrame.confirmButton:Enable()  end)

 bgProfiles.confirmButton = CreateFrame("Button", nil, bgProfiles, "UIPanelButtonTemplate");
 bgProfiles.confirmButton:SetPoint("BOTTOM", bgProfiles, "BOTTOM", 70, 20);
 bgProfiles.confirmButton:SetHeight(21);
 bgProfiles.confirmButton:SetWidth(100);
-bgProfiles.confirmButton:SetText(BAGSYNC_PROFILES_CONFIRM);
+bgProfiles.confirmButton:SetText(L["Confirm"]);
 bgProfiles.confirmButton:Disable()

 bgProfiles.confirmButton:SetScript("OnClick", function()
@@ -81,14 +82,14 @@ function bgProfiles:LoadProfiles()
 	if not BagSync or not BagSyncDB then return end
 	if not BagSyncDB[currentRealm] then return end

-	local profile_DD, profile_DD_text, profile_DD_container, profile_DD_label = LibStub("tekKonfig-Dropdown").new(bgProfiles, BAGSYNC_PROFILES, "CENTER", bgProfiles, "CENTER", -25, 0)
+	local profile_DD, profile_DD_text, profile_DD_container, profile_DD_label = LibStub("tekKonfig-Dropdown").new(bgProfiles, L["Profiles"], "CENTER", bgProfiles, "CENTER", -25, 0)

 	profile_DD_container:SetHeight(28)
 	profile_DD:SetWidth(180)
 	profile_DD:ClearAllPoints()
 	profile_DD:SetPoint("LEFT", profile_DD_label, "RIGHT", -8, -2)
 	profile_DD_text:SetText(' ')
-	profile_DD.tiptext = BAGSYNC_PROFILES_TT
+	profile_DD.tiptext = L["Select a profile to delete.\nNOTE: This is irreversible!"]

 	bgProfiles.DDText = profile_DD_text

diff --git a/BagSync_Search.lua b/BagSync_Search.lua
index 80e1452..d227167 100644
--- a/BagSync_Search.lua
+++ b/BagSync_Search.lua
@@ -1,259 +1,260 @@
-local searchTable = {}
-local rows, anchor = {}
-local currentPlayer = UnitName('player')
-local currentRealm = GetRealmName()
-local GetItemInfo = _G['GetItemInfo']
-
-local ItemSearch = LibStub('LibItemSearch-1.0')
-
-local bgSearch = CreateFrame("Frame","BagSync_SearchFrame", UIParent)
-bgSearch:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
-
-local function escapeEditBox(self)
-  self:SetAutoFocus(false)
-end
-
-local function enterEditBox(self)
-	self:ClearFocus()
-	self:GetParent():DoSearch()
-end
-
-local function createEditBox(name, labeltext, obj, x, y)
-  local editbox = CreateFrame("EditBox", name, obj, "InputBoxTemplate")
-  editbox:SetAutoFocus(false)
-  editbox:SetWidth(180)
-  editbox:SetHeight(16)
-  editbox:SetPoint("TOPLEFT", obj, "TOPLEFT", x or 0, y or 0)
-  local label = editbox:CreateFontString(nil, "ARTWORK", "GameFontNormal")
-  label:SetPoint("BOTTOMLEFT", editbox, "TOPLEFT", -6, 4)
-  label:SetText(labeltext)
-  editbox:SetScript("OnEnterPressed", enterEditBox)
-  editbox:HookScript("OnEscapePressed", escapeEditBox)
-  return editbox
-end
-
-bgSearch:SetFrameStrata("HIGH")
-bgSearch:SetToplevel(true)
-bgSearch:EnableMouse(true)
-bgSearch:SetMovable(true)
-bgSearch:SetClampedToScreen(true)
-bgSearch:SetWidth(380)
-bgSearch:SetHeight(500)
-
-bgSearch:SetBackdrop({
-		bgFile = "Interface/Tooltips/UI-Tooltip-Background",
-		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
-		tile = true,
-		tileSize = 16,
-		edgeSize = 32,
-		insets = { left = 5, right = 5, top = 5, bottom = 5 }
-})
-
-bgSearch:SetBackdropColor(0,0,0,1)
-bgSearch:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
-
-bgSearch.SEARCHBTN = createEditBox("$parentEdit1", (BAGSYNC_SEARCH..":"), bgSearch, 60, -50)
-
-local addonTitle = bgSearch:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
-addonTitle:SetPoint("CENTER", bgSearch, "TOP", 0, -20)
-addonTitle:SetText("|cFF99CC33BagSync|r |cFFFFFFFF("..BAGSYNC_SEARCH..")|r")
-
-local totalC = bgSearch:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
-totalC:SetPoint("RIGHT", bgSearch.SEARCHBTN, 70, 0)
-totalC:SetText("|cFFFFFFFF"..BAGSYNC_SEARCH_TOTAL.." 0|r")
-bgSearch.totalC = totalC
-
-local closeButton = CreateFrame("Button", nil, bgSearch, "UIPanelCloseButton");
-closeButton:SetPoint("TOPRIGHT", bgSearch, -15, -8);
-
-bgSearch:SetScript("OnShow", function(self) self:LoadSlider(); end)
-bgSearch:SetScript("OnHide", function(self)
-	searchTable = {}
-	self.SEARCHBTN:SetText("")
-	self.totalC:SetText("|cFFFFFFFF"..BAGSYNC_SEARCH_TOTAL.." 0|r")
-end)
-
-bgSearch:SetScript("OnMouseDown", function(frame, button)
-	if frame:IsMovable() then
-		frame.isMoving = true
-		frame:StartMoving()
-	end
-end)
-
-bgSearch:SetScript("OnMouseUp", function(frame, button)
-	if( frame.isMoving ) then
-		frame.isMoving = nil
-		frame:StopMovingOrSizing()
-	end
-end)
-
-function bgSearch:LoadSlider()
-
-	local function OnEnter(self)
-		if self.link then
-			GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
-			GameTooltip:SetHyperlink(self.link)
-			GameTooltip:Show()
-		end
-	end
-	local function OnLeave() GameTooltip:Hide() end
-
-	local EDGEGAP, ROWHEIGHT, ROWGAP, GAP = 16, 20, 2, 4
-	local FRAME_HEIGHT = bgSearch:GetHeight() - 60
-	local SCROLL_TOP_POSITION = -110
-	local totalRows = math.floor((FRAME_HEIGHT-22)/(ROWHEIGHT + ROWGAP))
-
-	for i=1, totalRows do
-		if not rows[i] then
-			local row = CreateFrame("Button", nil, bgSearch)
-			if not anchor then row:SetPoint("BOTTOMLEFT", bgSearch, "TOPLEFT", 0, SCROLL_TOP_POSITION)
-			else row:SetPoint("TOP", anchor, "BOTTOM", 0, -ROWGAP) end
-			row:SetPoint("LEFT", EDGEGAP, 0)
-			row:SetPoint("RIGHT", -EDGEGAP*2-8, 0)
-			row:SetHeight(ROWHEIGHT)
-			row:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
-			anchor = row
-			rows[i] = row
-
-			local title = row:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
-			title:SetPoint("LEFT")
-			title:SetJustifyH("LEFT")
-			title:SetWidth(row:GetWidth())
-			title:SetHeight(ROWHEIGHT)
-			row.title = title
-
-			row:SetScript("OnEnter", OnEnter)
-			row:SetScript("OnLeave", OnLeave)
-			row:SetScript("OnClick", function(self)
-				if self.link then
-					if IsShiftKeyDown() then
-						ChatFrameEditBox:Insert(self.link)
-					elseif IsControlKeyDown() then
-						DressUpItemLink(self.link)
-					end
-				end
-			end)
-		end
-	end
-
-	local offset = 0
-	local RefreshSearch = function()
-		if not BagSync_SearchFrame:IsVisible() then return end
-		for i,row in ipairs(rows) do
-			if (i + offset) <= #searchTable then
-				if searchTable[i + offset] then
-					if searchTable[i + offset].rarity then
-						local hex = (select(4, GetItemQualityColor(searchTable[i + offset].rarity)))
-						row.title:SetText(format('%s%s|r', hex, searchTable[i + offset].name) or searchTable[i + offset].name)
-					else
-						row.title:SetText(searchTable[i + offset].name)
-					end
-					row.link = searchTable[i + offset].link
-					row:Show()
-				end
-			else
-				row.title:SetText(nil)
-				row:Hide()
-			end
-		end
-	end
-
-	RefreshSearch()
-
-	if not bgSearch.scrollbar then
-		bgSearch.scrollbar = LibStub("tekKonfig-Scroll").new(bgSearch, nil, #rows/2)
-		bgSearch.scrollbar:ClearAllPoints()
-		bgSearch.scrollbar:SetPoint("TOP", rows[1], 0, -16)
-		bgSearch.scrollbar:SetPoint("BOTTOM", rows[#rows], 0, 16)
-		bgSearch.scrollbar:SetPoint("RIGHT", -16, 0)
-	end
-
-	if #searchTable > 0 then
-		bgSearch.scrollbar:SetMinMaxValues(0, math.max(0, #searchTable - #rows))
-		bgSearch.scrollbar:SetValue(0)
-		bgSearch.scrollbar:Show()
-	else
-		bgSearch.scrollbar:Hide()
-	end
-
-	local f = bgSearch.scrollbar:GetScript("OnValueChanged")
-		bgSearch.scrollbar:SetScript("OnValueChanged", function(self, value, ...)
-		offset = math.floor(value)
-		RefreshSearch()
-		return f(self, value, ...)
-	end)
-
-	bgSearch:EnableMouseWheel()
-	bgSearch:SetScript("OnMouseWheel", function(self, val)
-		bgSearch.scrollbar:SetValue(bgSearch.scrollbar:GetValue() - val*#rows/2)
-	end)
-end
-
---do search routine
-function bgSearch:DoSearch()
-	if not BagSync or not BagSyncDB then return end
-	local searchStr = bgSearch.SEARCHBTN:GetText()
-
-	searchStr = searchStr:lower()
-
-	searchTable = {} --reset
-
-	local tempList = {}
-	local previousGuilds = {}
-	local count = 0
-
-	if strlen(searchStr) > 0 then
-		--loop through our characters
-		for k, v in pairs(BagSyncDB[currentRealm]) do
-
-			--now count the stuff for the user
-			for q, r in pairs(BagSyncDB[currentRealm][k]) do
-				local dblink, dbcount = strsplit(',', r)
-				if dblink then
-					local dName, dLinkD, dRarity = GetItemInfo(dblink)
-					if dName then
-						--we found a match
-						if not tempList[dblink] and ItemSearch:Find(dblink, searchStr) then
-							table.insert(searchTable, { name=dName, link=dLinkD, rarity=dRarity } )
-							tempList[dblink] = dName
-							count = count + 1
-						end
-					end
-				end
-			end
-
-			local guildN = BagSyncDB[currentRealm][k].guild or nil
-
-			--check the guild bank if the character is in a guild
-			if BagSyncGUILD_DB and guildN and BagSyncGUILD_DB[currentRealm][guildN] then
-				--check to see if this guild has already been done through this run (so we don't do it multiple times)
-				if not previousGuilds[guildN] then
-					for q, r in pairs(BagSyncGUILD_DB[currentRealm][guildN]) do
-						local dblink, dbcount = strsplit(',', r)
-						if dblink then
-							local dName, dLinkD, dRarity = GetItemInfo(dblink)
-							if dName then
-								--we found a match
-								if not tempList[dblink] and ItemSearch:Find(dblink, searchStr) then
-									table.insert(searchTable, { name=dName, link=dLinkD, rarity=dRarity } )
-									tempList[dblink] = dName
-									count = count + 1
-								end
-							end
-						end
-					end
-					previousGuilds[guildN] = true
-				end
-			end
-
-		end
-
-		table.sort(searchTable, function(a,b) return (a.name < b.name) end)
-	end
-
-	bgSearch.totalC:SetText("|cFFFFFFFF"..BAGSYNC_SEARCH_TOTAL.." "..count.."|r")
-
-	bgSearch:LoadSlider()
-end
-
+local L = BAGSYNC_L
+local searchTable = {}
+local rows, anchor = {}
+local currentPlayer = UnitName('player')
+local currentRealm = GetRealmName()
+local GetItemInfo = _G['GetItemInfo']
+
+local ItemSearch = LibStub('LibItemSearch-1.0')
+
+local bgSearch = CreateFrame("Frame","BagSync_SearchFrame", UIParent)
+bgSearch:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end)
+
+local function escapeEditBox(self)
+  self:SetAutoFocus(false)
+end
+
+local function enterEditBox(self)
+	self:ClearFocus()
+	self:GetParent():DoSearch()
+end
+
+local function createEditBox(name, labeltext, obj, x, y)
+  local editbox = CreateFrame("EditBox", name, obj, "InputBoxTemplate")
+  editbox:SetAutoFocus(false)
+  editbox:SetWidth(180)
+  editbox:SetHeight(16)
+  editbox:SetPoint("TOPLEFT", obj, "TOPLEFT", x or 0, y or 0)
+  local label = editbox:CreateFontString(nil, "ARTWORK", "GameFontNormal")
+  label:SetPoint("BOTTOMLEFT", editbox, "TOPLEFT", -6, 4)
+  label:SetText(labeltext)
+  editbox:SetScript("OnEnterPressed", enterEditBox)
+  editbox:HookScript("OnEscapePressed", escapeEditBox)
+  return editbox
+end
+
+bgSearch:SetFrameStrata("HIGH")
+bgSearch:SetToplevel(true)
+bgSearch:EnableMouse(true)
+bgSearch:SetMovable(true)
+bgSearch:SetClampedToScreen(true)
+bgSearch:SetWidth(380)
+bgSearch:SetHeight(500)
+
+bgSearch:SetBackdrop({
+		bgFile = "Interface/Tooltips/UI-Tooltip-Background",
+		edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
+		tile = true,
+		tileSize = 16,
+		edgeSize = 32,
+		insets = { left = 5, right = 5, top = 5, bottom = 5 }
+})
+
+bgSearch:SetBackdropColor(0,0,0,1)
+bgSearch:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
+
+bgSearch.SEARCHBTN = createEditBox("$parentEdit1", (L["Search"]..":"), bgSearch, 60, -50)
+
+local addonTitle = bgSearch:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
+addonTitle:SetPoint("CENTER", bgSearch, "TOP", 0, -20)
+addonTitle:SetText("|cFF99CC33BagSync|r |cFFFFFFFF("..L["Search"]..")|r")
+
+local totalC = bgSearch:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
+totalC:SetPoint("RIGHT", bgSearch.SEARCHBTN, 70, 0)
+totalC:SetText("|cFFFFFFFF"..L["Total:"].." 0|r")
+bgSearch.totalC = totalC
+
+local closeButton = CreateFrame("Button", nil, bgSearch, "UIPanelCloseButton");
+closeButton:SetPoint("TOPRIGHT", bgSearch, -15, -8);
+
+bgSearch:SetScript("OnShow", function(self) self:LoadSlider(); end)
+bgSearch:SetScript("OnHide", function(self)
+	searchTable = {}
+	self.SEARCHBTN:SetText("")
+	self.totalC:SetText("|cFFFFFFFF"..L["Total:"].." 0|r")
+end)
+
+bgSearch:SetScript("OnMouseDown", function(frame, button)
+	if frame:IsMovable() then
+		frame.isMoving = true
+		frame:StartMoving()
+	end
+end)
+
+bgSearch:SetScript("OnMouseUp", function(frame, button)
+	if( frame.isMoving ) then
+		frame.isMoving = nil
+		frame:StopMovingOrSizing()
+	end
+end)
+
+function bgSearch:LoadSlider()
+
+	local function OnEnter(self)
+		if self.link then
+			GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
+			GameTooltip:SetHyperlink(self.link)
+			GameTooltip:Show()
+		end
+	end
+	local function OnLeave() GameTooltip:Hide() end
+
+	local EDGEGAP, ROWHEIGHT, ROWGAP, GAP = 16, 20, 2, 4
+	local FRAME_HEIGHT = bgSearch:GetHeight() - 60
+	local SCROLL_TOP_POSITION = -110
+	local totalRows = math.floor((FRAME_HEIGHT-22)/(ROWHEIGHT + ROWGAP))
+
+	for i=1, totalRows do
+		if not rows[i] then
+			local row = CreateFrame("Button", nil, bgSearch)
+			if not anchor then row:SetPoint("BOTTOMLEFT", bgSearch, "TOPLEFT", 0, SCROLL_TOP_POSITION)
+			else row:SetPoint("TOP", anchor, "BOTTOM", 0, -ROWGAP) end
+			row:SetPoint("LEFT", EDGEGAP, 0)
+			row:SetPoint("RIGHT", -EDGEGAP*2-8, 0)
+			row:SetHeight(ROWHEIGHT)
+			row:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
+			anchor = row
+			rows[i] = row
+
+			local title = row:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
+			title:SetPoint("LEFT")
+			title:SetJustifyH("LEFT")
+			title:SetWidth(row:GetWidth())
+			title:SetHeight(ROWHEIGHT)
+			row.title = title
+
+			row:SetScript("OnEnter", OnEnter)
+			row:SetScript("OnLeave", OnLeave)
+			row:SetScript("OnClick", function(self)
+				if self.link then
+					if IsShiftKeyDown() then
+						ChatFrameEditBox:Insert(self.link)
+					elseif IsControlKeyDown() then
+						DressUpItemLink(self.link)
+					end
+				end
+			end)
+		end
+	end
+
+	local offset = 0
+	local RefreshSearch = function()
+		if not BagSync_SearchFrame:IsVisible() then return end
+		for i,row in ipairs(rows) do
+			if (i + offset) <= #searchTable then
+				if searchTable[i + offset] then
+					if searchTable[i + offset].rarity then
+						local hex = (select(4, GetItemQualityColor(searchTable[i + offset].rarity)))
+						row.title:SetText(format('%s%s|r', hex, searchTable[i + offset].name) or searchTable[i + offset].name)
+					else
+						row.title:SetText(searchTable[i + offset].name)
+					end
+					row.link = searchTable[i + offset].link
+					row:Show()
+				end
+			else
+				row.title:SetText(nil)
+				row:Hide()
+			end
+		end
+	end
+
+	RefreshSearch()
+
+	if not bgSearch.scrollbar then
+		bgSearch.scrollbar = LibStub("tekKonfig-Scroll").new(bgSearch, nil, #rows/2)
+		bgSearch.scrollbar:ClearAllPoints()
+		bgSearch.scrollbar:SetPoint("TOP", rows[1], 0, -16)
+		bgSearch.scrollbar:SetPoint("BOTTOM", rows[#rows], 0, 16)
+		bgSearch.scrollbar:SetPoint("RIGHT", -16, 0)
+	end
+
+	if #searchTable > 0 then
+		bgSearch.scrollbar:SetMinMaxValues(0, math.max(0, #searchTable - #rows))
+		bgSearch.scrollbar:SetValue(0)
+		bgSearch.scrollbar:Show()
+	else
+		bgSearch.scrollbar:Hide()
+	end
+
+	local f = bgSearch.scrollbar:GetScript("OnValueChanged")
+		bgSearch.scrollbar:SetScript("OnValueChanged", function(self, value, ...)
+		offset = math.floor(value)
+		RefreshSearch()
+		return f(self, value, ...)
+	end)
+
+	bgSearch:EnableMouseWheel()
+	bgSearch:SetScript("OnMouseWheel", function(self, val)
+		bgSearch.scrollbar:SetValue(bgSearch.scrollbar:GetValue() - val*#rows/2)
+	end)
+end
+
+--do search routine
+function bgSearch:DoSearch()
+	if not BagSync or not BagSyncDB then return end
+	local searchStr = bgSearch.SEARCHBTN:GetText()
+
+	searchStr = searchStr:lower()
+
+	searchTable = {} --reset
+
+	local tempList = {}
+	local previousGuilds = {}
+	local count = 0
+
+	if strlen(searchStr) > 0 then
+		--loop through our characters
+		for k, v in pairs(BagSyncDB[currentRealm]) do
+
+			--now count the stuff for the user
+			for q, r in pairs(BagSyncDB[currentRealm][k]) do
+				local dblink, dbcount = strsplit(',', r)
+				if dblink then
+					local dName, dLinkD, dRarity = GetItemInfo(dblink)
+					if dName then
+						--we found a match
+						if not tempList[dblink] and ItemSearch:Find(dblink, searchStr) then
+							table.insert(searchTable, { name=dName, link=dLinkD, rarity=dRarity } )
+							tempList[dblink] = dName
+							count = count + 1
+						end
+					end
+				end
+			end
+
+			local guildN = BagSyncDB[currentRealm][k].guild or nil
+
+			--check the guild bank if the character is in a guild
+			if BagSyncGUILD_DB and guildN and BagSyncGUILD_DB[currentRealm][guildN] then
+				--check to see if this guild has already been done through this run (so we don't do it multiple times)
+				if not previousGuilds[guildN] then
+					for q, r in pairs(BagSyncGUILD_DB[currentRealm][guildN]) do
+						local dblink, dbcount = strsplit(',', r)
+						if dblink then
+							local dName, dLinkD, dRarity = GetItemInfo(dblink)
+							if dName then
+								--we found a match
+								if not tempList[dblink] and ItemSearch:Find(dblink, searchStr) then
+									table.insert(searchTable, { name=dName, link=dLinkD, rarity=dRarity } )
+									tempList[dblink] = dName
+									count = count + 1
+								end
+							end
+						end
+					end
+					previousGuilds[guildN] = true
+				end
+			end
+
+		end
+
+		table.sort(searchTable, function(a,b) return (a.name < b.name) end)
+	end
+
+	bgSearch.totalC:SetText("|cFFFFFFFF"..L["Total:"].." "..count.."|r")
+
+	bgSearch:LoadSlider()
+end
+
 bgSearch:Hide()
\ No newline at end of file
diff --git a/BagSync_Tokens.lua b/BagSync_Tokens.lua
index a9d2e60..e6f4a70 100644
--- a/BagSync_Tokens.lua
+++ b/BagSync_Tokens.lua
@@ -1,3 +1,4 @@
+local L = BAGSYNC_L
 local tokensTable = {}
 local tRows, tAnchor = {}
 local currentPlayer = UnitName('player')
@@ -29,7 +30,7 @@ bgTokens:SetPoint("CENTER", UIParent, "CENTER", 0, 0)

 local addonTitle = bgTokens:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
 addonTitle:SetPoint("CENTER", bgTokens, "TOP", 0, -20)
-addonTitle:SetText("|cFF99CC33BagSync|r |cFFFFFFFF("..BAGSYNC_TOKENS..")|r")
+addonTitle:SetText("|cFF99CC33BagSync|r |cFFFFFFFF("..L["Tokens"]..")|r")

 local closeButton = CreateFrame("Button", nil, bgTokens, "UIPanelCloseButton");
 closeButton:SetPoint("TOPRIGHT", bgTokens, -15, -8);
diff --git a/localization/localization.lua b/localization/localization.lua
index b6ea8e8..0bda520 100644
--- a/localization/localization.lua
+++ b/localization/localization.lua
@@ -1,283 +1,114 @@
---[[
+
+--[[
 	BagSync Localization
 --]]

-if ( GetLocale() == "zhCN" ) then
-
-	BAGSYNC_NUM_BAGS = '背包: %d'
-	BAGSYNC_NUM_BANK = '银行: %d'
-	BAGSYNC_EQUIPPED = '已装备: %d'
-	BAGSYNC_NUM_GUILDBANK = 'Guild: %d'
-	BAGSYNC_NUM_MAILBOX = 'Mailbox: %d'
-	BAGSYNC_SEARCH = 'Search'
-	BAGSYNC_SEARCH_TOTAL = 'Total:'
-	BAGSYNC_TOKENS = 'Tokens'
-	BAGSYNC_PROFILES = 'Profiles'
-	BAGSYNC_PROFILES_TT = 'Select a profile to delete.\nNOTE: This is irreversible!'
-	BAGSYNC_PROFILES_DELETE = 'Delete'
-	BAGSYNC_PROFILES_CONFIRM = 'Confirm'
-	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
-	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
-	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
-	BAGSYNC_SWITCH_ON = 'ON'
-	BAGSYNC_SWITCH_OFF = 'OFF'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
-
-elseif ( GetLocale() == "ruRU" )  then
-	--thanks to senryo from WOWInterface
-
-	BAGSYNC_NUM_BAGS = 'В сумке: %d'
-	BAGSYNC_NUM_BANK = 'В банке: %d'
-	BAGSYNC_EQUIPPED = 'На персонаже: %d'
-	BAGSYNC_NUM_GUILDBANK = 'В гильдбанке: %d'
-	BAGSYNC_NUM_MAILBOX = 'Mailbox: %d'
-	BAGSYNC_SEARCH = 'Search'
-	BAGSYNC_SEARCH_TOTAL = 'Total:'
-	BAGSYNC_TOKENS = 'Tokens'
-	BAGSYNC_PROFILES = 'Profiles'
-	BAGSYNC_PROFILES_TT = 'Select a profile to delete.\nNOTE: This is irreversible!'
-	BAGSYNC_PROFILES_DELETE = 'Delete'
-	BAGSYNC_PROFILES_CONFIRM = 'Confirm'
-	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
-	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
-	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
-	BAGSYNC_SWITCH_ON = 'ON'
-	BAGSYNC_SWITCH_OFF = 'OFF'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
+-- ["Bags: %d"] = "",
+-- ["Bank: %d"] = "",
+-- ["Equipped: %d"] = "",
+-- ["Guild: %d"] = "",
+-- ["Mailbox: %d"] = "",
+-- ["Search"] = "",
+-- ["Total:"] = "",
+-- ["Tokens"] = "",
+-- ["Profiles"] = "",
+-- ["Select a profile to delete.\nNOTE: This is irreversible!"] = "",
+-- ["Delete"] = "",
+-- ["Confirm"] = "",
+-- ["Toggle Search"] = "",
+-- ["Toggle Tokens"] = "",
+-- ["Toggle Profiles"] = "",
+-- ["A FixDB has been performed on BagSync!  The database is now optimized!"] = "",
+-- ["ON"] = "",
+-- ["OFF"] = "",
+-- ["[itemname]"] = "",
+-- ["search"] = "",
+-- ["gold"] = "",
+-- ["tokens"] = "",
+-- ["profiles"] = "",
+-- ["fixdb"] = "",
+-- ["total"] = "",
+-- ["guildname"] = "",
+-- ["throttle"] = "",
+-- ["guild"] = "",
+-- ["/bgs [itemname] - Does a quick search for an item"] = "",
+-- ["/bgs search - Opens the search window"] = "",
+-- ["/bgs gold - Displays a tooltip with the amount of gold on each character."] = "",
+-- ["/bgs tokens - Opens the tokens/currency window."] = "",
+-- ["/bgs profiles - Opens the profiles window."] = "",
+-- ["/bgs fixdb - Runs the database fix (FixDB) on BagSync."] = "",
+-- ["/bgs total - Toggles the [Total] display in tooltips and gold display."] = "",
+-- ["/bgs guildname - Toggles the [Guild Name] display in tooltips."] = "",
+-- ["/bgs throttle - Toggles the throttle when displaying tooltips. (ON = Prevents Lag)."] = "",
+-- ["/bgs guild - Toggles the displaying of guild information."] = "",

-elseif ( GetLocale() == "zhTW" ) then
+BAGSYNC_L = GetLocale() == "zhCN" and {
+	["Bags: %d"] = "背包: %d",
+	["Bank: %d"] = "银行: %d",
+	["Equipped: %d"] = "已装备: %d",

-	BAGSYNC_NUM_BAGS = '背包: %d'
-	BAGSYNC_NUM_BANK = '銀行: %d'
-	BAGSYNC_EQUIPPED = '已裝備: %d'
-	BAGSYNC_NUM_GUILDBANK = 'Guild: %d'
-	BAGSYNC_NUM_MAILBOX = 'Mailbox: %d'
-	BAGSYNC_SEARCH = 'Search'
-	BAGSYNC_SEARCH_TOTAL = 'Total:'
-	BAGSYNC_TOKENS = 'Tokens'
-	BAGSYNC_PROFILES = 'Profiles'
-	BAGSYNC_PROFILES_TT = 'Select a profile to delete.\nNOTE: This is irreversible!'
-	BAGSYNC_PROFILES_DELETE = 'Delete'
-	BAGSYNC_PROFILES_CONFIRM = 'Confirm'
-	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
-	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
-	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
-	BAGSYNC_SWITCH_ON = 'ON'
-	BAGSYNC_SWITCH_OFF = 'OFF'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
-
-elseif ( GetLocale() == "frFR" ) then
-	--thanks to cacahuete from WOWInterface
-
-	BAGSYNC_NUM_BAGS = 'Sacs: %d'
-	BAGSYNC_NUM_BANK = 'Banque: %d'
-	BAGSYNC_EQUIPPED = 'Équipé: %d'
-	BAGSYNC_NUM_GUILDBANK = 'Guilde: %d'
-	BAGSYNC_NUM_MAILBOX = 'Mailbox: %d'
-	BAGSYNC_SEARCH = 'Search'
-	BAGSYNC_SEARCH_TOTAL = 'Total:'
-	BAGSYNC_TOKENS = 'Tokens'
-	BAGSYNC_PROFILES = 'Profiles'
-	BAGSYNC_PROFILES_TT = 'Select a profile to delete.\nNOTE: This is irreversible!'
-	BAGSYNC_PROFILES_DELETE = 'Delete'
-	BAGSYNC_PROFILES_CONFIRM = 'Confirm'
-	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
-	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
-	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
-	BAGSYNC_SWITCH_ON = 'ON'
-	BAGSYNC_SWITCH_OFF = 'OFF'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
+} or GetLocale() == "ruRU" and {
+	["Bags: %d"] = "В сумке: %d",
+	["Bank: %d"] = "В банке: %d",
+	["Equipped: %d"] = "На персонаже: %d",
+	["Guild: %d"] = "В гильдбанке: %d",

-elseif ( GetLocale() == "koKR" ) then
-	--thanks to zinzzalimp from WOWInterface
-
-	BAGSYNC_NUM_BAGS = '가방: %d'
-	BAGSYNC_NUM_BANK = '은행: %d'
-	BAGSYNC_EQUIPPED = '착용중: %d'
-	BAGSYNC_NUM_GUILDBANK = '길드은행: %d'
-	BAGSYNC_NUM_MAILBOX = '우편함: %d'
-	BAGSYNC_SEARCH = '검색'
-	BAGSYNC_SEARCH_TOTAL = 'Total:'
-	BAGSYNC_TOKENS = '문장'
-	BAGSYNC_PROFILES = '프로필'
-	BAGSYNC_PROFILES_TT = '삭제할 프로필을 선택하세요.\nNOTE: 되돌릴수 없습니다!!!'
-	BAGSYNC_PROFILES_DELETE = '삭제'
-	BAGSYNC_PROFILES_CONFIRM = '확인'
-	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
-	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
-	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
-	BAGSYNC_SWITCH_ON = 'ON'
-	BAGSYNC_SWITCH_OFF = 'OFF'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - 빠른 아이템 찾기'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - 검색창 열기'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - 툴팁에 각 케릭터의 골드량을 표시합니다.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - 문장/화폐창을 엽니다'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - 프로필 창을 엽니다.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
-
-elseif ( GetLocale() == "deDE" ) then
-	--thanks to Schnubby from WOWInterface
+} or GetLocale() == "zhTW" and {
+	["Bags: %d"] = "背包: %d",
+	["Bank: %d"] = "銀行: %d",
+	["Equipped: %d"] = "已裝備: %d",

-	BAGSYNC_NUM_BAGS = 'Taschen: %d'
-	BAGSYNC_NUM_BANK = 'Bank: %d'
-	BAGSYNC_EQUIPPED = 'Angelegt: %d'
-	BAGSYNC_NUM_GUILDBANK = 'Gilde: %d'
-	BAGSYNC_NUM_MAILBOX = 'Post: %d'
-	BAGSYNC_SEARCH = 'Suche'
-	BAGSYNC_SEARCH_TOTAL = 'Gesamt:'
-	BAGSYNC_TOKENS = 'Abzeichen'
-	BAGSYNC_PROFILES = 'Profile'
-	BAGSYNC_PROFILES_TT = 'Wähle ein Profil zum löschen aus.\nINFO: Dies ist nicht umkehrbar!'
-	BAGSYNC_PROFILES_DELETE = 'Löschen'
-	BAGSYNC_PROFILES_CONFIRM = 'Bestätigen'
-	BAGSYNC_BINDING_SEARCH = 'Öffne/Schließe Suche'
-	BAGSYNC_BINDING_TOKEN = 'Öffne/Schließe Abzeichen'
-	BAGSYNC_BINDING_PROFILES = 'Öffne/Schließe Profile'
-	BAGSYNC_DATABASE_FIX_ALERT = 'Die Funktion FixDB wurde ausgeführt! Die Datenbank wurde optimiert!'
-	BAGSYNC_SWITCH_ON = 'An'
-	BAGSYNC_SWITCH_OFF = 'Aus'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Nach einem Item suchen'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Öffnet das Suchfenster'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Zeigt einen Tooltip mit dem Gold eines jeden Charakters.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Öffnet das Abzeichenfenster.'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Öffnet das Profilfenster.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Führt eine Reparatur der Datenbank (FixDB) aus.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Zeigt/Verbirgt die [Gesamt] Anzeige in Tooltips für Items und in der Goldanzeige.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
+} or GetLocale() == "frFR" and {
+	["Bags: %d"] = "Sacs: %d",
+	["Bank: %d"] = "Banque: %d",
+	["Equipped: %d"] = "Équipé: %d",
+	["Guild: %d"] = "Guilde: %d",

-else
+} or GetLocale() == "koKR" and {
+	["Bags: %d"] = "가방: %d",
+	["Bank: %d"] = "은행: %d",
+	["Equipped: %d"] = "착용중: %d",
+	["Guild: %d"] = "길드은행: %d",
+	["Mailbox: %d"] = "우편함: %d",
+	["Search"] = "검색",
+	["Tokens"] = "문장",
+	["Profiles"] = "프로필",
+	["Select a profile to delete.\nNOTE: This is irreversible!"] 					= "삭제할 프로필을 선택하세요.\nNOTE: 되돌릴수 없습니다!!!",
+	["Delete"] = "삭제",
+	["Confirm"] = "확인",
+	["/bgs [itemname] - Does a quick search for an item"] 							= "/bgs [itemname] - 빠른 아이템 찾기",
+	["/bgs search - Opens the search window"] 										= "/bgs search - 검색창 열기",
+	["/bgs gold - Displays a tooltip with the amount of gold on each character."] 	= "/bgs gold - 툴팁에 각 케릭터의 골드량을 표시합니다.",
+	["/bgs tokens - Opens the tokens/currency window."] 							= "/bgs tokens - 문장/화폐창을 엽니다",
+	["/bgs profiles - Opens the profiles window."]									= "/bgs profiles - 프로필 창을 엽니다.",

-	BAGSYNC_NUM_BAGS = 'Bags: %d'
-	BAGSYNC_NUM_BANK = 'Bank: %d'
-	BAGSYNC_EQUIPPED = 'Equipped: %d'
-	BAGSYNC_NUM_GUILDBANK = 'Guild: %d'
-	BAGSYNC_NUM_MAILBOX = 'Mailbox: %d'
-	BAGSYNC_SEARCH = 'Search'
-	BAGSYNC_SEARCH_TOTAL = 'Total:'
-	BAGSYNC_TOKENS = 'Tokens'
-	BAGSYNC_PROFILES = 'Profiles'
-	BAGSYNC_PROFILES_TT = 'Select a profile to delete.\nNOTE: This is irreversible!'
-	BAGSYNC_PROFILES_DELETE = 'Delete'
-	BAGSYNC_PROFILES_CONFIRM = 'Confirm'
-	BAGSYNC_BINDING_SEARCH = 'Toggle Search'
-	BAGSYNC_BINDING_TOKEN = 'Toggle Tokens'
-	BAGSYNC_BINDING_PROFILES = 'Toggle Profiles'
-	BAGSYNC_DATABASE_FIX_ALERT = 'A FixDB has been performed on BagSync!  The database is now optimized!'
-	BAGSYNC_SWITCH_ON = 'ON'
-	BAGSYNC_SWITCH_OFF = 'OFF'
-	BAGSYNC_SLASH_CMD1 = '[itemname]'
-	BAGSYNC_SLASH_CMD2 = 'search'
-	BAGSYNC_SLASH_CMD3 = 'gold'
-	BAGSYNC_SLASH_CMD4 = 'tokens'
-	BAGSYNC_SLASH_CMD5 = 'profiles'
-	BAGSYNC_SLASH_CMD6 = 'fixdb'
-	BAGSYNC_SLASH_CMD7 = 'total'
-	BAGSYNC_SLASH_CMD8 = 'guildname'
-	BAGSYNC_SLASH_CMD9 = 'throttle'
-	BAGSYNC_SLASH1 = '/bgs '..BAGSYNC_SLASH_CMD1..' - Does a quick search for an item'
-	BAGSYNC_SLASH2 = '/bgs '..BAGSYNC_SLASH_CMD2..' - Opens the search window'
-	BAGSYNC_SLASH3 = '/bgs '..BAGSYNC_SLASH_CMD3..' - Displays a tooltip with the amount of gold on each character.'
-	BAGSYNC_SLASH4 = '/bgs '..BAGSYNC_SLASH_CMD4..' - Opens the tokens/currency window.'
-	BAGSYNC_SLASH5 = '/bgs '..BAGSYNC_SLASH_CMD5..' - Opens the profiles window.'
-	BAGSYNC_SLASH6 = '/bgs '..BAGSYNC_SLASH_CMD6..' - Runs the database fix (FixDB) on BagSync.'
-	BAGSYNC_SLASH7 = '/bgs '..BAGSYNC_SLASH_CMD7..' - Toggles the [Total] display in tooltips and gold display.'
-	BAGSYNC_SLASH8 = '/bgs '..BAGSYNC_SLASH_CMD8..' - Toggles the [Guild Name] display in tooltips.'
-	BAGSYNC_SLASH9 = '/bgs '..BAGSYNC_SLASH_CMD9..' - Toggles the throttle when displaying tooltips. (ON = Prevents Lag).'
-
-end
+} or GetLocale() == "deDE" and {
+	["Bags: %d"] = "Taschen: %d",
+	["Bank: %d"] = "Bank: %d",
+	["Equipped: %d"] = "Angelegt: %d",
+	["Guild: %d"] = "Gilde: %d",
+	["Mailbox: %d"] = "Post: %d",
+	["Search"] = "Suche",
+	["Total:"] = "Gesamt:",
+	["Tokens"] = "Abzeichen",
+	["Profiles"] = "Profile",
+	["Select a profile to delete.\nNOTE: This is irreversible!"] 					= "Wähle ein Profil zum löschen aus.\nINFO: Dies ist nicht umkehrbar!",
+	["Delete"] = "Löschen",
+	["Confirm"] = "Bestätigen",
+	["Toggle Search"] = "Öffne/Schließe Suche",
+	["Toggle Tokens"] = "Öffne/Schließe Abzeichen",
+	["Toggle Profiles"] = "Öffne/Schließe Profile",
+	["A FixDB has been performed on BagSync!  The database is now optimized!"] 		= "Die Funktion FixDB wurde ausgeführt! Die Datenbank wurde optimiert!",
+	["ON"] = "An",
+	["OFF"] = "Aus",
+	["/bgs [itemname] - Does a quick search for an item"] 							= "/bgs [itemname] - Nach einem Item suchen",
+	["/bgs search - Opens the search window"] 										= "/bgs search - Öffnet das Suchfenster",
+	["/bgs gold - Displays a tooltip with the amount of gold on each character."] 	= "/bgs gold - Zeigt einen Tooltip mit dem Gold eines jeden Charakters.",
+	["/bgs tokens - Opens the tokens/currency window."] 							= "/bgs tokens - Öffnet das Abzeichenfenster.",
+	["/bgs profiles - Opens the profiles window."] 									= "/bgs profiles - Öffnet das Profilfenster.",
+	["/bgs fixdb - Runs the database fix (FixDB) on BagSync."] 						= "/bgs fixdb - Führt eine Reparatur der Datenbank (FixDB) aus.",
+	["/bgs total - Toggles the [Total] display in tooltips and gold display."] 		= "/bgs total - Zeigt/Verbirgt die [Gesamt] Anzeige in Tooltips für Items und in der Goldanzeige.",
+
+} or { }

+setmetatable(BAGSYNC_L, {__index = function(self, key) rawset(self, key, key); return key; end})