From 12ffd9c334906e2256a1c32976b6a07f75027f25 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 28 May 2017 01:06:35 -0400 Subject: [PATCH] add shortcut indexer to translation API (#296) --- src/StardewModdingAPI/Framework/TranslationHelper.cs | 4 ++++ src/StardewModdingAPI/ITranslationHelper.cs | 4 ++++ 2 files changed, 8 insertions(+) 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 /// The game's current language code. public LocalizedContentManager.LanguageCode LocaleEnum { get; private set; } + /// Get a translation for the current locale. This is a convenience shortcut for . + /// The translation key. + 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 /// The game's current language code. LocalizedContentManager.LanguageCode LocaleEnum { get; } + /// Get a translation for the current locale. This is a convenience shortcut for . + /// The translation key. + Translation this[string key] { get; } + /********* ** Public methods