Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions DayTimeMoneyBoxThaiFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
6 changes: 4 additions & 2 deletions ModEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModLanguage> modLanguages = Game1.content.Load<List<ModLanguage>>("Data\\AdditionalLanguages");
var targetModLanguage = modLanguages.FirstOrDefault();
if (targetModLanguage?.Id == "ELL.StardewValleyTHAI")
if (!string.IsNullOrWhiteSpace(targetModLanguage?.ClockTimeFormat)
|| !string.IsNullOrWhiteSpace(targetModLanguage?.TimeFormat))
DayTimeMoneyBoxThaiFormat.ApplyPatch(Instance.harmony);
}
}