- Add back TITAN_PANEL_MENU_CATEGORIES. Removal broke a couple Titan plugins
urnati [03-07-24 - 13:55]
- Add back TITAN_PANEL_MENU_CATEGORIES. Removal broke a couple Titan plugins
diff --git a/Titan/Titan.lua b/Titan/Titan.lua
index 1984fb3..94d0a04 100644
--- a/Titan/Titan.lua
+++ b/Titan/Titan.lua
@@ -2021,12 +2021,12 @@ local function BuildMainMenu(frame)
-----------------
-- Plugin Categories
- -- for index, id in pairs(L["TITAN_PANEL_MENU_CATEGORIES"]) do
- for index = 1, 6, 1 do
+ -- Both arrays are in TitanGlobal
+---@diagnostic disable-next-line: param-type-mismatch
+ for index, id in pairs(L["TITAN_PANEL_MENU_CATEGORIES"]) do
info = {};
info.notCheckable = true
- -- bit of a kludge but a decent way to handle something that rarely changes
- info.text = L["TITAN_PANEL_MENU_CATEGORIES_" .. string.format("%02d", index)]
+ info.text = L["TITAN_PANEL_MENU_CATEGORIES"][index];
info.value = R_ADDONS .. TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY[index];
info.hasArrow = 1;
TitanPanelRightClickMenu_AddButton(info);
diff --git a/Titan/TitanGlobal.lua b/Titan/TitanGlobal.lua
index 859fe16..148ec11 100644
--- a/Titan/TitanGlobal.lua
+++ b/Titan/TitanGlobal.lua
@@ -5,6 +5,7 @@ DESC: This file contains the global variables and constants used throughout Tita
--]]
---@meta
+local L = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)
-- Global variables
@@ -92,8 +93,34 @@ TITAN_PROFILE_INIT = "<INIT>"
AUTOHIDE_PREFIX = "TitanPanelAutoHide_"
AUTOHIDE_SUFFIX = "Button"
-TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY =
+--[[ API
+NAME: TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY and TITAN_PANEL_MENU_CATEGORIES
+DESC: These two tables hold the list of categories for the Titan menu.
+Logically they are category - text string pairs.
+Where category is the internal label to be used.
+Where text is the localized text.
+The category should be unique across the table or the menu navigation may be what the user expects.
+Some Titan plugins add to this list to make user navigation easier for their Titan plugins.
+
+Add to these lists by using table insert. Example :
+table.insert(TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY, "CAT_ZONES")
+
+local categories = LibStub("AceLocale-3.0"):GetLocale(TITAN_ID, true)["TITAN_PANEL_MENU_CATEGORIES"]
+table.insert(categories, "Zones")
+Titan uses AceLocale to simplify using localized strings.
+:DESC
+--]]
+TITAN_PANEL_BUTTONS_PLUGIN_CATEGORY =
{"Built-ins","General","Combat","Information","Interface","Profession"}
+---@diagnostic disable-next-line: assign-type-mismatch
+L["TITAN_PANEL_MENU_CATEGORIES"] = {
+ L["TITAN_PANEL_MENU_CATEGORIES_01"],
+ L["TITAN_PANEL_MENU_CATEGORIES_02"],
+ L["TITAN_PANEL_MENU_CATEGORIES_03"],
+ L["TITAN_PANEL_MENU_CATEGORIES_04"],
+ L["TITAN_PANEL_MENU_CATEGORIES_05"],
+ L["TITAN_PANEL_MENU_CATEGORIES_06"],
+}
-- Bar background types
Titan_Global.SKIN = "skin"