From 7778ccb157b2ac06dfa407199011865db9eed554 Mon Sep 17 00:00:00 2001 From: ThatHunky Date: Sat, 4 Jul 2026 08:57:06 +0000 Subject: [PATCH] Apply HUD clock time format for any mod language, not just Thai The DayTimeMoneyBox draw patch that renders the HUD clock using the mod language's time format was gated behind a hardcoded check for ELL.StardewValleyTHAI. Any other custom language (e.g. the Ukrainian translation Pereclaw.ukrainizacija) fell through to the vanilla mobile switch, which has no LanguageCode.mod case and renders a 12-hour clock with no AM/PM marker. Changes: - ModEntry: enable the patch whenever the loaded mod language defines a ClockTimeFormat or TimeFormat, instead of matching the Thai pack ID - DayTimeMoneyBoxThaiFormat: prefer ClockTimeFormat for the HUD clock (matching desktop DayTimeMoneyBox behavior), fall back to TimeFormat --- DayTimeMoneyBoxThaiFormat.cs | 9 +++++++-- ModEntry.cs | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/DayTimeMoneyBoxThaiFormat.cs b/DayTimeMoneyBoxThaiFormat.cs index 8d87a3b..f6e58fe 100644 --- a/DayTimeMoneyBoxThaiFormat.cs +++ b/DayTimeMoneyBoxThaiFormat.cs @@ -51,8 +51,13 @@ public static void PrefixDrawTextWithShadow(SpriteBatch b, ref string text, Spri //line:297: Utility.drawTextWithShadow(b, dateText, if (CallStack_drawTextWithShadow_Count == 2) { - text = LocalizedContentManager.FormatTimeString(Game1.timeOfDay, - LocalizedContentManager.CurrentModLanguage.TimeFormat).ToString(); + // the HUD clock should use ClockTimeFormat (like desktop DayTimeMoneyBox does), + // falling back to TimeFormat if the language pack doesn't define it + var modLanguage = LocalizedContentManager.CurrentModLanguage; + var format = !string.IsNullOrWhiteSpace(modLanguage.ClockTimeFormat) + ? modLanguage.ClockTimeFormat + : modLanguage.TimeFormat; + text = LocalizedContentManager.FormatTimeString(Game1.timeOfDay, format).ToString(); } } diff --git a/ModEntry.cs b/ModEntry.cs index 5489cab..1242f1a 100644 --- a/ModEntry.cs +++ b/ModEntry.cs @@ -44,10 +44,12 @@ private void GameLoop_SaveLoaded(object? sender, StardewModdingAPI.Events.SaveLo if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.mod) return; - // check if mod Thai then patch time format + // patch the HUD clock for any mod language that defines a time format + // (e.g. Thai ELL.StardewValleyTHAI, Ukrainian Pereclaw.ukrainizacija, ...) List modLanguages = Game1.content.Load>("Data\\AdditionalLanguages"); var targetModLanguage = modLanguages.FirstOrDefault(); - if (targetModLanguage?.Id == "ELL.StardewValleyTHAI") + if (!string.IsNullOrWhiteSpace(targetModLanguage?.ClockTimeFormat) + || !string.IsNullOrWhiteSpace(targetModLanguage?.TimeFormat)) DayTimeMoneyBoxThaiFormat.ApplyPatch(Instance.harmony); } }