using System.Collections.Generic; using StardewValley; namespace StardewModdingAPI { /// Provides translations stored in the mod's i18n folder, with one file per locale (like en.json) containing a flat key => value structure. Translations are fetched with locale fallback, so missing translations are filled in from broader locales (like pt-BR.json < pt.json < default.json). public interface ITranslationHelper : IModLinked { /********* ** Accessors *********/ /// The current locale code like fr-FR, or an empty string for English. string Locale { get; } /// The game's current language code. LocalizedContentManager.LanguageCode LocaleEnum { get; } /********* ** Public methods *********/ /// Get all translations for the current locale. IEnumerable GetTranslations(); /// Get a translation for the current locale. /// The translation key. Translation Get(string key); /// Get a translation for the current locale. /// The translation key. /// An object containing token key/value pairs. This can be an anonymous object (like new { value = 42, name = "Cranberries" }), a dictionary, or a class instance. Translation Get(string key, object tokens); /// Get a translation in every locale for which it's defined. /// The translation key. /// Whether to add duplicate translations for locale fallback. For example, if a translation is defined in default.json but not fr.json, setting this to true will add a fr entry which duplicates the default text. IDictionary GetInAllLocales(string key, bool withFallback = false); } }