From 021672e43db021ae436e23ff45f3d85e2a595cb0 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 14 Aug 2017 01:57:11 -0400 Subject: add content helper properties for the current language --- release-notes.md | 1 + src/StardewModdingAPI/Framework/ModHelpers/ContentHelper.cs | 6 ++++++ src/StardewModdingAPI/IContentHelper.cs | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/release-notes.md b/release-notes.md index 90ca4e2c..9bfd1981 100644 --- a/release-notes.md +++ b/release-notes.md @@ -33,6 +33,7 @@ For players: For mod developers: * Added `Context.CanPlayerMove` value for mod convenience. +* Added `helper.Content` properties for the current language. * Fixed `GraphicsEvents.Resize` being raised before the game updates its window data. * Fixed `Context.IsPlayerFree` being incorrectly false in some cases (e.g. when using a tool). diff --git a/src/StardewModdingAPI/Framework/ModHelpers/ContentHelper.cs b/src/StardewModdingAPI/Framework/ModHelpers/ContentHelper.cs index 1e987f00..e94d309e 100644 --- a/src/StardewModdingAPI/Framework/ModHelpers/ContentHelper.cs +++ b/src/StardewModdingAPI/Framework/ModHelpers/ContentHelper.cs @@ -40,6 +40,12 @@ namespace StardewModdingAPI.Framework.ModHelpers /********* ** Accessors *********/ + /// The game's current locale code (like pt-BR). + public string CurrentLocale => this.ContentManager.GetLocale(); + + /// The game's current locale as an enum value. + public LocalizedContentManager.LanguageCode CurrentLocaleConstant => this.ContentManager.GetCurrentLanguage(); + /// The observable implementation of . internal ObservableCollection ObservableAssetEditors { get; } = new ObservableCollection(); diff --git a/src/StardewModdingAPI/IContentHelper.cs b/src/StardewModdingAPI/IContentHelper.cs index f32c1d18..b4557134 100644 --- a/src/StardewModdingAPI/IContentHelper.cs +++ b/src/StardewModdingAPI/IContentHelper.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; +using StardewValley; namespace StardewModdingAPI { @@ -19,6 +20,12 @@ namespace StardewModdingAPI IList AssetEditors { get; } #endif + /// The game's current locale code (like pt-BR). + string CurrentLocale { get; } + + /// The game's current locale as an enum value. + LocalizedContentManager.LanguageCode CurrentLocaleConstant { get; } + /********* ** Public methods -- cgit