From 7383dff3248dc4b66fafc5eb6967c43aded3f77d Mon Sep 17 00:00:00 2001 From: SinZ Date: Mon, 15 Sep 2025 20:41:57 +1000 Subject: [PATCH 1/3] Use correct language when propagating textures --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 43d396669..9f110721f 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -184,7 +184,7 @@ private bool PropagateTexture(IAssetName assetName, LocalizedContentManager.Lang if (newTexture.Value is null) break; - Texture2D texture = contentManager.LoadLocalized(name, language, useCache: true); + Texture2D texture = contentManager.LoadLocalized(name, name.LanguageCode ?? contentManager.Language, useCache: true); texture.CopyFromTexture(newTexture.Value); changed = true; } From 58228984c00a62860cb6504814b323a08658148d Mon Sep 17 00:00:00 2001 From: SinZ Date: Mon, 15 Sep 2025 23:26:07 +1000 Subject: [PATCH 2/3] Be consistent with cache reads vs fresh load --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 9f110721f..1e5a9ba3d 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -170,7 +170,11 @@ private bool PropagateTexture(IAssetName assetName, LocalizedContentManager.Lang Lazy newTexture = new(() => { if (this.DisposableContentManager.DoesAssetExist(name)) - return this.DisposableContentManager.LoadLocalized(name, language, useCache: false); + { + return forLocalizedAsset + ? this.DisposableContentManager.LoadLocalized(name, language, useCache: false) + : this.DisposableContentManager.LoadLocalized(name, name.LanguageCode ?? this.DisposableContentManager.Language, useCache: false); + } this.Monitor.Log($"Skipped reload for '{name.Name}' because the underlying asset no longer exists.", LogLevel.Warn); return null; From 5119d85e4079021a2fb71ad4ca0d127f29cc447f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 27 Dec 2025 12:43:29 -0500 Subject: [PATCH 3/3] remove custom language handling entirely during asset propagation This is meant to change the texture that would be retrieved by a fresh `Load`, and `contentManager.Load(assetName)` uses the current language as the default instead of the asset locale. --- src/SMAPI/Metadata/CoreAssetPropagator.cs | 25 +++++++++-------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 1e5a9ba3d..358440a62 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -91,15 +91,9 @@ public void Propagate(IList contentManagers, IDictionary contentManagers, IDictionaryPropagate changes to a cached texture asset. /// The asset name to reload. - /// The language for which to get assets. /// The content managers whose assets to update. /// Whether the in-game world is fully unloaded (e.g. on the title screen), so there's no need to propagate changes into the world. /// Returns whether an asset was loaded. [SuppressMessage("ReSharper", "StringLiteralTypo", Justification = "These deliberately match the asset names.")] - private bool PropagateTexture(IAssetName assetName, LocalizedContentManager.LanguageCode language, IList contentManagers, bool ignoreWorld) + private bool PropagateTexture(IAssetName assetName, IList contentManagers, bool ignoreWorld) { bool changed = false; + // get default language + // This method replaces the textures that would be loaded if you called `contentManager.Load(assetName)`, + // which internally maps to `contentManager.LoadLocalized(assetName, currentLanguage)` regardless of + // the asset name's language. If the asset name includes a locale, `LoadLocalized` handles that internally. + LocalizedContentManager.LanguageCode currentLanguage = LocalizedContentManager.CurrentLanguageCode; + // update textures in-place (0 = localized asset name, 1 = base asset name) for (int i = 0; i < 2; i++) { @@ -170,11 +169,7 @@ private bool PropagateTexture(IAssetName assetName, LocalizedContentManager.Lang Lazy newTexture = new(() => { if (this.DisposableContentManager.DoesAssetExist(name)) - { - return forLocalizedAsset - ? this.DisposableContentManager.LoadLocalized(name, language, useCache: false) - : this.DisposableContentManager.LoadLocalized(name, name.LanguageCode ?? this.DisposableContentManager.Language, useCache: false); - } + return this.DisposableContentManager.LoadLocalized(name, currentLanguage, useCache: false); this.Monitor.Log($"Skipped reload for '{name.Name}' because the underlying asset no longer exists.", LogLevel.Warn); return null; @@ -188,7 +183,7 @@ private bool PropagateTexture(IAssetName assetName, LocalizedContentManager.Lang if (newTexture.Value is null) break; - Texture2D texture = contentManager.LoadLocalized(name, name.LanguageCode ?? contentManager.Language, useCache: true); + Texture2D texture = contentManager.LoadLocalized(name, currentLanguage, useCache: true); texture.CopyFromTexture(newTexture.Value); changed = true; }