feat(addons): zhCN localization for ClassicAPI_DebugTools and 6 missing globals fix (#141)

* feat(debugtools): add zhCN localization for ClassicAPI_DebugTools

* fix(locales): add 6 missing global strings to zhCN

* feat(debugtools): clean up slash command dispatch and add help subcommand

* fix(debugtools): use %s instead of %d in PROFILER_CALLS_FORMAT

ns.Count() always returns a string (either a formatted number or '-'),
never a number. Feeding it to %d causes format() to throw. Change the
locale template to %s so both '-', '1,234', etc. render correctly.

* fix(debugtools): repair regressions from the localization pass

- XML labels: 1.12's Button/FontString loader passes the text attribute
  verbatim to FrameScript_GetText (0x703BF0), which reads the global of
  exactly that name and falls back to the raw value. Nothing strips
  "$...$", so text="$TI_SHOW$" rendered as literal "$TI_SHOW$". Use the
  bare global name, as stock FrameXML does.
- Tabs: ns.AddTab(name, label) keeps a fixed English key for ns.ShowIn
  and a separate localized button label. Keying tabs by the translated
  name made ShowIn("Globals") return nil and error on a zhCN client.
- Frames tab state: restore visible / "shown, parent hidden" / hidden.
  The inverted branch reported a shown frame under a hidden parent as
  hidden and made the third state unreachable.
- /profiler: unknown or incomplete subcommands print the usage again
  instead of doing nothing.
- Deep Tracking / CPU Profiling buttons: split the label from ON/OFF so
  the state keeps its accent / grey colour.
- Restore the gap between owner and CPU time in the frame-stack and
  Frames-tab tooltips, and the leading space of " (replaced)".
- zhCN: ADDON_OPTIONS titles the shared Interface Options panel and the
  game-menu button, not ClassicAPI's own settings; revert to 插件设置.

---------

Co-authored-by: jilinge <jilinge@users.noreply.github.com>
Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
This commit is contained in:
jilinge
2026-11-13 10:33:01 -06:00
committed by GitHub
co-authored by jilinge Brues
parent d689aab94c
commit 8e721237f6
17 changed files with 584 additions and 159 deletions
@@ -12,7 +12,7 @@ function ns.AddFrameStackLines(tooltip, region)
local frame = region.GetScript and region or region:GetParent()
tooltip:AddLine(" ")
Line(tooltip, "Owner", ns.OwnerLabel(ns.Owner(region)))
Line(tooltip, PROFILER_LABEL_OWNER, ns.OwnerLabel(ns.Owner(region)))
if not frame then return end
for _, script in ipairs({ "OnUpdate", "OnEvent" }) do
@@ -21,7 +21,7 @@ function ns.AddFrameStackLines(tooltip, region)
local text = ns.OwnerLabel(ns.Owner(fn))
if ns.profiling then
local ms, calls = GetFunctionCPUUsage(fn)
text = text .. ns.GREY .. " " .. ns.MS(ms) .. " in " .. ns.Count(calls) .. " calls"
text = text .. ns.GREY .. " " .. ns.MS(ms) .. format(PROFILER_CALLS_FORMAT, ns.Count(calls))
end
Line(tooltip, script, text)
end
@@ -29,11 +29,11 @@ function ns.AddFrameStackLines(tooltip, region)
if ns.profiling then
local ms, calls = GetFrameCPUUsage(frame, false)
Line(tooltip, "All scripts", ns.MS(ms) .. ns.GREY .. " in " .. ns.Count(calls) .. " calls")
Line(tooltip, PROFILER_LABEL_ALL_SCRIPTS, ns.MS(ms) .. ns.GREY .. format(PROFILER_CALLS_FORMAT, ns.Count(calls)))
end
local rec = ns.track.frames[frame]
if rec and (rec.hookedUpdate or rec.hookedEvent) then
Line(tooltip, "Allocated", ns.KB(rec.alloc) .. ns.GREY .. " (" .. ns.KBRate(rec.allocRate) .. ")")
Line(tooltip, PROFILER_LABEL_ALLOCATED, ns.KB(rec.alloc) .. ns.GREY .. " (" .. ns.KBRate(rec.allocRate) .. ")")
end
end