Quantcast

Add some localization stuff, to be enabled later

Adrian L Lange [12-19-14 - 09:51]
Add some localization stuff, to be enabled later
Filename
Broker_Equipment.toc
Config.lua
Localization.lua
diff --git a/Broker_Equipment.toc b/Broker_Equipment.toc
index a90de5e..90b6ec4 100644
--- a/Broker_Equipment.toc
+++ b/Broker_Equipment.toc
@@ -11,5 +11,6 @@ embeds\LibStub\LibStub.lua
 embeds\CallbackHandler\CallbackHandler-1.0.lua
 embeds\LibDataBroker\LibDataBroker-1.1.lua

+Localization.lua
 Config.lua
 Broker_Equipment.lua
diff --git a/Config.lua b/Config.lua
index da1515e..18a8851 100644
--- a/Config.lua
+++ b/Config.lua
@@ -1,4 +1,4 @@
-local addonName = ...
+local addonName, L = ...

 local objects = {}
 local temporary = {}
@@ -77,16 +77,16 @@ Panel:SetScript('OnShow', function(self)
 	Description:SetPoint('TOPLEFT', Title, 'BOTTOMLEFT', 0, -8)
 	Description:SetPoint('RIGHT', -32, 0)
 	Description:SetJustifyH('LEFT')
-	Description:SetText('Equipment sets!')
+	Description:SetText(L['Equipment sets!'])
 	self.Description = Description

 	local DisplayTooltip = CreateCheckButton(self, 'showTooltipDisplay')
 	DisplayTooltip:SetPoint('TOPLEFT', Description, 'BOTTOMLEFT', -2, -10)
-	DisplayTooltip.Text:SetText('Enable tooltips in display')
+	DisplayTooltip.Text:SetText(L['Enable tooltips in display'])

 	local MenuTooltip = CreateCheckButton(self, 'showTooltipMenu')
 	MenuTooltip:SetPoint('TOPLEFT', DisplayTooltip, 'BOTTOMLEFT', 0, -8)
-	MenuTooltip.Text:SetText('Enable tooltips in menu')
+	MenuTooltip.Text:SetText(L['Enable tooltips in menu'])

 	Panel:refresh()

diff --git a/Localization.lua b/Localization.lua
new file mode 100644
index 0000000..c25788e
--- /dev/null
+++ b/Localization.lua
@@ -0,0 +1,32 @@
+local _, L = ...
+
+setmetatable(L, {__index = function(L, key)
+	local value = tostring(key)
+	L[key] = value
+	return value
+end})
+
+--[==========[
+local locale = GetLocale()
+if(locale == 'deDE') then
+	--@localization(locale="deDE", format="lua_additive_table")@
+elseif(locale == 'esES') then
+	--@localization(locale="esES", format="lua_additive_table")@
+elseif(locale == 'esMX') then
+	--@localization(locale="esMX", format="lua_additive_table")@
+elseif(locale == 'frFR') then
+	--@localization(locale="frFR", format="lua_additive_table")@
+elseif(locale == 'itIT') then
+	--@localization(locale="itIT", format="lua_additive_table")@
+elseif(locale == 'koKR') then
+	--@localization(locale="koKR", format="lua_additive_table")@
+elseif(locale == 'ptBR') then
+	--@localization(locale="ptBR", format="lua_additive_table")@
+elseif(locale == 'ruRU') then
+	--@localization(locale="ruRU", format="lua_additive_table")@
+elseif(locale == 'zhCN') then
+	--@localization(locale="zhCN", format="lua_additive_table")@
+elseif(locale == 'zhTW') then
+	--@localization(locale="zhTW", format="lua_additive_table")@
+end
+--]==========]