diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-24 13:48:17 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-24 13:48:17 -0400 |
commit | 79dabe26717654364d50c927678f52caed1ab93c (patch) | |
tree | 94d0b5aaa52e049b013fccc071437be09b9a826c /src/StardewModdingAPI/ITranslationHelper.cs | |
parent | 56919271fc60f85a752b0967fe27e69c1f3770c7 (diff) | |
download | SMAPI-79dabe26717654364d50c927678f52caed1ab93c.tar.gz SMAPI-79dabe26717654364d50c927678f52caed1ab93c.tar.bz2 SMAPI-79dabe26717654364d50c927678f52caed1ab93c.zip |
add translation API (#296)
Diffstat (limited to 'src/StardewModdingAPI/ITranslationHelper.cs')
-rw-r--r-- | src/StardewModdingAPI/ITranslationHelper.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/ITranslationHelper.cs b/src/StardewModdingAPI/ITranslationHelper.cs new file mode 100644 index 00000000..84571d0e --- /dev/null +++ b/src/StardewModdingAPI/ITranslationHelper.cs @@ -0,0 +1,29 @@ +using System.Collections.Generic; +using StardewValley; + +namespace StardewModdingAPI +{ + /// <summary>Provides translations stored in the mod's <c>i18n</c> folder, with one file per locale (like <c>en.json</c>) containing a flat key => value structure. Translations are fetched with locale fallback, so missing translations are filled in from broader locales (like <c>pt-BR.json</c> < <c>pt.json</c> < <c>default.json</c>).</summary> + public interface ITranslationHelper + { + /********* + ** Accessors + *********/ + /// <summary>The current locale.</summary> + string Locale { get; } + + /// <summary>The game's current language code.</summary> + LocalizedContentManager.LanguageCode LocaleEnum { get; } + + + /********* + ** Public methods + *********/ + /// <summary>Get all translations for the current locale.</summary> + IDictionary<string, string> GetTranslations(); + + /// <summary>Get a translation for the current locale.</summary> + /// <param name="key">The translation key.</param> + Translation Translate(string key); + } +} |