Move FrameXML format-string globals to the locale layer

Source the strings FormattingUtil/TimeUtil consume (LARGE_NUMBER_SEPERATOR,
PERCENTAGE_STRING, GOLD/SILVER/COPPER_AMOUNT_SYMBOL, the time
abbreviations + D_* + *_ONELETTER_ABBR, clock formats) from Classic Era
enUS GlobalStrings and define them in locales/enUS.lua, which loads
before the Util files. `or`-guarded so any value the 1.12 client already
defines is preserved (the time abbrevs use |4 plural tokens, which 1.12
supports — our existing ITEMS_* strings already rely on |4).

The Util files no longer define these (single source of truth in the
locale layer); they retain only the non-locale numeric constants
(COPPER_PER_*, SECONDS_PER_*) and the formatting logic. FormatUnit still
inserts the count whether the unit string carries a %d or is a bare label.
This commit is contained in:
Brues
2026-06-21 18:17:17 -05:00
parent a0ebfe99b4
commit d80d87e28b
3 changed files with 29 additions and 29 deletions
+3 -10
View File
@@ -5,21 +5,14 @@
-- The currency/cost helpers (C_CurrencyInfo etc.) are omitted. GetMoneyString
-- uses text symbols, not coin texture markup (markup doesn't render in 1.12).
--
-- FrameXML format-string globals are defined with `or` fallbacks so we
-- honor a native/localized value when present and degrade sanely otherwise.
LARGE_NUMBER_SEPERATOR = LARGE_NUMBER_SEPERATOR or ",";
PERCENTAGE_STRING = PERCENTAGE_STRING or "%d%%";
GENERIC_FRACTION_STRING = GENERIC_FRACTION_STRING or "%d/%d";
-- The FrameXML format-string globals these functions consume
-- (LARGE_NUMBER_SEPERATOR, PERCENTAGE_STRING, GOLD_AMOUNT_SYMBOL, …) are
-- defined in the locale layer (locales/enUS.lua), which loads first.
COPPER_PER_SILVER = 100;
SILVER_PER_GOLD = 100;
COPPER_PER_GOLD = COPPER_PER_SILVER * SILVER_PER_GOLD;
GOLD_AMOUNT_SYMBOL = GOLD_AMOUNT_SYMBOL or "g";
SILVER_AMOUNT_SYMBOL = SILVER_AMOUNT_SYMBOL or "s";
COPPER_AMOUNT_SYMBOL = COPPER_AMOUNT_SYMBOL or "c";
function FormatLargeNumber(amount)
amount = tostring(amount);
local newDisplay = "";
+4 -19
View File
@@ -6,9 +6,10 @@
-- SecondsFormatterMixin (the modern replacement) is omitted — it's a heavy
-- mixin class little addon code targets on classic.
--
-- 5.0 notes: `%` -> math.mod, `s:format()` -> string.format. FrameXML
-- format-string globals get `or` fallbacks so native/localized values win
-- when present.
-- 5.0 notes: `%` -> math.mod, `s:format()` -> string.format. The FrameXML
-- format-string globals these functions consume (DAYS_ABBR, D_HOURS,
-- HOURS_MINUTES_SECONDS, the *_ONELETTER_ABBR set, …) are defined in the
-- locale layer (locales/enUS.lua), which loads first.
SECONDS_PER_MIN = 60;
SECONDS_PER_HOUR = 60 * SECONDS_PER_MIN;
@@ -16,22 +17,6 @@ SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
SECONDS_PER_MONTH = 30 * SECONDS_PER_DAY;
SECONDS_PER_YEAR = 12 * SECONDS_PER_MONTH;
D_DAYS = D_DAYS or "%d Days";
D_HOURS = D_HOURS or "%d Hours";
D_MINUTES = D_MINUTES or "%d Minutes";
D_SECONDS = D_SECONDS or "%d Seconds";
DAYS_ABBR = DAYS_ABBR or "%d Day(s)";
HOURS_ABBR = HOURS_ABBR or "%d Hr";
MINUTES_ABBR = MINUTES_ABBR or "%d Min";
SECONDS_ABBR = SECONDS_ABBR or "%d Sec";
DAY_ONELETTER_ABBR = DAY_ONELETTER_ABBR or "%d d";
HOUR_ONELETTER_ABBR = HOUR_ONELETTER_ABBR or "%d h";
MINUTE_ONELETTER_ABBR = MINUTE_ONELETTER_ABBR or "%d m";
SECOND_ONELETTER_ABBR = SECOND_ONELETTER_ABBR or "%d s";
TIME_UNIT_DELIMITER = TIME_UNIT_DELIMITER or " ";
HOURS_MINUTES_SECONDS = HOURS_MINUTES_SECONDS or "%d:%02d:%02d";
MINUTES_SECONDS = MINUTES_SECONDS or "%d:%02d";
function SecondsToMinutes(seconds)
return seconds / SECONDS_PER_MIN;
end
+22
View File
@@ -15,3 +15,25 @@ SLASH_EQUIP_SET2 = "/equipset";
SLASH_FOCUS1 = "/focus";
SLASH_FOCUS2 = "/focus";
TARGETFOCUS = "Target Focus";
LARGE_NUMBER_SEPERATOR = LARGE_NUMBER_SEPERATOR or ",";
PERCENTAGE_STRING = PERCENTAGE_STRING or "%d%%";
GENERIC_FRACTION_STRING = GENERIC_FRACTION_STRING or "%d/%d";
GOLD_AMOUNT_SYMBOL = GOLD_AMOUNT_SYMBOL or "g";
SILVER_AMOUNT_SYMBOL = SILVER_AMOUNT_SYMBOL or "s";
COPPER_AMOUNT_SYMBOL = COPPER_AMOUNT_SYMBOL or "c";
TIME_UNIT_DELIMITER = TIME_UNIT_DELIMITER or " ";
HOURS_MINUTES_SECONDS = HOURS_MINUTES_SECONDS or "%.2d:%.2d:%.2d";
MINUTES_SECONDS = MINUTES_SECONDS or "%.2d:%.2d";
DAYS_ABBR = DAYS_ABBR or "%d |4Day:Days;";
HOURS_ABBR = HOURS_ABBR or "%d |4Hr:Hr;";
MINUTES_ABBR = MINUTES_ABBR or "%d |4Min:Min;";
SECONDS_ABBR = SECONDS_ABBR or "%d |4Sec:Sec;";
D_DAYS = D_DAYS or "%d |4Day:Days;";
D_HOURS = D_HOURS or "%d |4Hour:Hours;";
D_MINUTES = D_MINUTES or "%d |4Minute:Minutes;";
D_SECONDS = D_SECONDS or "%d |4Second:Seconds;";
DAY_ONELETTER_ABBR = DAY_ONELETTER_ABBR or "%d d";
HOUR_ONELETTER_ABBR = HOUR_ONELETTER_ABBR or "%d h";
MINUTE_ONELETTER_ABBR = MINUTE_ONELETTER_ABBR or "%d m";
SECOND_ONELETTER_ABBR = SECOND_ONELETTER_ABBR or "%d s";