Convert strings for localization

Scott Yeskie [07-07-16 - 05:15]
Convert strings for localization
Filename
CyrHUD.lua
CyrHUD.txt
lang/en.lua
menu.lua
diff --git a/CyrHUD.lua b/CyrHUD.lua
index a8571f8..9618729 100644
--- a/CyrHUD.lua
+++ b/CyrHUD.lua
@@ -1,6 +1,6 @@
 -- This file is part of CyrHUD
 --
--- (C) 2015 Scott Yeskie (Sasky)
+-- (C) 2016 Scott Yeskie (Sasky)
 --
 -- This program is free software; you can redistribute it and/or modify
 -- it under the terms of the GNU General Public License as published by
@@ -315,8 +315,8 @@ function CyrHUD.addonInit()
         --NOTE: If you see this before 4/1, please don't share
         table.insert(self.menuOptions,{
             type = "checkbox",
-            name = "April Fools Fix",
-            tooltip = "Turn on to restore normal coloring",
+            name = GetString(SI_CYRHUD_APRIL1),
+            tooltip = GetString(SI_CYRHUD_APRIL1_TOOLTIP),
             getFunc = function() return CyrHUD.cfg.aprOff or false end,
             setFunc = function(v) CyrHUD.cfg.aprOff = v; CyrHUD:refresh() end,
         })
diff --git a/CyrHUD.txt b/CyrHUD.txt
index b2d1ba1..97386db 100644
--- a/CyrHUD.txt
+++ b/CyrHUD.txt
@@ -1,6 +1,6 @@
 ## APIVersion: 100015
 ## Title: CyrHUD
-## Version: 1.3.1
+## Version: 1.4.0
 ## Author: Sasky
 ## SavedVariables: CyrHUD_SavedVars
 ## OptionalDependsOn: LibAddonMenu-2.0
@@ -21,6 +21,9 @@ lib/LibAddonMenu-2.0/controls/iconpicker.lua
 lib/LibAddonMenu-2.0/controls/slider.lua
 lib/LibAddonMenu-2.0/controls/texture.lua

+lang/en.lua
+lang/$(language).lua
+
 classes/Info.lua
 classes/Label.lua
 classes/Battle.lua
diff --git a/lang/en.lua b/lang/en.lua
new file mode 100644
index 0000000..6f090d9
--- /dev/null
+++ b/lang/en.lua
@@ -0,0 +1,40 @@
+-- This file is part of CyrHUD
+--
+-- (C) 2016 Scott Yeskie (Sasky)
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+ZO_CreateStringId("SI_CYRHUD_APRIL1", "April Fools Fix")
+ZO_CreateStringId("SI_CYRHUD_APRIL1_TOOLTIP", "Turn on to restore normal coloring")
+ZO_CreateStringId("SI_CYRHUD_HIDE_IC", "Hide Imperial District Battles")
+ZO_CreateStringId("SI_CYRHUD_HIDE_IC_INFO", "Hides Imperial District battles from CyrHUD notifications")
+ZO_CreateStringId("SI_CYRHUD_QT_DEFAULT", "Auto-hide Default Quest Tracker")
+ZO_CreateStringId("SI_CYRHUD_QT_TOOLTIP", "Hides quest trackers when CyrHUD is shown")
+ZO_CreateStringId("SI_CYRHUD_QT_WYKKYD", "Auto-hide Wykkyd's Quest Tracker")
+ZO_CreateStringId("SI_CYRHUD_POPBAR", "Population bars for flags")
+ZO_CreateStringId("SI_CYRHUD_POPBAR_INFO", "Shows current population instead of alliance flag in summary")
+ZO_CreateStringId("SI_BINDING_NAME_CYRHUD_TOGGLE", "Enable/disable CyrHUD")
+
+local CZ = "|cC5C29E" -- ZOS standard text color
+local CR = "|cFFFFFF" -- Reset color
+ZO_CreateStringId("SI_CYRHUD_KEYBIND_HEADER", "Keybind")
+ZO_CreateStringId("SI_CYRHUD_KEYBIND_DESC",
+    CZ .. "See the controls game menu for setting a keybind for the" .. CR .. "/cyrhud" .. CZ .. " command.\n"
+        .."This toggles the addon on or off.")
+
+
+--Templates for using in code (reference):
+--ZO_CreateStringId("SI_CYRHUD_", )
+--GetString(SI_CYRHUD_...)
+--zo_strformat(GetString(SI_CYRHUD_...), param1, param2))
diff --git a/menu.lua b/menu.lua
index cefb79a..25de19f 100644
--- a/menu.lua
+++ b/menu.lua
@@ -20,48 +20,41 @@ CyrHUD.menuPanel = {
     type = "panel",
     name = "CyrHUD",
     author = "Sasky",
-    version = "1.1.0",
+    version = "1.4.0",
 }

-local CZ = "|cC5C29E" -- ZOS standard text color
-local CR = "|cFFFFFF" -- Reset color
-
 CyrHUD.menuOptions = {
     {
         type = "checkbox",
-        name = "Auto-hide Default Quest Tracker",
-        tooltip = "Hides quest trackers when CyrHUD is shown",
+        name = GetString(SI_CYRHUD_QT_DEFAULT),
+        tooltip = GetString(SI_CYRHUD_QT_TOOLTIP),
         getFunc = function() return CyrHUD.cfg.zosTrackerDisable or false end,
         setFunc = function(v) CyrHUD.cfg.zosTrackerDisable = v end
     },
     {
         type = "checkbox",
-        name = "Auto-hide Wykkyd's Quest Tracker",
-        tooltip = "Hides quest trackers when CyrHUD is shown",
+        name = GetString(SI_CYRHUD_QT_WYKKYD),
+        tooltip = GetString(SI_CYRHUD_QT_TOOLTIP),
         getFunc = function() return CyrHUD.cfg.trackerDisable or false end,
         setFunc = function(v) CyrHUD.cfg.trackerDisable = v end
     },
     {
         type = "checkbox",
-        name = "Population bars for flags",
-        tooltip = "Shows current population instead of alliance flag in summary",
+        name = GetString(SI_CYRHUD_POPBAR),
+        tooltip = GetString(SI_CYRHUD_POPBAR_INFO),
         getFunc = function() return CyrHUD.cfg.showPopBars or false end,
         setFunc = function(v) CyrHUD.cfg.showPopBars = v; CyrHUD:reconfigureLabels() end,
     },
     {
         type = "checkbox",
-        name = "Hide Imperial District Battles",
-        tooltip = "Hides Imperial District battles from CyrHUD notifications",
+        name = GetString(SI_CYRHUD_HIDE_IC),
+        tooltip = GetString(SI_CYRHUD_HIDE_IC_INFO),
         getFunc = function() return CyrHUD.cfg.hideImpBattles or false end,
         setFunc = function(v) CyrHUD.cfg.hideImpBattles = v; CyrHUD:reconfigureLabels() end
     },
     {
         type = "description",
-        title = "Keybind",
-        text = CZ .. "See the controls game menu for setting a keybind for the" .. CR .. "/cyrhud" .. CZ .. " command.\n"
-            .."This toggles the addon on or off."
+        title = GetString(SI_CYRHUD_KEYBIND_HEADER),
+        text = GetString(SI_CYRHUD_KEYBIND_DESC)
     }
 }
-
---TODO: Move this and other strings to proper translator format
-ZO_CreateStringId("SI_BINDING_NAME_CYRHUD_TOGGLE", "Enable/disable CyrHUD")