diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-28 10:51:58 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-28 10:51:58 -0400 |
commit | 2958381b54d1f46ae97ae196d3d046fee9264a0e (patch) | |
tree | 087129ea216d597830d9855fd7d4b497c7a43cd2 | |
parent | 2109229660f1d8bce001c25fc6e83c0450ffc8c1 (diff) | |
download | SMAPI-2958381b54d1f46ae97ae196d3d046fee9264a0e.tar.gz SMAPI-2958381b54d1f46ae97ae196d3d046fee9264a0e.tar.bz2 SMAPI-2958381b54d1f46ae97ae196d3d046fee9264a0e.zip |
shorten translation method name, remove helper method (#296)
-rw-r--r-- | src/StardewModdingAPI.Tests/TranslationTests.cs | 6 | ||||
-rw-r--r-- | src/StardewModdingAPI/Framework/ModHelper.cs | 10 | ||||
-rw-r--r-- | src/StardewModdingAPI/Framework/TranslationHelper.cs | 6 | ||||
-rw-r--r-- | src/StardewModdingAPI/IModHelper.cs | 7 | ||||
-rw-r--r-- | src/StardewModdingAPI/ITranslationHelper.cs | 6 |
5 files changed, 5 insertions, 30 deletions
diff --git a/src/StardewModdingAPI.Tests/TranslationTests.cs b/src/StardewModdingAPI.Tests/TranslationTests.cs index 76da8706..1778ed6a 100644 --- a/src/StardewModdingAPI.Tests/TranslationTests.cs +++ b/src/StardewModdingAPI.Tests/TranslationTests.cs @@ -41,7 +41,7 @@ namespace StardewModdingAPI.Tests // act ITranslationHelper helper = new TranslationHelper("ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); - Translation translation = helper.Translate("key"); + Translation translation = helper.Get("key"); // assert Assert.AreEqual("en", helper.Locale, "The locale doesn't match the input value."); @@ -78,7 +78,7 @@ namespace StardewModdingAPI.Tests } [Test(Description = "Assert that the translations returned by the helper has the expected text.")] - public void Helper_Translate_ReturnsExpectedText() + public void Helper_Get_ReturnsExpectedText() { // arrange var data = this.GetSampleData(); @@ -92,7 +92,7 @@ namespace StardewModdingAPI.Tests this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en); actual[locale] = new Dictionary<string, string>(); foreach (string key in expected[locale].Keys) - actual[locale][key] = helper.Translate(key); + actual[locale][key] = helper.Get(key); } // assert diff --git a/src/StardewModdingAPI/Framework/ModHelper.cs b/src/StardewModdingAPI/Framework/ModHelper.cs index 947b1ae8..5a8ce459 100644 --- a/src/StardewModdingAPI/Framework/ModHelper.cs +++ b/src/StardewModdingAPI/Framework/ModHelper.cs @@ -120,16 +120,6 @@ namespace StardewModdingAPI.Framework /**** - ** Translation - ****/ - /// <summary>Get a translation for the current locale. This is a convenience shortcut for <see cref="IModHelper.Translation"/>.</summary> - /// <param name="key">The translation key.</param> - public Translation Translate(string key) - { - return this.Translation.Translate(key); - } - - /**** ** Disposal ****/ /// <summary>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</summary> diff --git a/src/StardewModdingAPI/Framework/TranslationHelper.cs b/src/StardewModdingAPI/Framework/TranslationHelper.cs index ebcd69b1..e4a178e2 100644 --- a/src/StardewModdingAPI/Framework/TranslationHelper.cs +++ b/src/StardewModdingAPI/Framework/TranslationHelper.cs @@ -29,10 +29,6 @@ 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 @@ -58,7 +54,7 @@ namespace StardewModdingAPI.Framework /// <summary>Get a translation for the current locale.</summary> /// <param name="key">The translation key.</param> - public Translation Translate(string key) + public Translation Get(string key) { this.ForLocale.TryGetValue(key, out string text); return new Translation(this.ModName, this.Locale, key, text); diff --git a/src/StardewModdingAPI/IModHelper.cs b/src/StardewModdingAPI/IModHelper.cs index 38bfd366..116e8508 100644 --- a/src/StardewModdingAPI/IModHelper.cs +++ b/src/StardewModdingAPI/IModHelper.cs @@ -54,12 +54,5 @@ /// <param name="path">The file path relative to the mod directory.</param> /// <param name="model">The model to save.</param> void WriteJsonFile<TModel>(string path, TModel model) where TModel : class; - - /**** - ** Translations - ****/ - /// <summary>Get a translation for the current locale. This is a convenience shortcut for <see cref="IModHelper.Translation"/>.</summary> - /// <param name="key">The translation key.</param> - Translation Translate(string key); } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/ITranslationHelper.cs b/src/StardewModdingAPI/ITranslationHelper.cs index 297a0d5a..23980a1b 100644 --- a/src/StardewModdingAPI/ITranslationHelper.cs +++ b/src/StardewModdingAPI/ITranslationHelper.cs @@ -15,10 +15,6 @@ 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 @@ -28,6 +24,6 @@ namespace StardewModdingAPI /// <summary>Get a translation for the current locale.</summary> /// <param name="key">The translation key.</param> - Translation Translate(string key); + Translation Get(string key); } } |