diff --git a/SDVModTest/Extensions/ObjectExtensions.cs b/SDVModTest/Extensions/ObjectExtensions.cs index 1151657..7e05547 100644 --- a/SDVModTest/Extensions/ObjectExtensions.cs +++ b/SDVModTest/Extensions/ObjectExtensions.cs @@ -3,10 +3,6 @@ using StardewModdingAPI; using StardewValley; using System; using System.Collections.Generic; -using System.Linq; -using System.Resources; -using System.Text; -using System.Threading.Tasks; namespace UIInfoSuite.Extensions { @@ -77,31 +73,5 @@ namespace UIInfoSuite.Extensions return result; } - - public static String SafeGetString(this ResourceManager manager, String key) - { - String result = string.Empty; - - if (!String.IsNullOrEmpty(key)) - { - try - { - result = manager.GetString(key, ModEntry.SpecificCulture); - } - catch - { - try - { - result = Properties.Resources.ResourceManager.GetString(key); - } - catch - { - - } - } - } - - return result ?? String.Empty; - } } } diff --git a/SDVModTest/ModEntry.cs b/SDVModTest/ModEntry.cs index f9a0128..8f75394 100644 --- a/SDVModTest/ModEntry.cs +++ b/SDVModTest/ModEntry.cs @@ -11,9 +11,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; -using System.Globalization; -using static StardewValley.LocalizedContentManager; -using System.Resources; using System.Reflection; namespace UIInfoSuite @@ -26,22 +23,9 @@ namespace UIInfoSuite private readonly Dictionary _options = new Dictionary(); public static IMonitor MonitorObject { get; private set; } - public static CultureInfo SpecificCulture { get; private set; } - //public static ResourceManager Resources { get; private set; } - //public static IModHelper Helper { get; private set; } private ModOptionsPageHandler _modOptionsPageHandler; - public ModEntry() - { - - } - - ~ModEntry() - { - - } - public override void Entry(IModHelper helper) { //Helper = helper; @@ -51,8 +35,6 @@ namespace UIInfoSuite SaveEvents.AfterSave += SaveModData; SaveEvents.AfterReturnToTitle += ReturnToTitle; GraphicsEvents.OnPreRenderEvent += IconHandler.Handler.Reset; - LocalizedContentManager.OnLanguageChange += LocalizedContentManager_OnLanguageChange; - LocalizedContentManager_OnLanguageChange(LocalizedContentManager.CurrentLanguageCode); //Resources = new ResourceManager("UIInfoSuite.Resource.strings", Assembly.GetAssembly(typeof(ModEntry))); //try @@ -66,12 +48,6 @@ namespace UIInfoSuite //} } - private void LocalizedContentManager_OnLanguageChange(LanguageCode code) - { - String cultureString = code.ToString(); - SpecificCulture = CultureInfo.CreateSpecificCulture(cultureString); - } - private void ReturnToTitle(object sender, EventArgs e) { _modOptionsPageHandler?.Dispose(); diff --git a/SDVModTest/Properties/Resources.Designer.cs b/SDVModTest/Properties/Resources.Designer.cs deleted file mode 100644 index a000da7..0000000 --- a/SDVModTest/Properties/Resources.Designer.cs +++ /dev/null @@ -1,198 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace UIInfoSuite.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UIInfoSuite.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Billboard. - /// - internal static string Billboard { - get { - return ResourceManager.GetString("Billboard", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Calendar. - /// - internal static string Calendar { - get { - return ResourceManager.GetString("Calendar", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to days. - /// - internal static string Days { - get { - return ResourceManager.GetString("Days", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to days to mature. - /// - internal static string DaysToMature { - get { - return ResourceManager.GetString("DaysToMature", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to You're feelin' lucky!!. - /// - internal static string FeelingLucky { - get { - return ResourceManager.GetString("FeelingLucky", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Harvest price. - /// - internal static string HarvestPrice { - get { - return ResourceManager.GetString("HarvestPrice", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to hours. - /// - internal static string Hours { - get { - return ResourceManager.GetString("Hours", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Level Up. - /// - internal static string LevelUp { - get { - return ResourceManager.GetString("LevelUp", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Feelin' lucky... but not too lucky. - /// - internal static string LuckyButNotTooLucky { - get { - return ResourceManager.GetString("LuckyButNotTooLucky", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Maybe you should stay home today.... - /// - internal static string MaybeStayHome { - get { - return ResourceManager.GetString("MaybeStayHome", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to minutes. - /// - internal static string Minutes { - get { - return ResourceManager.GetString("Minutes", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to You're not feeling lucky at all today.... - /// - internal static string NotFeelingLuckyAtAll { - get { - return ResourceManager.GetString("NotFeelingLuckyAtAll", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Ready To Harvest!. - /// - internal static string ReadyToHarvest { - get { - return ResourceManager.GetString("ReadyToHarvest", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Today's Recipe: . - /// - internal static string TodaysRecipe { - get { - return ResourceManager.GetString("TodaysRecipe", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Traveling merchant is in town!. - /// - internal static string TravelingMerchantIsInTown { - get { - return ResourceManager.GetString("TravelingMerchantIsInTown", resourceCulture); - } - } - } -} diff --git a/SDVModTest/Properties/Resources.resx b/SDVModTest/Properties/Resources.resx deleted file mode 100644 index fb3260e..0000000 --- a/SDVModTest/Properties/Resources.resx +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Billboard - - - Calendar - - - days - - - days to mature - - - You're feelin' lucky!! - - - Harvest price - - - hours - - - Level Up - - - Feelin' lucky... but not too lucky - - - Maybe you should stay home today... - - - minutes - - - You're not feeling lucky at all today... - - - Ready To Harvest! - - - Today's Recipe: - - - Traveling merchant is in town! - - \ No newline at end of file diff --git a/SDVModTest/UI Info Suite.csproj b/SDVModTest/UI Info Suite.csproj index bc2d871..8fb5097 100644 --- a/SDVModTest/UI Info Suite.csproj +++ b/SDVModTest/UI Info Suite.csproj @@ -33,7 +33,6 @@ prompt 4 true - true @@ -78,11 +77,6 @@ - - True - True - Resources.resx - @@ -127,11 +121,5 @@ Always - - - ResXFileCodeGenerator - Resources.Designer.cs - - \ No newline at end of file diff --git a/SDVModTest/UIElements/ShowCropAndBarrelTime.cs b/SDVModTest/UIElements/ShowCropAndBarrelTime.cs index f72af27..adb3cb3 100644 --- a/SDVModTest/UIElements/ShowCropAndBarrelTime.cs +++ b/SDVModTest/UIElements/ShowCropAndBarrelTime.cs @@ -9,9 +9,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using System.Resources; using System.Reflection; -using System.Globalization; using StardewValley.Objects; using StardewModdingAPI; using StardewValley.Locations; diff --git a/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs b/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs index 2842b27..476ce6a 100644 --- a/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs +++ b/SDVModTest/UIElements/ShowQueenOfSauceIcon.cs @@ -121,7 +121,7 @@ namespace UIInfoSuite.UIElements splitValues = craftingRecipesValue.Split('/'); } - string languageRecipeName = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en) ? + string languageRecipeName = (_helper.Content.CurrentLocaleConstant == LocalizedContentManager.LanguageCode.en) ? key : splitValues[splitValues.Length - 1]; array1[1] = languageRecipeName;