From 4efcd920b8c88c7285936faccfe4a27c52e1d7aa Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 20:57:29 +0200 Subject: [PATCH 01/10] Add translation support --- AdvancedDrumBlocks/ModEntry.cs | 4 ++-- AdvancedDrumBlocks/i18n/default.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 AdvancedDrumBlocks/i18n/default.json diff --git a/AdvancedDrumBlocks/ModEntry.cs b/AdvancedDrumBlocks/ModEntry.cs index 5b1e2fb0..43743694 100644 --- a/AdvancedDrumBlocks/ModEntry.cs +++ b/AdvancedDrumBlocks/ModEntry.cs @@ -85,13 +85,13 @@ private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameL configMenu.AddBoolOption( mod: ModManifest, - name: () => "Mod Enabled?", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ModEnabled_Name"), getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddKeybind( mod: ModManifest, - name: () => "Index Mod Key", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_IndexModKey_Name"), getValue: () => Config.IndexModKey, setValue: value => Config.IndexModKey = value ); diff --git a/AdvancedDrumBlocks/i18n/default.json b/AdvancedDrumBlocks/i18n/default.json new file mode 100644 index 00000000..132d5c71 --- /dev/null +++ b/AdvancedDrumBlocks/i18n/default.json @@ -0,0 +1,5 @@ +{ + // GMCM + "GMCM_Option_ModEnabled_Name": "Mod Enabled", + "GMCM_Option_IndexModKey_Name": "Index Mod Key" +} \ No newline at end of file From b379fa4ccd44a044321a081a1607aac9571425c4 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 21:24:32 +0200 Subject: [PATCH 02/10] Add translation support --- AdvancedFluteBlocks/ModEntry.cs | 10 +++++----- AdvancedFluteBlocks/i18n/default.json | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 AdvancedFluteBlocks/i18n/default.json diff --git a/AdvancedFluteBlocks/ModEntry.cs b/AdvancedFluteBlocks/ModEntry.cs index 3bd3a776..4811d0f2 100644 --- a/AdvancedFluteBlocks/ModEntry.cs +++ b/AdvancedFluteBlocks/ModEntry.cs @@ -125,29 +125,29 @@ private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameL configMenu.AddBoolOption( mod: ModManifest, - name: () => "Mod Enabled?", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ModEnabled_Name"), getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddSectionTitle( mod: ModManifest, - text: () => "Key Binds" + text: () => ModEntry.SHelper.Translation.Get("GMCM_SectionTitle_KeyBinds_Text") ); configMenu.AddKeybind( mod: ModManifest, - name: () => "Pitch Mod Key", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_PitchModKey_Name"), getValue: () => Config.PitchModKey, setValue: value => Config.PitchModKey = value ); configMenu.AddKeybind( mod: ModManifest, - name: () => "Tone Mod Key", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ToneModKey_Name"), getValue: () => Config.ToneModKey, setValue: value => Config.ToneModKey = value ); configMenu.AddNumberOption( mod: ModManifest, - name: () => "Pitch Step", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_PitchStep_Name"), getValue: () => Config.PitchStep, setValue: value => Config.PitchStep = value ); diff --git a/AdvancedFluteBlocks/i18n/default.json b/AdvancedFluteBlocks/i18n/default.json new file mode 100644 index 00000000..cb4879ff --- /dev/null +++ b/AdvancedFluteBlocks/i18n/default.json @@ -0,0 +1,8 @@ +{ + // GMCM + "GMCM_Option_ModEnabled_Name": "Mod Enabled", + "GMCM_SectionTitle_KeyBinds_Text": "Key Binds", + "GMCM_Option_PitchModKey_Name": "Pitch Mod Key", + "GMCM_Option_ToneModKey_Name": "Tone Mod Key", + "GMCM_Option_PitchStep_Name": "Pitch Step" +} \ No newline at end of file From fb9fda86b8eb973402848604dd416ce31e493041 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 20:57:50 +0200 Subject: [PATCH 03/10] Add French translation --- AdvancedDrumBlocks/i18n/fr.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 AdvancedDrumBlocks/i18n/fr.json diff --git a/AdvancedDrumBlocks/i18n/fr.json b/AdvancedDrumBlocks/i18n/fr.json new file mode 100644 index 00000000..27224b32 --- /dev/null +++ b/AdvancedDrumBlocks/i18n/fr.json @@ -0,0 +1,5 @@ +{ + // GMCM + "GMCM_Option_ModEnabled_Name": "Activer le Mod", + "GMCM_Option_IndexModKey_Name": "Touche pour modifier le timbre" +} \ No newline at end of file From d4bb45aea1b719d87c3033190ea76f55fefb1014 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 21:24:41 +0200 Subject: [PATCH 04/10] Add French translation --- AdvancedFluteBlocks/i18n/fr.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 AdvancedFluteBlocks/i18n/fr.json diff --git a/AdvancedFluteBlocks/i18n/fr.json b/AdvancedFluteBlocks/i18n/fr.json new file mode 100644 index 00000000..bfed816f --- /dev/null +++ b/AdvancedFluteBlocks/i18n/fr.json @@ -0,0 +1,8 @@ +{ + // GMCM + "GMCM_Option_ModEnabled_Name": "Activer le Mod", + "GMCM_SectionTitle_KeyBinds_Text": "Raccourcis clavier", + "GMCM_Option_PitchModKey_Name": "Touche pour modifier la hauteur", + "GMCM_Option_ToneModKey_Name": "Touche pour modifier le timbre", + "GMCM_Option_PitchStep_Name": "Intervalle de la hauteur" +} \ No newline at end of file From f853d5e1cb374bd8efaed8197eff2b5a38baa790 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Thu, 27 Apr 2023 09:17:03 +0200 Subject: [PATCH 05/10] Add translation support --- AdditionalMineMaps/ModEntry.cs | 4 ++-- AdditionalMineMaps/i18n/default.json | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 AdditionalMineMaps/i18n/default.json diff --git a/AdditionalMineMaps/ModEntry.cs b/AdditionalMineMaps/ModEntry.cs index 70fa9358..b3bb7f36 100644 --- a/AdditionalMineMaps/ModEntry.cs +++ b/AdditionalMineMaps/ModEntry.cs @@ -80,13 +80,13 @@ private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameL configMenu.AddBoolOption( mod: ModManifest, - name: () => "Mod Enabled", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ModEnabled_Name"), getValue: () => Config.ModEnabled, setValue: value => Config.ModEnabled = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Allow Vanilla Maps", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_AllowVanillaMaps_Name"), getValue: () => Config.AllowVanillaMaps, setValue: value => Config.AllowVanillaMaps = value ); diff --git a/AdditionalMineMaps/i18n/default.json b/AdditionalMineMaps/i18n/default.json new file mode 100644 index 00000000..b61bad95 --- /dev/null +++ b/AdditionalMineMaps/i18n/default.json @@ -0,0 +1,5 @@ +{ + // GMCM + "GMCM_Option_ModEnabled_Name": "Mod Enabled", + "GMCM_Option_AllowVanillaMaps_Name": "Allow Vanilla Maps", +} \ No newline at end of file From 2ed1353800f13781791d41ab9b372e079cb0f5ef Mon Sep 17 00:00:00 2001 From: mouahrara Date: Thu, 27 Apr 2023 09:17:44 +0200 Subject: [PATCH 06/10] Add French translation --- AdditionalMineMaps/i18n/fr.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 AdditionalMineMaps/i18n/fr.json diff --git a/AdditionalMineMaps/i18n/fr.json b/AdditionalMineMaps/i18n/fr.json new file mode 100644 index 00000000..886a4ce4 --- /dev/null +++ b/AdditionalMineMaps/i18n/fr.json @@ -0,0 +1,5 @@ +{ + // GMCM + "GMCM_Option_ModEnabled_Name": "Activer le Mod", + "GMCM_Option_AllowVanillaMaps_Name": "Autoriser les cartes de base", +} \ No newline at end of file From 281032300cf8cd7efc94081365345940aa3cb020 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 09:43:42 +0200 Subject: [PATCH 07/10] Fix tool duplication --- AdvancedCooking/CodePatches.cs | 2 +- AdvancedCooking/ModEntry.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AdvancedCooking/CodePatches.cs b/AdvancedCooking/CodePatches.cs index 630fe090..cd4e19f9 100644 --- a/AdvancedCooking/CodePatches.cs +++ b/AdvancedCooking/CodePatches.cs @@ -54,7 +54,7 @@ private static void CraftingPage_Prefix(CraftingPage __instance, int x, int y, b } private static void CraftingPage_receiveLeftClick_Prefix(CraftingPage __instance, ref Item ___heldItem, int x, int y) { - if (!Config.EnableMod || Game1.activeClickableMenu is not CraftingPage || !AccessTools.FieldRefAccess(Game1.activeClickableMenu as CraftingPage, "cooking")) + if (!Config.EnableMod || Game1.activeClickableMenu is not CraftingPage || !AccessTools.FieldRefAccess(Game1.activeClickableMenu as CraftingPage, "cooking") || ___heldItem is Tool) return; if (cookButton != null && cookButton.containsPoint(x, y)) { diff --git a/AdvancedCooking/ModEntry.cs b/AdvancedCooking/ModEntry.cs index 87126e68..b5a7739e 100644 --- a/AdvancedCooking/ModEntry.cs +++ b/AdvancedCooking/ModEntry.cs @@ -475,7 +475,12 @@ private static void UpdateActualInventory(CraftingPage instance) } private static bool IsCorrectIngredient(Item item, int key) { - return item is not null && !(item as Object).bigCraftable.Value && (((Object)item).ParentSheetIndex == key || ((Object)item).Category == key || CraftingRecipe.isThereSpecialIngredientRule((Object)item, key)); + Object obj = item as Object; + + if (obj is null) + return false; + else + return !obj.bigCraftable.Value && (obj.ParentSheetIndex == key || obj.Category == key || CraftingRecipe.isThereSpecialIngredientRule(obj, key)); } } } \ No newline at end of file From b79e68757f9d9115c3de487e72cf820e2d902142 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 11:41:05 +0200 Subject: [PATCH 08/10] Improve translation support --- AdvancedCooking/ModEntry.cs | 22 +++++++++++----------- AdvancedCooking/i18n/default.json | 15 ++++++++++++++- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/AdvancedCooking/ModEntry.cs b/AdvancedCooking/ModEntry.cs index 87126e68..cf76d39d 100644 --- a/AdvancedCooking/ModEntry.cs +++ b/AdvancedCooking/ModEntry.cs @@ -119,67 +119,67 @@ private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameL ); configMenu.AddKeybind( mod: ModManifest, - name: () => "Cook All Mod Key", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_CookAllModKey_Name"), getValue: () => Config.CookAllModKey, setValue: value => Config.CookAllModKey = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Store Held Item On Cook", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_StoreOtherHeldItemOnCook_Name"), getValue: () => Config.StoreOtherHeldItemOnCook, setValue: value => Config.StoreOtherHeldItemOnCook = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Consume Ingredients On Fail", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ConsumeIngredientsOnFail_Name"), getValue: () => Config.ConsumeIngredientsOnFail, setValue: value => Config.ConsumeIngredientsOnFail = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Consume Excess On Success", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ConsumeExtraIngredientsOnSucceed_Name"), getValue: () => Config.ConsumeExtraIngredientsOnSucceed, setValue: value => Config.ConsumeExtraIngredientsOnSucceed = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Give Trash On Fail", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_GiveTrashOnFail_Name"), getValue: () => Config.GiveTrashOnFail, setValue: value => Config.GiveTrashOnFail = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Allow Unknown Recipes", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_AllowUnknownRecipes_Name"), getValue: () => Config.AllowUnknownRecipes, setValue: value => Config.AllowUnknownRecipes = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Learn Unknown Recipes", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_LearnUnknownRecipes_Name"), getValue: () => Config.LearnUnknownRecipes, setValue: value => Config.LearnUnknownRecipes = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Show Product Info", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ShowProductInfo_Name"), getValue: () => Config.ShowProductInfo, setValue: value => Config.ShowProductInfo = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Show Cook Tooltip", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ShowCookTooltip_Name"), getValue: () => Config.ShowCookTooltip, setValue: value => Config.ShowCookTooltip = value ); configMenu.AddBoolOption( mod: ModManifest, - name: () => "Show Products In Tooltip", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_ShowProductsInTooltip_Name"), getValue: () => Config.ShowProductsInTooltip, setValue: value => Config.ShowProductsInTooltip = value ); configMenu.AddNumberOption( mod: ModManifest, - name: () => "Height Offset", + name: () => ModEntry.SHelper.Translation.Get("GMCM_Option_YOffset_Name"), getValue: () => Config.YOffset, setValue: value => Config.YOffset = value ); diff --git a/AdvancedCooking/i18n/default.json b/AdvancedCooking/i18n/default.json index 244a5869..b4a83d15 100644 --- a/AdvancedCooking/i18n/default.json +++ b/AdvancedCooking/i18n/default.json @@ -9,5 +9,18 @@ "cook": "Cook", "x-of-y": "{0} {1}", "player": "Player", - "fridge-x": "Fridge {0}" + "fridge-x": "Fridge {0}", + + // GMCM + "GMCM_Option_CookAllModKey_Name": "Cook All Mod Key", + "GMCM_Option_StoreOtherHeldItemOnCook_Name": "Store Held Item On Cook", + "GMCM_Option_ConsumeIngredientsOnFail_Name": "Consume Ingredients On Fail", + "GMCM_Option_ConsumeExtraIngredientsOnSucceed_Name": "Consume Excess On Success", + "GMCM_Option_GiveTrashOnFail_Name": "Give Trash On Fail", + "GMCM_Option_AllowUnknownRecipes_Name": "Allow Unknown Recipes", + "GMCM_Option_LearnUnknownRecipes_Name": "Learn Unknown Recipes", + "GMCM_Option_ShowProductInfo_Name": "Show Product Info", + "GMCM_Option_ShowCookTooltip_Name": "Show Cook Tooltip", + "GMCM_Option_ShowProductsInTooltip_Name": "Show Products In Tooltip", + "GMCM_Option_YOffset_Name": "Height Offset" } \ No newline at end of file From 9766b27373bcff6f2cca0169132297279e47cbf5 Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 11:41:48 +0200 Subject: [PATCH 09/10] Use localized recipe names --- AdvancedCooking/ModEntry.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AdvancedCooking/ModEntry.cs b/AdvancedCooking/ModEntry.cs index cf76d39d..a9f09c45 100644 --- a/AdvancedCooking/ModEntry.cs +++ b/AdvancedCooking/ModEntry.cs @@ -198,7 +198,8 @@ private static void DrawCookButtonTooltip() text.Add(string.Format(SHelper.Translation.Get("plus-x-more"), keys.Length - i)); break; } - text.Add(string.Format(SHelper.Translation.Get("x-of-y"), !SHelper.Input.IsDown(Config.CookAllModKey) ? 1 : currentCookables[keys[i]], keys[i])); + string[] recipeInfo = CraftingRecipe.cookingRecipes[keys[i]].Split('/'); + text.Add(string.Format(SHelper.Translation.Get("x-of-y"), !SHelper.Input.IsDown(Config.CookAllModKey) ? 1 : currentCookables[keys[i]], (recipeInfo.Length > 4) ? recipeInfo[4] : keys[i])); if (!SHelper.Input.IsDown(Config.CookAllModKey)) break; } From acc56fa5f5f3f20858f3b735e03f56ba94c53e8d Mon Sep 17 00:00:00 2001 From: mouahrara Date: Fri, 28 Apr 2023 11:42:30 +0200 Subject: [PATCH 10/10] Add French translation --- AdvancedCooking/i18n/fr.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 AdvancedCooking/i18n/fr.json diff --git a/AdvancedCooking/i18n/fr.json b/AdvancedCooking/i18n/fr.json new file mode 100644 index 00000000..471fc109 --- /dev/null +++ b/AdvancedCooking/i18n/fr.json @@ -0,0 +1,26 @@ +{ + "new-recipe-x": "Vous avez appris à cuisiner {0} !", + "cooking-failed": "Vous n'avez pas réussi à cuisiner quoi que ce soit de comestible...", + "ingredients": "Ingrédients :", + "will-cook-1": "(cuisinera {0} objet)", + "will-cook-x": "(cuisinera {0} objets)", + "plus-x-more": "et {0} de plus", + "cannot-cook": "Impossible de cuisiner en tenant un autre objet !", + "cook": "Cuisiner", + "x-of-y": "{0} {1}", + "player": "Joueur", + "fridge-x": "Réfrigérateur {0}", + + // GMCM + "GMCM_Option_CookAllModKey_Name": "Touche pour tout cuisiner", + "GMCM_Option_StoreOtherHeldItemOnCook_Name": "Stocker l'objet tenu lors de la cuisine", + "GMCM_Option_ConsumeIngredientsOnFail_Name": "Consommer les ingrédients en cas d'échec", + "GMCM_Option_ConsumeExtraIngredientsOnSucceed_Name": "Consommer l'excédent en cas de succès", + "GMCM_Option_GiveTrashOnFail_Name": "Donner des déchets en cas d'échec", + "GMCM_Option_AllowUnknownRecipes_Name": "Autoriser les recettes inconnues", + "GMCM_Option_LearnUnknownRecipes_Name": "Apprendre les recettes inconnues", + "GMCM_Option_ShowProductInfo_Name": "Afficher les informations sur les produits", + "GMCM_Option_ShowCookTooltip_Name": "Afficher l'infobulle de cuisine", + "GMCM_Option_ShowProductsInTooltip_Name": "Afficher les produits dans l'infobulle", + "GMCM_Option_YOffset_Name": "Décalage en hauteur" +} \ No newline at end of file