Skip to content

Commit

Permalink
Added full localization support
Browse files Browse the repository at this point in the history
  • Loading branch information
Larsj02 committed May 22, 2024
1 parent 367cf3f commit 91fa8cd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
28 changes: 14 additions & 14 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ local function itemListInitializer(frame, data)

local state, color
if exInf.locType == "EQUIP_SOCKET" then
state, color = "Socketed", const.COLORS.POSITIVE
state, color = addon.Loc["Socketed"], const.COLORS.POSITIVE
elseif exInf.locType == "BAG_GEM" then
state, color = "In Bag", const.COLORS.NEUTRAL
state, color = addon.Loc["In Bag"], const.COLORS.NEUTRAL
elseif exInf.locType == "BAG_SOCKET" then
state, color = "In Bag Item!", const.COLORS.NEGATIVE
state, color = addon.Loc["In Bag Item!"], const.COLORS.NEGATIVE
else
state, color = "Uncollected", const.COLORS.GREY
name = color:WrapTextInColorCode(name)
Expand Down Expand Up @@ -151,15 +151,15 @@ local function createScrapFrame()
local scrapBagItems = uiElements:CreateBaseFrame(ScrappingMachineFrame, {
frameStyle = "Flat",
height = 250,
title = "Scrappable ",
title = addon.Loc["Scrappable Items"],
points = {
{ "TOPLEFT", ScrappingMachineFrame, "BOTTOMLEFT", 0, -2 },
{ "TOPRIGHT", ScrappingMachineFrame, "BOTTOMRIGHT", 0, -2 },
}
})
local scrapItemsText = scrapBagItems:CreateFontString()
scrapItemsText:SetFontObject(const.FONT_OBJECTS.HEADING)
scrapItemsText:SetText("NOTHING TO SCRAP")
scrapItemsText:SetText(addon.Loc["NOTHING TO SCRAP"])
scrapItemsText:SetPoint("CENTER", 0, -10)
scrapItemsText:Hide()
local allPointsScrap = {
Expand Down Expand Up @@ -202,7 +202,7 @@ local function createFrame()

---@class ResocketPopup:BaseFrame
local resocketPopup = uiElements:CreateBaseFrame(UIParent, {
title = "Resocket Gems",
title = addon.Loc["Resocket Gems"],
height = 150,
width = 300,
points = { { "CENTER" } },
Expand Down Expand Up @@ -267,7 +267,7 @@ local function createFrame()
frameToggle:SetScript("OnEnter", function(self)
GameTooltip:ClearLines()
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT")
GameTooltip:AddLine(string.format("Toggle the %s UI", const.ADDON_NAME), 1, 1, 1)
GameTooltip:AddLine(string.format(addon.Loc["Toggle the %s UI"], const.ADDON_NAME), 1, 1, 1)
GameTooltip:Show()
end)
frameToggle:SetScript("OnLeave", function()
Expand All @@ -280,7 +280,7 @@ local function createFrame()
---@class SearchFrame : EditBox
---@field Instructions FontString
local search = CreateFrame("EditBox", nil, gems, "InputBoxInstructionsTemplate")
search.Instructions:SetText("Search Gems")
search.Instructions:SetText(addon.Loc["Search Gems"])
search:ClearFocus()
search:SetAutoFocus(false)
search:SetPoint("TOPRIGHT", gems.TopTileStreaks, -5, -15)
Expand Down Expand Up @@ -315,17 +315,17 @@ local function createFrame()

local showUnowned = uiElements:CreateCheckButton(gems, {
point = { "BOTTOMRIGHT", -75, 7.5 },
text = "Unowned",
tooltip = "Show Unowned Gems in the List.",
text = addon.Loc["Unowned"],
tooltip = addon.Loc["Show Unowned Gems in the List."],
onClick = function(self)
addon:SetDatabaseValue("show_unowned", self:GetChecked())
end
})

local showPrimordial = uiElements:CreateCheckButton(gems, {
point = { "BOTTOMRIGHT", -175, 7.5 },
text = "Primordial",
tooltip = "Show Primordial Gems in the List.",
text = addon.Loc["Primordial"],
tooltip = addon.Loc["Show Primordial Gems in the List."],
onClick = function(self)
addon:SetDatabaseValue("show_primordial", self:GetChecked())
end
Expand All @@ -334,15 +334,15 @@ local function createFrame()
local openBagItems = uiElements:CreateBaseFrame(gems, {
frameStyle = "Flat",
height = 150,
title = "Open, Use and Combine",
title = addon.Loc["Open, Use and Combine"],
points = {
{ "TOPLEFT", gems, "BOTTOMLEFT", 0, -2 },
{ "TOPRIGHT", gems, "BOTTOMRIGHT", 0, -2 },
}
})
local openBagText = openBagItems:CreateFontString()
openBagText:SetFontObject(const.FONT_OBJECTS.HEADING)
openBagText:SetText("NOTHING TO USE")
openBagText:SetText(addon.Loc["NOTHING TO USE"])
openBagText:SetPoint("CENTER", 0, -10)
openBagText:Hide()
local allPointsAnchorPoints = {
Expand Down
17 changes: 17 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ Private.Locales["enUS"] = {
["Rank"] = "Rank",

-- Core.lua
["Socketed"] = "Socketed",
["In Bag"] = "In Bag",
["In Bag Item!"] = "In Bag Item!",
["Scrappable Items"] = "Scrappable Items",
["NOTHING TO SCRAP"] = "NOTHING TO SCRAP",
["Resocket Gems"] = "Resocket Gems",
["Toggle the %s UI"] = "Toggle the %s UI", -- %s is the Addon name and needs to be included!
["Search Gems"] = "Search Gems",
["Unowned"] = "Unowned",
["Show Unowned Gems in the List."] = "Show Unowned Gems in the List.",
["Primordial"] = "Primordial",
["Show Primordial Gems in the List."] = "Show Primordial Gems in the List.",
["Open, Use and Combine"] = "Open, Use and Combine",
["NOTHING TO USE"] = "NOTHING TO USE",
["HelpText"] = "|A:newplayertutorial-icon-mouse-leftbutton:16:16|a Click a Gem in this list to Socket or Unsocket.\n" ..
"'In Bag Item' or 'Socketed' indicates that you unsocket it.\n" ..
"'In Bag' indicates that the Gem is in your bag and ready to be socketed.\n\n" ..
Expand All @@ -18,4 +32,7 @@ Private.Locales["enUS"] = {
"You should see an icon in the top right of your character frame which can be used to hide or show this frame.\n" ..
"Below the Gem list you should have some clickable buttons to quickly open Chests or combine Gems\n\n" ..
"And to get rid of this frame simply shift click it.\nHave fun!",

-- UIElements.lua
["You don't have a valid free Slot for this Gem"] = "You don't have a valid free Slot for this Gem",
}
3 changes: 2 additions & 1 deletion UIElements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local Private = select(2, ...)
local const = Private.constants
local gemUtil = Private.GemUtil
local misc = Private.Misc
local addon = Private.Addon

local uiElements = {}
Private.UIElements = uiElements
Expand All @@ -29,7 +30,7 @@ local function extractPostClick(self)
if info.locType == "BAG_GEM" then
ClearCursor()
if not info.freeSlot then
misc:PrintError("You don't have a valid free Slot for this Gem")
misc:PrintError(addon.Loc["You don't have a valid free Slot for this Gem"])
CloseSocketInfo()
return
end
Expand Down

0 comments on commit 91fa8cd

Please sign in to comment.