summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-05-28 01:06:35 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-05-28 01:06:35 -0400
commit12ffd9c334906e2256a1c32976b6a07f75027f25 (patch)
tree0e98bb070b3a002414cb3101470d1dfb2dad5b07
parent01197b0eb1845251b12322ba1b9cf130cd2a9dc1 (diff)
downloadSMAPI-12ffd9c334906e2256a1c32976b6a07f75027f25.tar.gz
SMAPI-12ffd9c334906e2256a1c32976b6a07f75027f25.tar.bz2
SMAPI-12ffd9c334906e2256a1c32976b6a07f75027f25.zip
add shortcut indexer to translation API (#296)
-rw-r--r--src/StardewModdingAPI/Framework/TranslationHelper.cs4
-rw-r--r--src/StardewModdingAPI/ITranslationHelper.cs4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Framework/TranslationHelper.cs b/src/StardewModdingAPI/Framework/TranslationHelper.cs
index dece6214..c3104d1b 100644
--- a/src/StardewModdingAPI/Framework/TranslationHelper.cs
+++ b/src/StardewModdingAPI/Framework/TranslationHelper.cs
@@ -29,6 +29,10 @@ namespace StardewModdingAPI.Framework
/// <summary>The game's current language code.</summary>
public LocalizedContentManager.LanguageCode LocaleEnum { get; private set; }
+ /// <summary>Get a translation for the current locale. This is a convenience shortcut for <see cref="ITranslationHelper.Translate"/>.</summary>
+ /// <param name="key">The translation key.</param>
+ public Translation this[string key] => this.Translate(key);
+
/*********
** Public methods
diff --git a/src/StardewModdingAPI/ITranslationHelper.cs b/src/StardewModdingAPI/ITranslationHelper.cs
index 84571d0e..297a0d5a 100644
--- a/src/StardewModdingAPI/ITranslationHelper.cs
+++ b/src/StardewModdingAPI/ITranslationHelper.cs
@@ -15,6 +15,10 @@ namespace StardewModdingAPI
/// <summary>The game's current language code.</summary>
LocalizedContentManager.LanguageCode LocaleEnum { get; }
+ /// <summary>Get a translation for the current locale. This is a convenience shortcut for <see cref="Translate"/>.</summary>
+ /// <param name="key">The translation key.</param>
+ Translation this[string key] { get; }
+
/*********
** Public methods