From 1240cb21024c3b715a6dacb2bec170a588a08791 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 1 Sep 2021 20:58:21 -0400 Subject: fix translations not initialized for temporary content packs --- src/SMAPI/Framework/ContentPack.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/SMAPI/Framework/ContentPack.cs') diff --git a/src/SMAPI/Framework/ContentPack.cs b/src/SMAPI/Framework/ContentPack.cs index 0660a367..b6add7b5 100644 --- a/src/SMAPI/Framework/ContentPack.cs +++ b/src/SMAPI/Framework/ContentPack.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using StardewModdingAPI.Framework.ModHelpers; using StardewModdingAPI.Toolkit.Serialization; using StardewModdingAPI.Toolkit.Utilities; @@ -32,7 +33,10 @@ namespace StardewModdingAPI.Framework public IManifest Manifest { get; } /// - public ITranslationHelper Translation { get; } + public ITranslationHelper Translation => this.TranslationImpl; + + /// The underlying translation helper. + internal TranslationHelper TranslationImpl { get; set; } /********* @@ -44,12 +48,12 @@ namespace StardewModdingAPI.Framework /// Provides an API for loading content assets. /// Provides translations stored in the content pack's i18n folder. /// Encapsulates SMAPI's JSON file parsing. - public ContentPack(string directoryPath, IManifest manifest, IContentHelper content, ITranslationHelper translation, JsonHelper jsonHelper) + public ContentPack(string directoryPath, IManifest manifest, IContentHelper content, TranslationHelper translation, JsonHelper jsonHelper) { this.DirectoryPath = directoryPath; this.Manifest = manifest; this.Content = content; - this.Translation = translation; + this.TranslationImpl = translation; this.JsonHelper = jsonHelper; foreach (string path in Directory.EnumerateFiles(this.DirectoryPath, "*", SearchOption.AllDirectories)) -- cgit