diff --git a/.pkgmeta b/.pkgmeta index aec8dfd..30c98fc 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -40,6 +40,9 @@ externals: Libs/AceDB-3.0: url: https://repos.wowace.com/wow/ace3/trunk/AceDB-3.0 tag: "Release-r1377" + Libs/AceLocale-3.0: + url: https://repos.wowace.com/wow/ace3/trunk/AceLocale-3.0 + tag: "Release-r1377" Libs/AceConsole-3.0: url: https://repos.wowace.com/wow/ace3/trunk/AceConsole-3.0 tag: "Release-r1377" diff --git a/Boot.lua b/Boot.lua index f8cfaf8..1b6c20e 100644 --- a/Boot.lua +++ b/Boot.lua @@ -11,6 +11,7 @@ addon.libs = addon.libs or {} addon.libs.LibDataBroker = LibStub("LibDataBroker-1.1") addon.libs.LibDBIcon = LibStub("LibDBIcon-1.0") addon.libs.AceDB = LibStub("AceDB-3.0") +addon.libs.AceLocale = LibStub("AceLocale-3.0") addon.libs.AceAddon = LibStub("AceAddon-3.0") addon.libs.LiqUI = LibStub("LiqUI-1.0") diff --git a/Data.lua b/Data.lua index 85645d9..9c78517 100644 --- a/Data.lua +++ b/Data.lua @@ -5,6 +5,7 @@ local addon = select(2, ...) local Data = {} addon.Data = Data +local L = addon.L local Helpers = addon.Helpers local Constants = addon.Constants local LibLiqUI = addon.libs.LiqUI @@ -426,6 +427,9 @@ function Data:MigrateDB() for _, category in ipairs(self.ObjectiveCategories or {}) do if category and category.id and category.name then migrateHiddenColumnKey(mainHidden, category.name, "category_" .. tostring(category.id)) + if category.legacyName then + migrateHiddenColumnKey(mainHidden, category.legacyName, "category_" .. tostring(category.id)) + end end end @@ -705,6 +709,7 @@ function Data:ScanCalendar() if not numEvents then return end + self.cache.isDarkmoonOpen = false for i = 1, numEvents do local event = C_Calendar.GetDayEvent(0, today, i) if event and not Helpers:IsSecretValue(event.eventID) and event.eventID == 479 then @@ -1108,6 +1113,22 @@ function Data:GetExpansionByID(expansionID) return nil end +---@param expansion WK_Expansion? +---@return string +function Data:GetExpansionDisplayName(expansion) + if not expansion then return "" end + if expansion.id == Enum.ExpansionLevel.Dragonflight then + return L["EXPANSION_DRAGONFLIGHT"] + end + if expansion.id == Enum.ExpansionLevel.WarWithin then + return L["EXPANSION_WAR_WITHIN"] + end + if expansion.id == Enum.ExpansionLevel.Midnight then + return L["EXPANSION_MIDNIGHT"] + end + return expansion.name or "" +end + ---@return WK_SkillLine[] function Data:GetSkillLines() return self.SkillLines @@ -1124,6 +1145,19 @@ function Data:GetSkillLineByID(skillLineID) return nil end +---@param skillLine WK_SkillLine? +---@return string +function Data:GetSkillLineDisplayName(skillLine) + if not skillLine then return "" end + if C_TradeSkillUI and C_TradeSkillUI.GetTradeSkillDisplayName then + local displayName = C_TradeSkillUI.GetTradeSkillDisplayName(skillLine.id) + if displayName and displayName ~= "" then + return displayName + end + end + return skillLine.name or "" +end + ---@return WK_SkillLineVariant[] function Data:GetSkillLineVariants() return self.SkillLineVariants @@ -1140,6 +1174,19 @@ function Data:GetSkillLineVariantByID(skillLineVariantID) return nil end +---@param skillLineVariant WK_SkillLineVariant? +---@return string +function Data:GetSkillLineVariantDisplayName(skillLineVariant) + if not skillLineVariant then return "" end + if C_TradeSkillUI and C_TradeSkillUI.GetTradeSkillDisplayName then + local displayName = C_TradeSkillUI.GetTradeSkillDisplayName(skillLineVariant.id) + if displayName and displayName ~= "" then + return displayName + end + end + return skillLineVariant.name or "" +end + ---@return WK_Objective[] function Data:GetObjectives() return self.Objectives @@ -1161,6 +1208,16 @@ function Data:GetObjectiveCategoryByID(categoryID) return nil end +---@param repeatable string? +---@return string +function Data:GetRepeatableDisplayName(repeatable) + if repeatable == "No" then return L["REPEATABLE_NO"] end + if repeatable == "Weekly" then return L["REPEATABLE_WEEKLY"] end + if repeatable == "Monthly" then return L["REPEATABLE_MONTHLY"] end + if repeatable == "Yes" then return L["REPEATABLE_YES"] end + return repeatable or "" +end + -- Get the progress for all objectives for the current character. function Data:GetAllProgress() local character = self:GetCharacter() diff --git a/Data/ObjectiveCategories.lua b/Data/ObjectiveCategories.lua index d5edff8..e0cc1f6 100644 --- a/Data/ObjectiveCategories.lua +++ b/Data/ObjectiveCategories.lua @@ -2,18 +2,26 @@ local addon = select(2, ...) local Constants = addon.Constants +local L = addon.L ---@class WK_Data local Data = addon.Data +---@param text string +---@param repeatable string +---@return string +local function categoryDescription(text, repeatable) + return text .. "\n\n" .. L["CATEGORY_REPEATABLE_LINE"]:format(WHITE_FONT_COLOR:WrapTextInColorCode(repeatable)) +end + ---@type WK_ObjectiveCategory[] Data.ObjectiveCategories = { - {id = Constants.objectiveCategory.Unique, name = "Uniques", description = "These are one-time items found in treasures around the world and sold by vendors.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("No"), type = "item", repeatable = "No",}, - {id = Constants.objectiveCategory.FirstCraft, name = "First Craft", description = "These are your first craft or first gathering bonuses.\n\nNote: Not every profession or expansion is updated yet.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("No"), type = "recipe", repeatable = "No",}, - {id = Constants.objectiveCategory.Treatise, name = "Treatise", description = "These can be crafted with Inscription. Send a Crafting Order if you don't have the profession.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("Weekly"), type = "item", repeatable = "Weekly", hint = true,}, - {id = Constants.objectiveCategory.WeeklyQuest, name = "Weekly Quest", description = "Complete a quest from your profession trainer or from the Artisan's Consortium.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("Weekly"), type = "quest", repeatable = "Weekly",}, - {id = Constants.objectiveCategory.Treasure, name = "Treasure", description = "These are randomly looted from treasures around the world.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("Weekly"), type = "item", repeatable = "Weekly", hint = true,}, - {id = Constants.objectiveCategory.Gathering, name = "Gathering", description = "These are randomly looted from gathering nodes around the world.\n\nFor Enchanting these are looted from Disenchanting.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("Weekly"), type = "item", repeatable = "Weekly",}, - {id = Constants.objectiveCategory.DarkmoonQuest, name = "Darkmoon", description = "Complete a quest at the Darkmoon Faire.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("Monthly"), type = "quest", repeatable = "Monthly",}, - {id = Constants.objectiveCategory.CatchUp, name = "Catch-Up", description = "Keep track of your catch-up points.\n\nYou will be able to gain these points once you've completed some of the other objectives.\n\nRepeatable: " .. WHITE_FONT_COLOR:WrapTextInColorCode("Yes"), type = "item", repeatable = "Yes",}, + {id = Constants.objectiveCategory.Unique, name = L["CATEGORY_UNIQUE"], legacyName = "Uniques", description = categoryDescription(L["CATEGORY_UNIQUE_DESC"], L["REPEATABLE_NO"]), type = "item", repeatable = "No",}, + {id = Constants.objectiveCategory.FirstCraft, name = L["CATEGORY_FIRST_CRAFT"], legacyName = "First Craft", description = categoryDescription(L["CATEGORY_FIRST_CRAFT_DESC"], L["REPEATABLE_NO"]), type = "recipe", repeatable = "No",}, + {id = Constants.objectiveCategory.Treatise, name = L["CATEGORY_TREATISE"], legacyName = "Treatise", description = categoryDescription(L["CATEGORY_TREATISE_DESC"], L["REPEATABLE_WEEKLY"]), type = "item", repeatable = "Weekly", hint = true,}, + {id = Constants.objectiveCategory.WeeklyQuest, name = L["CATEGORY_WEEKLY_QUEST"], legacyName = "Weekly Quest", description = categoryDescription(L["CATEGORY_WEEKLY_QUEST_DESC"], L["REPEATABLE_WEEKLY"]), type = "quest", repeatable = "Weekly",}, + {id = Constants.objectiveCategory.Treasure, name = L["CATEGORY_TREASURE"], legacyName = "Treasure", description = categoryDescription(L["CATEGORY_TREASURE_DESC"], L["REPEATABLE_WEEKLY"]), type = "item", repeatable = "Weekly", hint = true,}, + {id = Constants.objectiveCategory.Gathering, name = L["CATEGORY_GATHERING"], legacyName = "Gathering", description = categoryDescription(L["CATEGORY_GATHERING_DESC"], L["REPEATABLE_WEEKLY"]), type = "item", repeatable = "Weekly",}, + {id = Constants.objectiveCategory.DarkmoonQuest, name = L["CATEGORY_DARKMOON"], legacyName = "Darkmoon", description = categoryDescription(L["CATEGORY_DARKMOON_DESC"], L["REPEATABLE_MONTHLY"]), type = "quest", repeatable = "Monthly",}, + {id = Constants.objectiveCategory.CatchUp, name = L["CATEGORY_CATCH_UP"], legacyName = "Catch-Up", description = categoryDescription(L["CATEGORY_CATCH_UP_DESC"], L["REPEATABLE_YES"]), type = "item", repeatable = "Yes",}, } diff --git a/Debug/Types/Objectives.lua b/Debug/Types/Objectives.lua index e3823c0..f9a4cdb 100644 --- a/Debug/Types/Objectives.lua +++ b/Debug/Types/Objectives.lua @@ -1,6 +1,7 @@ ---@class WK_ObjectiveCategory ---@field id WK_ObjectiveCategoryId ---@field name string +---@field legacyName string? ---@field description string ---@field type "item" | "quest" | "recipe" ---@field repeatable "No" | "Yes" | "Weekly" | "Monthly" diff --git a/Locales/Init.lua b/Locales/Init.lua new file mode 100644 index 0000000..0723139 --- /dev/null +++ b/Locales/Init.lua @@ -0,0 +1,4 @@ +---@class WK_Addon +local addon = select(2, ...) + +addon.L = addon.libs.AceLocale:GetLocale(addon.name) diff --git a/Locales/enUS.lua b/Locales/enUS.lua new file mode 100644 index 0000000..d36e8f4 --- /dev/null +++ b/Locales/enUS.lua @@ -0,0 +1,86 @@ +---@class WK_Addon +local addon = select(2, ...) + +local L = addon.libs.AceLocale:NewLocale(addon.name, "enUS", true, true) +if not L then return end + +L["TABLE_HEADER_NAME"] = "Name" +L["TABLE_HEADER_REALM"] = "Realm" +L["TABLE_HEADER_LAST_UPDATE"] = "Last Update" +L["TABLE_HEADER_PROFESSION"] = "Profession" +L["TABLE_HEADER_EXPANSION"] = "Expansion" +L["TABLE_HEADER_SKILL"] = "Skill" +L["TABLE_HEADER_CONCENTRATION"] = "Concentration" +L["TABLE_HEADER_KNOWLEDGE"] = "Knowledge" +L["TABLE_HEADER_OBJECTIVE"] = "Objective" +L["TABLE_HEADER_CATEGORY"] = "Category" +L["TABLE_HEADER_LOCATION"] = "Location" +L["TABLE_HEADER_REPEATABLE"] = "Repeat?" +L["TABLE_HEADER_PROGRESS"] = "Progress" +L["TABLE_HEADER_POINTS"] = "Points" + +L["TOOLTIP_NAME"] = "Your characters." +L["TOOLTIP_REALM"] = "Realm names." +L["TOOLTIP_LAST_UPDATE"] = "The last time data was saved for this character." +L["TOOLTIP_PROFESSION"] = "Your professions." +L["TOOLTIP_EXPANSION"] = "Expansion for this profession row." +L["TOOLTIP_SKILL"] = "Current skill levels.\n\nNote: This is only updated when you open the profession window or craft a recipe." +L["TOOLTIP_CONCENTRATION"] = "Current concentration." +L["TOOLTIP_KNOWLEDGE_TITLE"] = "Knowledge Points" +L["TOOLTIP_KNOWLEDGE"] = "Current knowledge gained." + +L["TITLE_CHECKLIST"] = "Checklist" +L["TITLEBAR_CHARACTERS"] = "Characters" +L["TITLEBAR_CHARACTERS_TOOLTIP"] = "Enable/Disable your characters." +L["TITLEBAR_EXPANSION"] = "Expansion" +L["TITLEBAR_EXPANSION_MAIN_TOOLTIP"] = "Filter rows by selected expansions." +L["TITLEBAR_EXPANSION_CHECKLIST_TOOLTIP"] = "Filter table by expansion." +L["TITLEBAR_COLUMNS"] = "Columns" +L["TITLEBAR_COLUMNS_MAIN_TOOLTIP"] = "Enable/Disable table columns." +L["TITLEBAR_COLUMNS_CHECKLIST_TOOLTIP"] = "Toggle columns." +L["TITLEBAR_CHECKLIST"] = "Checklist" +L["TITLEBAR_CHECKLIST_TOOLTIP"] = "Toggle the Checklist window" +L["TITLEBAR_CATEGORIES"] = "Categories" +L["TITLEBAR_CATEGORIES_TOOLTIP"] = "Toggle categories." +L["TITLEBAR_TOGGLE"] = "Toggle List" +L["TITLEBAR_TOGGLE_TOOLTIP"] = "Expand/Collapse the checklist." + +L["SETTING_SHOW_FULL_PROFESSION_NAME"] = "Show full profession name" +L["SETTING_SHOW_FULL_PROFESSION_NAME_TOOLTIP"] = "Show the full profession name with the expansion variant." +L["SETTING_HIDE_LOW_LEVEL_PROFESSIONS"] = "Hide low level professions" +L["SETTING_HIDE_LOW_LEVEL_PROFESSIONS_TOOLTIP"] = "Hide professions with a skill level below 25." +L["SETTING_SHOW_MINIMAP_BUTTON"] = "Show the minimap button" +L["SETTING_SHOW_MINIMAP_BUTTON_TOOLTIP"] = "It does get crowded around the minimap sometimes." +L["SETTING_LOCK_MINIMAP_BUTTON"] = "Lock the minimap button" +L["SETTING_LOCK_MINIMAP_BUTTON_TOOLTIP"] = "No more moving the button around accidentally!" +L["SETTING_HIDE_IN_COMBAT"] = "Hide in combat" +L["SETTING_HIDE_IN_DUNGEONS"] = "Hide in dungeons" +L["SETTING_HIDE_COMPLETED_OBJECTIVES"] = "Hide completed objectives" + +L["CATEGORY_UNIQUE"] = "Uniques" +L["CATEGORY_FIRST_CRAFT"] = "First Craft" +L["CATEGORY_TREATISE"] = "Treatise" +L["CATEGORY_WEEKLY_QUEST"] = "Weekly Quest" +L["CATEGORY_TREASURE"] = "Treasure" +L["CATEGORY_GATHERING"] = "Gathering" +L["CATEGORY_DARKMOON"] = "Darkmoon" +L["CATEGORY_CATCH_UP"] = "Catch-Up" + +L["CATEGORY_UNIQUE_DESC"] = "These are one-time items found in treasures around the world and sold by vendors." +L["CATEGORY_FIRST_CRAFT_DESC"] = "These are your first craft or first gathering bonuses.\n\nNote: Not every profession or expansion is updated yet." +L["CATEGORY_TREATISE_DESC"] = "These can be crafted with Inscription. Send a Crafting Order if you don't have the profession." +L["CATEGORY_WEEKLY_QUEST_DESC"] = "Complete a quest from your profession trainer or from the Artisan's Consortium." +L["CATEGORY_TREASURE_DESC"] = "These are randomly looted from treasures around the world." +L["CATEGORY_GATHERING_DESC"] = "These are randomly looted from gathering nodes around the world.\n\nFor Enchanting these are looted from Disenchanting." +L["CATEGORY_DARKMOON_DESC"] = "Complete a quest at the Darkmoon Faire." +L["CATEGORY_CATCH_UP_DESC"] = "Keep track of your catch-up points.\n\nYou will be able to gain these points once you've completed some of the other objectives." +L["CATEGORY_REPEATABLE_LINE"] = "Repeatable: %s" + +L["REPEATABLE_NO"] = "No" +L["REPEATABLE_WEEKLY"] = "Weekly" +L["REPEATABLE_MONTHLY"] = "Monthly" +L["REPEATABLE_YES"] = "Yes" + +L["EXPANSION_DRAGONFLIGHT"] = "Dragonflight" +L["EXPANSION_WAR_WITHIN"] = "The War Within" +L["EXPANSION_MIDNIGHT"] = "Midnight" diff --git a/Locales/zhCN.lua b/Locales/zhCN.lua new file mode 100644 index 0000000..9a28a7f --- /dev/null +++ b/Locales/zhCN.lua @@ -0,0 +1,86 @@ +---@class WK_Addon +local addon = select(2, ...) + +local L = addon.libs.AceLocale:NewLocale(addon.name, "zhCN") +if not L then return end + +L["TABLE_HEADER_NAME"] = "角色" +L["TABLE_HEADER_REALM"] = "服务器" +L["TABLE_HEADER_LAST_UPDATE"] = "最后更新" +L["TABLE_HEADER_PROFESSION"] = "专业" +L["TABLE_HEADER_EXPANSION"] = "资料片" +L["TABLE_HEADER_SKILL"] = "技能" +L["TABLE_HEADER_CONCENTRATION"] = "专注值" +L["TABLE_HEADER_KNOWLEDGE"] = "知识点" +L["TABLE_HEADER_OBJECTIVE"] = "目标" +L["TABLE_HEADER_CATEGORY"] = "分类" +L["TABLE_HEADER_LOCATION"] = "地点" +L["TABLE_HEADER_REPEATABLE"] = "可重复?" +L["TABLE_HEADER_PROGRESS"] = "进度" +L["TABLE_HEADER_POINTS"] = "点数" + +L["TOOLTIP_NAME"] = "你的角色。" +L["TOOLTIP_REALM"] = "服务器名称。" +L["TOOLTIP_LAST_UPDATE"] = "该角色上次保存数据的时间。" +L["TOOLTIP_PROFESSION"] = "你的专业。" +L["TOOLTIP_EXPANSION"] = "此专业行所属的资料片。" +L["TOOLTIP_SKILL"] = "当前技能等级。\n\n注意:只有在打开专业窗口或制作配方时才会更新。" +L["TOOLTIP_CONCENTRATION"] = "当前专注值。" +L["TOOLTIP_KNOWLEDGE_TITLE"] = "专业知识点" +L["TOOLTIP_KNOWLEDGE"] = "当前已获得的知识点。" + +L["TITLE_CHECKLIST"] = "清单" +L["TITLEBAR_CHARACTERS"] = "角色" +L["TITLEBAR_CHARACTERS_TOOLTIP"] = "启用或禁用你的角色。" +L["TITLEBAR_EXPANSION"] = "资料片" +L["TITLEBAR_EXPANSION_MAIN_TOOLTIP"] = "按选择的资料片筛选行。" +L["TITLEBAR_EXPANSION_CHECKLIST_TOOLTIP"] = "按资料片筛选表格。" +L["TITLEBAR_COLUMNS"] = "列" +L["TITLEBAR_COLUMNS_MAIN_TOOLTIP"] = "启用或禁用表格列。" +L["TITLEBAR_COLUMNS_CHECKLIST_TOOLTIP"] = "切换列显示。" +L["TITLEBAR_CHECKLIST"] = "清单" +L["TITLEBAR_CHECKLIST_TOOLTIP"] = "切换清单窗口" +L["TITLEBAR_CATEGORIES"] = "分类" +L["TITLEBAR_CATEGORIES_TOOLTIP"] = "切换分类显示。" +L["TITLEBAR_TOGGLE"] = "折叠清单" +L["TITLEBAR_TOGGLE_TOOLTIP"] = "展开或折叠清单。" + +L["SETTING_SHOW_FULL_PROFESSION_NAME"] = "显示完整专业名称" +L["SETTING_SHOW_FULL_PROFESSION_NAME_TOOLTIP"] = "显示包含资料片变体的完整专业名称。" +L["SETTING_HIDE_LOW_LEVEL_PROFESSIONS"] = "隐藏低等级专业" +L["SETTING_HIDE_LOW_LEVEL_PROFESSIONS_TOOLTIP"] = "隐藏技能等级低于 25 的专业。" +L["SETTING_SHOW_MINIMAP_BUTTON"] = "显示小地图按钮" +L["SETTING_SHOW_MINIMAP_BUTTON_TOOLTIP"] = "小地图周围有时确实会有点拥挤。" +L["SETTING_LOCK_MINIMAP_BUTTON"] = "锁定小地图按钮" +L["SETTING_LOCK_MINIMAP_BUTTON_TOOLTIP"] = "避免不小心移动按钮。" +L["SETTING_HIDE_IN_COMBAT"] = "战斗中隐藏" +L["SETTING_HIDE_IN_DUNGEONS"] = "地下城中隐藏" +L["SETTING_HIDE_COMPLETED_OBJECTIVES"] = "隐藏已完成目标" + +L["CATEGORY_UNIQUE"] = "一次性" +L["CATEGORY_FIRST_CRAFT"] = "首次制作" +L["CATEGORY_TREATISE"] = "论述" +L["CATEGORY_WEEKLY_QUEST"] = "周常任务" +L["CATEGORY_TREASURE"] = "宝藏" +L["CATEGORY_GATHERING"] = "采集" +L["CATEGORY_DARKMOON"] = "暗月" +L["CATEGORY_CATCH_UP"] = "追赶" + +L["CATEGORY_UNIQUE_DESC"] = "这些是世界各地宝藏中发现或商人出售的一次性物品。" +L["CATEGORY_FIRST_CRAFT_DESC"] = "这些是首次制作或首次采集奖励。\n\n注意:并非所有专业或资料片都已更新。" +L["CATEGORY_TREATISE_DESC"] = "这些可以通过铭文制作。如果你没有该专业,可以发布制造订单。" +L["CATEGORY_WEEKLY_QUEST_DESC"] = "完成专业训练师或匠人商盟提供的任务。" +L["CATEGORY_TREASURE_DESC"] = "这些会从世界各地的宝藏中随机拾取。" +L["CATEGORY_GATHERING_DESC"] = "这些会从世界各地的采集点中随机拾取。\n\n附魔专业则来自分解。" +L["CATEGORY_DARKMOON_DESC"] = "完成暗月马戏团的任务。" +L["CATEGORY_CATCH_UP_DESC"] = "追踪你的追赶点数。\n\n完成部分其它目标后,即可获得这些点数。" +L["CATEGORY_REPEATABLE_LINE"] = "可重复:%s" + +L["REPEATABLE_NO"] = "否" +L["REPEATABLE_WEEKLY"] = "每周" +L["REPEATABLE_MONTHLY"] = "每月" +L["REPEATABLE_YES"] = "是" + +L["EXPANSION_DRAGONFLIGHT"] = "巨龙时代" +L["EXPANSION_WAR_WITHIN"] = "地心之战" +L["EXPANSION_MIDNIGHT"] = "至暗之夜" diff --git a/Modules/Checklist/Module.lua b/Modules/Checklist/Module.lua index ebd75f2..12f54fd 100644 --- a/Modules/Checklist/Module.lua +++ b/Modules/Checklist/Module.lua @@ -7,6 +7,7 @@ addon.Checklist = Checklist local Main = addon.Main local Constants = addon.Constants +local L = addon.L local Data = addon.Data local LibLiqUI = addon.libs.LiqUI local TableContains = LibLiqUI.Utils.TableContains @@ -84,6 +85,30 @@ function Checklist:ToggleWindow() self:Render() end +function Checklist:ApplyWindowTableSize() + if not self.window or not self.window.table then + return + end + + local minWindowWidth = 200 + local maxBodyHeight = 300 - Constants.TITLEBAR_HEIGHT + local getTableContentSize = self.window.table.GetContentSize or self.window.table.GetSize + local contentWidth, contentHeight = getTableContentSize(self.window.table) + local maxBodyWidth = UIParent:GetWidth() - LibLiqUI.Constants.layout.sizes.maxWindowWidthMargin + local scrollbarThickness = LibLiqUI.Constants.layout.sizes.scrollbar.thickness or 10 + local bodyWidth = math.min(math.max(contentWidth, minWindowWidth), maxBodyWidth) + local bodyHeight = math.min(contentHeight, maxBodyHeight) + if contentWidth > bodyWidth then + bodyHeight = math.min(bodyHeight + scrollbarThickness, maxBodyHeight) + end + + local currentBodyWidth = self.window.body and self.window.body:GetWidth() or 0 + local currentBodyHeight = self.window.body and self.window.body:GetHeight() or 0 + if math.abs(currentBodyWidth - bodyWidth) > 0.5 or math.abs(currentBodyHeight - bodyHeight) > 0.5 then + self.window:SetBodySize(bodyWidth, bodyHeight) + end +end + function Checklist:Render() local character = Data:GetCharacter() ---@type WK_TableRowData[] @@ -96,7 +121,7 @@ function Checklist:Render() self.window = LibLiqUI:NewElement("Window", { name = addon.name .. "Checklist", storage = windows.Checklist, - title = "Checklist", + title = L["TITLE_CHECKLIST"], icon = mediaPath .. "Icon.blp", border = 4, overlayFontObject = "SystemFont_Med1", @@ -105,7 +130,7 @@ function Checklist:Render() end, onSettingsMenu = function(window, rootMenu) local showFullProfessionName = rootMenu:CreateCheckbox( - "Show full profession name", + L["SETTING_SHOW_FULL_PROFESSION_NAME"], function() return Data.db.global.showFullProfessionName end, function() Data.db.global.showFullProfessionName = not Data.db.global.showFullProfessionName @@ -117,11 +142,11 @@ function Checklist:Render() ) showFullProfessionName:SetTooltip(function(tooltip, elementDescription) GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)) - GameTooltip_AddNormalLine(tooltip, "Show the full profession name with the expansion variant.") + GameTooltip_AddNormalLine(tooltip, L["SETTING_SHOW_FULL_PROFESSION_NAME_TOOLTIP"]) end) rootMenu:CreateCheckbox( - "Hide in combat", + L["SETTING_HIDE_IN_COMBAT"], function() return Data.db.global.checklist.hideInCombat end, function() Data.db.global.checklist.hideInCombat = not Data.db.global.checklist.hideInCombat @@ -129,7 +154,7 @@ function Checklist:Render() end ) rootMenu:CreateCheckbox( - "Hide in dungeons", + L["SETTING_HIDE_IN_DUNGEONS"], function() return Data.db.global.checklist.hideInDungeons end, function() Data.db.global.checklist.hideInDungeons = not Data.db.global.checklist.hideInDungeons @@ -137,7 +162,7 @@ function Checklist:Render() end ) rootMenu:CreateCheckbox( - "Hide completed objectives", + L["SETTING_HIDE_COMPLETED_OBJECTIVES"], function() return Data.db.global.checklist.hideCompletedObjectives end, function() Data.db.global.checklist.hideCompletedObjectives = not Data.db.global.checklist.hideCompletedObjectives @@ -150,12 +175,12 @@ function Checklist:Render() name = "Expansion", icon = mediaPath .. "Icon_House.blp", iconSize = 14, - tooltipTitle = "Expansion", - tooltipDescription = "Filter table by expansion.", + tooltipTitle = L["TITLEBAR_EXPANSION"], + tooltipDescription = L["TITLEBAR_EXPANSION_CHECKLIST_TOOLTIP"], onMenu = function(_, rootMenu) TableForEach(Data:GetExpansions(), function(expansion) rootMenu:CreateCheckbox( - expansion.name, + Data:GetExpansionDisplayName(expansion), function() return TableContains(Data.db.global.checklist.selectedExpansions, expansion.id) end, function() Data.db.global.checklist.selectedExpansions = TableToggle(Data.db.global.checklist.selectedExpansions, expansion.id) @@ -169,8 +194,8 @@ function Checklist:Render() { name = "Columns", icon = mediaPath .. "Icon_Columns.blp", - tooltipTitle = "Columns", - tooltipDescription = "Toggle columns.", + tooltipTitle = L["TITLEBAR_COLUMNS"], + tooltipDescription = L["TITLEBAR_COLUMNS_CHECKLIST_TOOLTIP"], onMenu = function(_, rootMenu) local hidden = self.window.table.db.hiddenColumns TableForEach(self:GetColumnDefinitions(), function(column) @@ -191,8 +216,8 @@ function Checklist:Render() name = "Categories", icon = mediaPath .. "Icon_Category.blp", iconSize = 11, - tooltipTitle = "Categories", - tooltipDescription = "Toggle categories.", + tooltipTitle = L["TITLEBAR_CATEGORIES"], + tooltipDescription = L["TITLEBAR_CATEGORIES_TOOLTIP"], onMenu = function(_, rootMenu) local hidden = Data.db.global.checklist.hiddenCategories TableForEach(Data.ObjectiveCategories, function(category) @@ -212,8 +237,8 @@ function Checklist:Render() name = "Toggle", icon = mediaPath .. "Icon_Toggle.blp", iconSize = 16, - tooltipTitle = "Toggle List", - tooltipDescription = "Expand/Collapse the checklist.", + tooltipTitle = L["TITLEBAR_TOGGLE"], + tooltipDescription = L["TITLEBAR_TOGGLE_TOOLTIP"], onClick = function() Data.db.global.checklist.hideTable = not Data.db.global.checklist.hideTable self:Render() @@ -231,6 +256,8 @@ function Checklist:Render() enabled = true, sticky = true, height = Constants.TABLE_HEADER_HEIGHT, + resizable = true, + defaultMinColumnWidth = 40, }, rowStyle = { height = Constants.TABLE_ROW_HEIGHT, @@ -265,6 +292,12 @@ function Checklist:Render() return checklistObjectiveIdentityLess(objectiveA, objectiveB) end, }, + scroll = { + horizontal = true, + }, + onLayoutChanged = function() + self:ApplyWindowTableSize() + end, columns = self:GetColumnDefinitions(), } self.window.table = LibLiqUI:NewElement("Table", tableConfig) @@ -343,7 +376,6 @@ function Checklist:Render() self.window.table:SetData(rows) local minWindowWidth = 200 - local maxBodyHeight = 300 - Constants.TITLEBAR_HEIGHT local emptyBodyHeight = 200 - Constants.TITLEBAR_HEIGHT if Data.db.global.checklist.hideTable then @@ -357,10 +389,7 @@ function Checklist:Render() else self.window:HideOverlay() self.window.table:Show() - local bodyWidth, bodyHeight = self.window.table:GetSize() - bodyWidth = math.max(bodyWidth, minWindowWidth) - bodyHeight = math.min(bodyHeight, maxBodyHeight) - self.window:SetBodySize(bodyWidth, bodyHeight) + self:ApplyWindowTableSize() end self.window:SetShown(Data.db.global.checklist.open) diff --git a/Modules/Checklist/TableColumns.lua b/Modules/Checklist/TableColumns.lua index 8b59427..84e13e7 100644 --- a/Modules/Checklist/TableColumns.lua +++ b/Modules/Checklist/TableColumns.lua @@ -2,6 +2,7 @@ local addon = select(2, ...) local Constants = addon.Constants +local L = addon.L ---@class WK_Checklist_TableColumns local TableColumns = {} @@ -74,7 +75,7 @@ function TableColumns.GetDefinitions() local columns = { { id = "objective", - headerText = "Objective", + headerText = L["TABLE_HEADER_OBJECTIVE"], width = 260, sorting = { enabled = true, @@ -92,7 +93,7 @@ function TableColumns.GetDefinitions() }, { id = "profession", - headerText = "Profession", + headerText = L["TABLE_HEADER_PROFESSION"], width = Data.db.global.showFullProfessionName and 160 or 100, hideable = true, sorting = { @@ -101,7 +102,7 @@ function TableColumns.GetDefinitions() local function skillLineNameLower(rowData) local variant = Data:GetSkillLineVariantByID(rowData.skillLineVariantID) local skillLine = variant and Data:GetSkillLineByID(variant.skillLineID or 0) - return skillLine and skillLine.name:lower() or "" + return Data:GetSkillLineDisplayName(skillLine):lower() end local nameA, nameB = skillLineNameLower(rowA), skillLineNameLower(rowB) if nameA ~= nameB then return nameA < nameB end @@ -114,7 +115,7 @@ function TableColumns.GetDefinitions() }, { id = "expansion", - headerText = "Expansion", + headerText = L["TABLE_HEADER_EXPANSION"], width = 120, hideable = true, sorting = { @@ -123,7 +124,7 @@ function TableColumns.GetDefinitions() local function expansionNameLower(rowData) local variant = Data:GetSkillLineVariantByID(rowData.skillLineVariantID) local expansion = variant and Data:GetExpansionByID(variant.expansionID) - return expansion and expansion.name:lower() or "" + return Data:GetExpansionDisplayName(expansion):lower() end local nameA, nameB = expansionNameLower(rowA), expansionNameLower(rowB) if nameA ~= nameB then return nameA < nameB end @@ -136,7 +137,7 @@ function TableColumns.GetDefinitions() }, { id = "category", - headerText = "Category", + headerText = L["TABLE_HEADER_CATEGORY"], width = 80, hideable = true, sorting = { @@ -157,7 +158,7 @@ function TableColumns.GetDefinitions() }, { id = "location", - headerText = "Location", + headerText = L["TABLE_HEADER_LOCATION"], width = 100, hideable = true, sorting = { @@ -175,7 +176,7 @@ function TableColumns.GetDefinitions() }, { id = "repeatable", - headerText = "Repeat?", + headerText = L["TABLE_HEADER_REPEATABLE"], width = 60, hideable = true, sorting = { @@ -183,7 +184,7 @@ function TableColumns.GetDefinitions() compare = function(rowA, rowB) local function repeatableLabel(rowData) local objectiveCategory = Data:GetObjectiveCategoryByID(rowData.objective.categoryID) - return objectiveCategory and objectiveCategory.repeatable or "" + return Data:GetRepeatableDisplayName(objectiveCategory and objectiveCategory.repeatable):lower() end local labelA, labelB = repeatableLabel(rowA), repeatableLabel(rowB) if labelA ~= labelB then return labelA < labelB end @@ -196,7 +197,7 @@ function TableColumns.GetDefinitions() }, { id = "progress", - headerText = "Progress", + headerText = L["TABLE_HEADER_PROGRESS"], width = 70, align = "CENTER", hideable = true, @@ -215,7 +216,7 @@ function TableColumns.GetDefinitions() }, { id = "points", - headerText = "Points", + headerText = L["TABLE_HEADER_POINTS"], width = 70, align = "CENTER", hideable = true, @@ -236,6 +237,8 @@ function TableColumns.GetDefinitions() id = "waypoint", headerText = "", width = 50, + minWidth = 40, + maxWidth = 60, align = "CENTER", sorting = { enabled = false, diff --git a/Modules/Checklist/TableData.lua b/Modules/Checklist/TableData.lua index db45c0c..51c3df0 100644 --- a/Modules/Checklist/TableData.lua +++ b/Modules/Checklist/TableData.lua @@ -157,9 +157,9 @@ local function buildProfessionCell(skillLineVariantID) ---@type LiqUI_TableDataCellExtended return { data = "" } end - text = skillLine.name + text = Data:GetSkillLineDisplayName(skillLine) if Data.db.global.showFullProfessionName then - text = variant.name + text = Data:GetSkillLineVariantDisplayName(variant) end ---@type LiqUI_TableDataCellExtended return { @@ -186,7 +186,7 @@ local function buildExpansionCell(skillLineVariantID) local expansion = skillLineVariant and Data:GetExpansionByID(skillLineVariant.expansionID) ---@type LiqUI_TableDataCellExtended return { - data = expansion and expansion.name or "", + data = Data:GetExpansionDisplayName(expansion), } end @@ -254,7 +254,7 @@ local function buildRepeatableCell(objective) end ---@type LiqUI_TableDataCellExtended return { - data = objectiveCategory.repeatable or "", + data = Data:GetRepeatableDisplayName(objectiveCategory.repeatable), } end diff --git a/Modules/Main/Module.lua b/Modules/Main/Module.lua index 1476997..80cdd06 100644 --- a/Modules/Main/Module.lua +++ b/Modules/Main/Module.lua @@ -6,6 +6,7 @@ local Main = {} addon.Main = Main local Constants = addon.Constants +local L = addon.L local Data = addon.Data local Checklist = addon.Checklist local Helpers = addon.Helpers @@ -46,6 +47,34 @@ function Main:ToggleWindow() self:Render() end +function Main:ApplyWindowTableSize() + if not self.window or not self.window.table then + return + end + + local minWindowWidth = 500 + local maxBodyHeight = Constants.MAX_WINDOW_HEIGHT - Constants.TITLEBAR_HEIGHT + local getTableContentSize = self.window.table.GetContentSize or self.window.table.GetSize + local contentWidth, contentHeight = getTableContentSize(self.window.table) + local maxBodyWidth = UIParent:GetWidth() - LibLiqUI.Constants.layout.sizes.maxWindowWidthMargin + local scrollbarThickness = LibLiqUI.Constants.layout.sizes.scrollbar.thickness or 10 + local bodyWidth = math.min(math.max(contentWidth, minWindowWidth), maxBodyWidth) + local bodyHeight = math.min(contentHeight, maxBodyHeight) + if contentWidth > bodyWidth then + bodyHeight = math.min(bodyHeight + scrollbarThickness, maxBodyHeight) + end + + local currentBodyWidth = self.window.body and self.window.body:GetWidth() or 0 + local currentBodyHeight = self.window.body and self.window.body:GetHeight() or 0 + if math.abs(currentBodyWidth - bodyWidth) > 0.5 or math.abs(currentBodyHeight - bodyHeight) > 0.5 then + self.window:SetBodySize(bodyWidth, bodyHeight) + end + + if self.window.titlebar then + self.window.titlebar.title:SetShown(bodyWidth > minWindowWidth) + end +end + function Main:Render() local selectedExpansions = Data.db.global.main.selectedExpansions or {} local characters = Data:GetCharacters() @@ -68,7 +97,7 @@ function Main:Render() end, onSettingsMenu = function(window, rootMenu) local showFullProfessionName = rootMenu:CreateCheckbox( - "Show full profession name", + L["SETTING_SHOW_FULL_PROFESSION_NAME"], function() return Data.db.global.showFullProfessionName end, function() Data.db.global.showFullProfessionName = not Data.db.global.showFullProfessionName @@ -80,11 +109,11 @@ function Main:Render() ) showFullProfessionName:SetTooltip(function(tooltip, elementDescription) GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)) - GameTooltip_AddNormalLine(tooltip, "Show the full profession name with the expansion variant.") + GameTooltip_AddNormalLine(tooltip, L["SETTING_SHOW_FULL_PROFESSION_NAME_TOOLTIP"]) end) local hideLowLevelProfessions = rootMenu:CreateCheckbox( - "Hide low level professions", + L["SETTING_HIDE_LOW_LEVEL_PROFESSIONS"], function() return Data.db.global.main.hideLowLevelProfessions end, function() Data.db.global.main.hideLowLevelProfessions = not Data.db.global.main.hideLowLevelProfessions @@ -93,11 +122,11 @@ function Main:Render() ) hideLowLevelProfessions:SetTooltip(function(tooltip, elementDescription) GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)) - GameTooltip_AddNormalLine(tooltip, "Hide professions with a skill level below 25.") + GameTooltip_AddNormalLine(tooltip, L["SETTING_HIDE_LOW_LEVEL_PROFESSIONS_TOOLTIP"]) end) local showMinimapIcon = rootMenu:CreateCheckbox( - "Show the minimap button", + L["SETTING_SHOW_MINIMAP_BUTTON"], function() return not Data.db.global.minimap.hide end, function() Data.db.global.minimap.hide = not Data.db.global.minimap.hide @@ -106,11 +135,11 @@ function Main:Render() ) showMinimapIcon:SetTooltip(function(tooltip, elementDescription) GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)) - GameTooltip_AddNormalLine(tooltip, "It does get crowded around the minimap sometimes.") + GameTooltip_AddNormalLine(tooltip, L["SETTING_SHOW_MINIMAP_BUTTON_TOOLTIP"]) end) local lockMinimapIcon = rootMenu:CreateCheckbox( - "Lock the minimap button", + L["SETTING_LOCK_MINIMAP_BUTTON"], function() return Data.db.global.minimap.lock end, function() Data.db.global.minimap.lock = not Data.db.global.minimap.lock @@ -119,7 +148,7 @@ function Main:Render() ) lockMinimapIcon:SetTooltip(function(tooltip, elementDescription) GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)) - GameTooltip_AddNormalLine(tooltip, "No more moving the button around accidentally!") + GameTooltip_AddNormalLine(tooltip, L["SETTING_LOCK_MINIMAP_BUTTON_TOOLTIP"]) end) end, titlebarButtons = { @@ -127,8 +156,8 @@ function Main:Render() name = "Characters", icon = mediaPath .. "Icon_Characters.blp", iconSize = 14, - tooltipTitle = "Characters", - tooltipDescription = "Enable/Disable your characters.", + tooltipTitle = L["TITLEBAR_CHARACTERS"], + tooltipDescription = L["TITLEBAR_CHARACTERS_TOOLTIP"], onMenu = function(_, rootMenu) rootMenu:SetScrollMode(GetScreenHeight() - 20) TableForEach(Data:GetCharacters(), function(character) @@ -151,7 +180,10 @@ function Main:Render() if TableCount(character.professions) > 0 then TableForEach(character.professions, function(characterProfession) local variant = Data:GetSkillLineVariantByID(characterProfession.skillLineVariantID) - local professionName = (variant and variant.name) or "?" + local professionName = Data:GetSkillLineVariantDisplayName(variant) + if professionName == "" then + professionName = "?" + end characterButton:CreateCheckbox( professionName, function() return characterProfession.enabled or false end, @@ -178,12 +210,12 @@ function Main:Render() name = "Expansion", icon = mediaPath .. "Icon_House.blp", iconSize = 14, - tooltipTitle = "Expansion", - tooltipDescription = "Filter rows by selected expansions.", + tooltipTitle = L["TITLEBAR_EXPANSION"], + tooltipDescription = L["TITLEBAR_EXPANSION_MAIN_TOOLTIP"], onMenu = function(_, rootMenu) TableForEach(Data:GetExpansions(), function(expansion) rootMenu:CreateCheckbox( - expansion.name, + Data:GetExpansionDisplayName(expansion), function() return TableContains(Data.db.global.main.selectedExpansions, expansion.id) end, function() Data.db.global.main.selectedExpansions = TableToggle(Data.db.global.main.selectedExpansions, expansion.id) @@ -197,8 +229,8 @@ function Main:Render() { name = "Columns", icon = mediaPath .. "Icon_Columns.blp", - tooltipTitle = "Columns", - tooltipDescription = "Enable/Disable table columns.", + tooltipTitle = L["TITLEBAR_COLUMNS"], + tooltipDescription = L["TITLEBAR_COLUMNS_MAIN_TOOLTIP"], onMenu = function(_, rootMenu) local hidden = self.window.table.db.hiddenColumns TableForEach(self:GetColumnDefinitions(), function(column) @@ -219,8 +251,8 @@ function Main:Render() name = "Checklist", icon = mediaPath .. "Icon_Checklist.blp", iconSize = 16, - tooltipTitle = "Checklist", - tooltipDescription = "Toggle the Checklist window", + tooltipTitle = L["TITLEBAR_CHECKLIST"], + tooltipDescription = L["TITLEBAR_CHECKLIST_TOOLTIP"], onClick = function() Checklist:ToggleWindow() self:Render() @@ -238,6 +270,8 @@ function Main:Render() enabled = true, sticky = true, height = Constants.TABLE_HEADER_HEIGHT, + resizable = true, + defaultMinColumnWidth = 40, }, rowStyle = { height = Constants.TABLE_ROW_HEIGHT, @@ -268,6 +302,12 @@ function Main:Render() return (rowA.skillLineVariantID or 0) < (rowB.skillLineVariantID or 0) end, }, + scroll = { + horizontal = true, + }, + onLayoutChanged = function() + self:ApplyWindowTableSize() + end, columns = self:GetColumnDefinitions(), } self.window.table = LibLiqUI:NewElement("Table", tableConfig) @@ -304,7 +344,6 @@ function Main:Render() self.window.table:SetData(rows) local minWindowWidth = 500 - local maxBodyHeight = Constants.MAX_WINDOW_HEIGHT - Constants.TITLEBAR_HEIGHT local emptyBodyHeight = 250 - Constants.TITLEBAR_HEIGHT if rowCount == 0 then @@ -317,13 +356,7 @@ function Main:Render() else self.window:HideOverlay() self.window.table:Show() - local bodyWidth, bodyHeight = self.window.table:GetSize() - bodyWidth = math.max(bodyWidth, minWindowWidth) - bodyHeight = math.min(bodyHeight, maxBodyHeight) - self.window:SetBodySize(bodyWidth, bodyHeight) - if self.window.titlebar then - self.window.titlebar.title:SetShown(bodyWidth > minWindowWidth) - end + self:ApplyWindowTableSize() end end diff --git a/Modules/Main/TableColumns.lua b/Modules/Main/TableColumns.lua index 726f5dc..05d8a3c 100644 --- a/Modules/Main/TableColumns.lua +++ b/Modules/Main/TableColumns.lua @@ -2,6 +2,7 @@ local addon = select(2, ...) local Constants = addon.Constants +local L = addon.L ---@class WK_Main_TableColumns local TableColumns = {} @@ -20,11 +21,11 @@ function TableColumns.GetDefinitions() local columns = { { id = "name", - headerText = "Name", + headerText = L["TABLE_HEADER_NAME"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Name", 1, 1, 1) - GameTooltip:AddLine("Your characters.") + GameTooltip:SetText(L["TABLE_HEADER_NAME"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_NAME"]) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -41,11 +42,11 @@ function TableColumns.GetDefinitions() }, { id = "realm", - headerText = "Realm", + headerText = L["TABLE_HEADER_REALM"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Realm", 1, 1, 1) - GameTooltip:AddLine("Realm names.") + GameTooltip:SetText(L["TABLE_HEADER_REALM"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_REALM"]) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -62,11 +63,11 @@ function TableColumns.GetDefinitions() }, { id = "lastUpdate", - headerText = "Last Update", + headerText = L["TABLE_HEADER_LAST_UPDATE"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Last Update", 1, 1, 1) - GameTooltip:AddLine("The last time data was saved for this character.", nil, nil, nil, true) + GameTooltip:SetText(L["TABLE_HEADER_LAST_UPDATE"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_LAST_UPDATE"], nil, nil, nil, true) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -85,11 +86,11 @@ function TableColumns.GetDefinitions() }, { id = "profession", - headerText = "Profession", + headerText = L["TABLE_HEADER_PROFESSION"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Profession", 1, 1, 1) - GameTooltip:AddLine("Your professions.") + GameTooltip:SetText(L["TABLE_HEADER_PROFESSION"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_PROFESSION"]) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -103,7 +104,7 @@ function TableColumns.GetDefinitions() local function skillLineNameLower(rowData) local variant = Data:GetSkillLineVariantByID(rowData.skillLineVariantID) local skillLine = variant and Data:GetSkillLineByID(variant.skillLineID or 0) - return skillLine and skillLine.name:lower() or "" + return Data:GetSkillLineDisplayName(skillLine):lower() end local nameA, nameB = skillLineNameLower(rowA), skillLineNameLower(rowB) if nameA ~= nameB then return nameA < nameB end @@ -113,11 +114,11 @@ function TableColumns.GetDefinitions() }, { id = "expansion", - headerText = "Expansion", + headerText = L["TABLE_HEADER_EXPANSION"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Expansion", 1, 1, 1) - GameTooltip:AddLine("Expansion for this profession row.") + GameTooltip:SetText(L["TABLE_HEADER_EXPANSION"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_EXPANSION"]) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -131,7 +132,7 @@ function TableColumns.GetDefinitions() local function expansionNameLower(rowData) local variant = Data:GetSkillLineVariantByID(rowData.skillLineVariantID) local expansion = variant and Data:GetExpansionByID(variant.expansionID) - return expansion and expansion.name:lower() or "" + return Data:GetExpansionDisplayName(expansion):lower() end local nameA, nameB = expansionNameLower(rowA), expansionNameLower(rowB) if nameA ~= nameB then return nameA < nameB end @@ -141,11 +142,11 @@ function TableColumns.GetDefinitions() }, { id = "skill", - headerText = "Skill", + headerText = L["TABLE_HEADER_SKILL"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Skill", 1, 1, 1) - GameTooltip:AddLine("Current skill levels.\n\nNote: This is only updated when you open the profession window or craft a recipe.", nil, nil, nil, true) + GameTooltip:SetText(L["TABLE_HEADER_SKILL"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_SKILL"], nil, nil, nil, true) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -168,11 +169,11 @@ function TableColumns.GetDefinitions() }, { id = "concentration", - headerText = "Concentration", + headerText = L["TABLE_HEADER_CONCENTRATION"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Concentration", 1, 1, 1) - GameTooltip:AddLine("Current concentration.") + GameTooltip:SetText(L["TABLE_HEADER_CONCENTRATION"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_CONCENTRATION"]) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) @@ -193,11 +194,11 @@ function TableColumns.GetDefinitions() }, { id = "knowledge", - headerText = "Knowledge", + headerText = L["TABLE_HEADER_KNOWLEDGE"], onEnter = function(cellFrame, columnIndex, columnId, column) GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText("Knowledge Points", 1, 1, 1) - GameTooltip:AddLine("Current knowledge gained.") + GameTooltip:SetText(L["TOOLTIP_KNOWLEDGE_TITLE"], 1, 1, 1) + GameTooltip:AddLine(L["TOOLTIP_KNOWLEDGE"]) GameTooltip:Show() end, onLeave = function(cellFrame, columnIndex, columnId, column) diff --git a/Modules/Main/TableData.lua b/Modules/Main/TableData.lua index d61fcaf..0dc4c42 100644 --- a/Modules/Main/TableData.lua +++ b/Modules/Main/TableData.lua @@ -117,9 +117,9 @@ local function buildProfessionCell(character, skillLineVariantID) ---@type LiqUI_TableDataCellExtended return { data = "" } end - local text = skillLine.name + local text = Data:GetSkillLineDisplayName(skillLine) if Data.db.global.showFullProfessionName then - text = variant.name + text = Data:GetSkillLineVariantDisplayName(variant) end ---@type LiqUI_TableDataCellExtended return { @@ -157,7 +157,7 @@ local function buildExpansionCell(skillLineVariantID) return { data = "" } end ---@type LiqUI_TableDataCellExtended - return { data = expansion.name } + return { data = Data:GetExpansionDisplayName(expansion) } end ---@param characterProfession WK_CharacterProfession @@ -315,7 +315,7 @@ local function buildKnowledgeCell(characterProfession, skillLineVariantID) end GameTooltip:SetOwner(cellFrame, "ANCHOR_RIGHT") - GameTooltip:SetText(skillLineVariant and skillLineVariant.name or "", 1, 1, 1) + GameTooltip:SetText(Data:GetSkillLineVariantDisplayName(skillLineVariant), 1, 1, 1) GameTooltip:AddDoubleLine("Points Spent:", pointsSpentValue, nil, nil, nil, pointsSpentColor.r, pointsSpentColor.g, pointsSpentColor.b) GameTooltip:AddDoubleLine("Points Unspent:", pointsUnspentValue, nil, nil, nil, pointsUnspentColor.r, pointsUnspentColor.g, pointsUnspentColor.b) GameTooltip:AddDoubleLine("Max:", pointsMaxValue, nil, nil, nil, pointsMaxColor.r, pointsMaxColor.g, pointsMaxColor.b) diff --git a/WeeklyKnowledge.lua b/WeeklyKnowledge.lua index 32b638e..ef2b579 100644 --- a/WeeklyKnowledge.lua +++ b/WeeklyKnowledge.lua @@ -18,6 +18,8 @@ addon.debug = false --@end-debug@ function Core:Render() + addon.Main:ApplyTableColumns() + addon.Checklist:ApplyTableColumns() addon.Main:Render() addon.Checklist:Render() end @@ -62,6 +64,8 @@ function Core:OnInitialize() Data:InitDB() Data:MigrateDB() + LibLiqUI.Constants.layout.media.iconSettings = "Interface/AddOns/WeeklyKnowledge/Media/Icon_Settings.blp" + LibLiqUI.Constants.layout.media.iconClose = "Interface/AddOns/WeeklyKnowledge/Media/Icon_Close.blp" if Data:TaskWeeklyReset() then self:Print("Weekly Reset: Good job! Progress of your characters have been reset for a new week.") end diff --git a/WeeklyKnowledge.toc b/WeeklyKnowledge.toc index 3fc6916..8173bd4 100644 --- a/WeeklyKnowledge.toc +++ b/WeeklyKnowledge.toc @@ -30,11 +30,15 @@ Libs\AceEvent-3.0\AceEvent-3.0.xml Libs\AceTimer-3.0\AceTimer-3.0.xml Libs\AceBucket-3.0\AceBucket-3.0.xml Libs\AceDB-3.0\AceDB-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 Boot.lua +Locales\enUS.lua +Locales\zhCN.lua +Locales\Init.lua Constants.lua Helpers.lua Data.lua