mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-15 23:50:38 +00:00
* 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>
40 lines
1.4 KiB
Lua
40 lines
1.4 KiB
Lua
-- /fstack: the owner, script CPU time and allocations of the highlighted
|
|
-- frame, which FrameStackTooltip_OnTooltipSetFrameStack adds to the tooltip.
|
|
local _, ns = ...
|
|
|
|
local function Line(tooltip, left, right)
|
|
tooltip:AddDoubleLine(left, right, .2, 1, .8, 1, 1, 1)
|
|
end
|
|
|
|
function ns.AddFrameStackLines(tooltip, region)
|
|
if not region then return end
|
|
-- a texture or font string runs no scripts: report its frame's
|
|
local frame = region.GetScript and region or region:GetParent()
|
|
|
|
tooltip:AddLine(" ")
|
|
Line(tooltip, PROFILER_LABEL_OWNER, ns.OwnerLabel(ns.Owner(region)))
|
|
if not frame then return end
|
|
|
|
for _, script in ipairs({ "OnUpdate", "OnEvent" }) do
|
|
local fn = frame:GetScript(script)
|
|
if fn then
|
|
local text = ns.OwnerLabel(ns.Owner(fn))
|
|
if ns.profiling then
|
|
local ms, calls = GetFunctionCPUUsage(fn)
|
|
text = text .. ns.GREY .. " " .. ns.MS(ms) .. format(PROFILER_CALLS_FORMAT, ns.Count(calls))
|
|
end
|
|
Line(tooltip, script, text)
|
|
end
|
|
end
|
|
|
|
if ns.profiling then
|
|
local ms, calls = GetFrameCPUUsage(frame, false)
|
|
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, PROFILER_LABEL_ALLOCATED, ns.KB(rec.alloc) .. ns.GREY .. " (" .. ns.KBRate(rec.allocRate) .. ")")
|
|
end
|
|
end
|