From a8b0e71d953d61da1689f3ebe20b488ff80cb5dc Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Fri, 22 Mar 2024 20:13:33 +0100 Subject: [PATCH 01/11] Initial exemple --- RichPresenceMod.cs | 4 ++-- i18n/default.json | 6 ++++++ i18n/fr.json | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 i18n/default.json create mode 100644 i18n/fr.json diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index 1ff8f83..b760a3e 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -138,8 +138,8 @@ public override void Entry(IModHelper helper) { SetTag(mod, "Year", ReqWorld(() => SDate.Now().Year.ToString())); SetTag(mod, "YearSuffix", ReqWorld(() => Utility.getNumberEnding(SDate.Now().Year))); - SetTag(mod, "GameVerb", ReqWorld(() => Context.IsMultiplayer && Context.IsMainPlayer ? "Hosting" : "Playing")); - SetTag(mod, "GameNoun", ReqWorld(() => Context.IsMultiplayer ? "Co-op" : "Solo")); + SetTag(mod, "GameVerb", ReqWorld(() => Context.IsMultiplayer && Context.IsMainPlayer ? Helper.Translation.Get("hosting") : Helper.Translation.Get("playing"))); + SetTag(mod, "GameNoun", ReqWorld(() => Context.IsMultiplayer ? Helper.Translation.Get("co-op") : Helper.Translation.Get("solo"))); SetTag(mod, "GameInfo", ReqWorld(() => api.ResolveTag("GameVerb") + " " + api.ResolveTag("GameNoun"))); #endregion } diff --git a/i18n/default.json b/i18n/default.json new file mode 100644 index 0000000..724d080 --- /dev/null +++ b/i18n/default.json @@ -0,0 +1,6 @@ +{ + "co-op": "co-op", + "hosting": "Hosting", + "playing": "Playing", + "solo": "solo" +} \ No newline at end of file diff --git a/i18n/fr.json b/i18n/fr.json new file mode 100644 index 0000000..d12974e --- /dev/null +++ b/i18n/fr.json @@ -0,0 +1,6 @@ +{ + "co-op": "co-op", + "hosting": "Héberge", + "playing": "Joue", + "solo": "solo" +} \ No newline at end of file From 9bfe8ec35b9dacc8b7b80cf3187eacce84ad7f2a Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Fri, 22 Mar 2024 20:44:38 +0100 Subject: [PATCH 02/11] Also add GenericModConfigMenu exemple --- RichPresenceMod.cs | 6 +++--- i18n/default.json | 6 ++++++ i18n/fr.json | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index b760a3e..8d2b1e3 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -214,13 +214,13 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { ); configMenu.AddBoolOption(mod, - name: () => "Show global playtime", + name: () => Helper.Translation.Get("options.showGlobalPlaytime"), getValue: () => Config.ShowGlobalPlayTime, setValue: value => Config.ShowGlobalPlayTime = value ); configMenu.AddBoolOption(mod, - name: () => "Add Get Mod Button", - tooltip: () => "Support the mod by adding a link to it on your rich presence.", + name: () => Helper.Translation.Get("options.addGetModButton"), + tooltip: () => Helper.Translation.Get("options.addGetModButton.desc"), getValue: () => Config.AddGetModButton, setValue: value => Config.AddGetModButton = value ); diff --git a/i18n/default.json b/i18n/default.json index 724d080..52d7d40 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -1,4 +1,10 @@ { + // GenericModConfigMenu + "options.showGlobalPlaytime": "Show global playtime", + "options.addGetModButton": "Add Get Mod Button", + "options.addGetModButton.desc": "Support the mod by adding a link to it on your rich presence.", + + "co-op": "co-op", "hosting": "Hosting", "playing": "Playing", diff --git a/i18n/fr.json b/i18n/fr.json index d12974e..2114155 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -1,4 +1,9 @@ { + // GenericModConfigMenu + "options.showGlobalPlaytime": "Affiche le temps de jeu global", + "options.addGetModButton": "Ajoute un bouton 'Obtenir le mod'", + "options.addGetModButton.desc": "Support the mod by adding a link to it on your rich presence.", + "co-op": "co-op", "hosting": "Héberge", "playing": "Joue", From 7e823cbfa2474b09becaa6c2b8cc894142fc9cde Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Fri, 22 Mar 2024 23:09:43 +0100 Subject: [PATCH 03/11] Addition --- RichPresenceMod.cs | 6 +++--- i18n/default.json | 3 +++ i18n/fr.json | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index 8d2b1e3..9c2b903 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -225,7 +225,7 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { setValue: value => Config.AddGetModButton = value ); - configMenu.AddSectionTitle(mod, () => "Preview"); + configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.preview")); configMenu.AddParagraph(mod, () => { var text = api.FormatText(Conf.State) + "\n"; text += api.FormatText(Conf.Details) + "\n"; @@ -236,10 +236,10 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { return text; }); - configMenu.AddSectionTitle(mod, () => "Customize Presence in Menus"); + configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.customizePresenceInMenus")); RPCModMenuSection(configMenu, Config.MenuPresence); - configMenu.AddSectionTitle(mod, () => "Customize Presence in Game"); + configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.customizePresenceInGame")); RPCModMenuSection(configMenu, Config.GamePresence); configMenu.AddBoolOption(mod, name: () => "Show season", diff --git a/i18n/default.json b/i18n/default.json index 52d7d40..954ce83 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -3,6 +3,9 @@ "options.showGlobalPlaytime": "Show global playtime", "options.addGetModButton": "Add Get Mod Button", "options.addGetModButton.desc": "Support the mod by adding a link to it on your rich presence.", + "options.preview": "Preview", + "options.customizePresenceInMenus": "Customize Presence in Menus", + "options.customizePresenceInGame": "Customize Presence in Game", "co-op": "co-op", diff --git a/i18n/fr.json b/i18n/fr.json index 2114155..a1991c8 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -2,7 +2,10 @@ // GenericModConfigMenu "options.showGlobalPlaytime": "Affiche le temps de jeu global", "options.addGetModButton": "Ajoute un bouton 'Obtenir le mod'", - "options.addGetModButton.desc": "Support the mod by adding a link to it on your rich presence.", + "options.addGetModButton.desc": "Supporter le mod en ajoutant un lien pour le télécharger dans l'activité.", + "options.preview": "Aperçu", + "options.customizePresenceInMenus": "Personnaliser l'Activité dans le menu", + "options.customizePresenceInGame": "Personnaliser l'Activité dans le jeu", "co-op": "co-op", "hosting": "Héberge", From d516f87397662b9994d06ee8bae3f2d0a374c02a Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Sat, 23 Mar 2024 08:37:32 +0100 Subject: [PATCH 04/11] More translation --- RichPresenceMod.cs | 63 +++++++++++++++++++++++----------------------- i18n/default.json | 35 +++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 33 deletions(-) diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index 9c2b903..ee4fb04 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -26,8 +26,8 @@ public class RichPresenceMod : Mod { public override void Entry(IModHelper helper) { if (Constants.TargetPlatform == GamePlatform.Android) { - Monitor.Log("Discord RPC is not supported on Android.", LogLevel.Error); - Monitor.Log("Aborting mod initialization.", LogLevel.Error); + Monitor.Log(Helper.Translation.Get("console.androidNotSupported"), LogLevel.Error); + Monitor.Log(Helper.Translation.Get("console.modInitialisationAbort"), LogLevel.Error); Dispose(); return; } @@ -39,7 +39,7 @@ public override void Entry(IModHelper helper) { client.SetSubscription(EventType.Join); client.RegisterUriScheme(steamId); client.OnReady += (sender, e) => - Monitor.Log("Connected to Discord: " + e.User.ToString(), LogLevel.Info); + Monitor.Log(Helper.Translation.Get("console.connectedToDiscord") + " : " + e.User.ToString(), LogLevel.Info); client.Initialize(); #region Console Commands @@ -77,9 +77,9 @@ public override void Entry(IModHelper helper) { Helper.Events.GameLoop.SaveLoaded += SetTimestamp; Helper.Events.GameLoop.ReturnedToTitle += SetTimestamp; Helper.Events.GameLoop.SaveLoaded += (object sender, SaveLoadedEventArgs e) => - api.GamePresence = "Getting Started"; + api.GamePresence = Helper.Translation.Get("gamePresence.gettingStarted"); Helper.Events.GameLoop.SaveCreated += (object sender, SaveCreatedEventArgs e) => - api.GamePresence = "Starting a New Game"; + api.GamePresence = Helper.Translation.Get("gamePresence.startingNewGame"); Helper.Events.GameLoop.GameLaunched += (object sender, GameLaunchedEventArgs e) => { SetTimestamp(); timestampSession = Timestamps.Now; @@ -180,11 +180,10 @@ void section(Dictionary group, string name) { var count = group.Count; if (count == 0) return; - string head = $"{count} tag"; - if (count != 1) head += "s"; - head += $" from {name}:"; output.Add(""); - output.Add(head); + output.Add(count > 1 ? + Helper.Translation.Get("options.tagsFrom", new { count, name }) : + Helper.Translation.Get("options.tagFrom", new { name })); list(group); } @@ -195,7 +194,7 @@ void section(Dictionary group, string name) { if (group.Key == "") continue; section(group.Value, group.Key); } - section(groups[""], "unknown mods"); + section(groups[""], Helper.Translation.Get("options.unknownMods")); return string.Join("\n", output); } @@ -230,9 +229,9 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { var text = api.FormatText(Conf.State) + "\n"; text += api.FormatText(Conf.Details) + "\n"; var large = api.FormatText(Conf.LargeImageText); - if (large.Length > 0) text += $"Large image text: {large}\n"; + if (large.Length > 0) text += $"{Helper.Translation.Get("options.largeImageText")}: {large}\n"; var small = api.FormatText(Conf.SmallImageText); - if (small.Length > 0) text += $"Small image text: {small}\n"; + if (small.Length > 0) text += $"{Helper.Translation.Get("options.smallImageText")}: {small}\n"; return text; }); @@ -242,26 +241,26 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.customizePresenceInGame")); RPCModMenuSection(configMenu, Config.GamePresence); configMenu.AddBoolOption(mod, - name: () => "Show season", - tooltip: () => "Show the current season on large image", + name: () => Helper.Translation.Get("options.showSeason"), + tooltip: () => Helper.Translation.Get("options.showSeason.desc"), getValue: () => Config.GamePresence.ShowSeason, setValue: value => Config.GamePresence.ShowSeason = value ); configMenu.AddBoolOption(mod, - name: () => "Show farm type", - tooltip: () => "Show the farm type on large image", + name: () => Helper.Translation.Get("options.showFarmType"), + tooltip: () => Helper.Translation.Get("options.showFarmType.desc"), getValue: () => Config.GamePresence.ShowFarmType, setValue: value => Config.GamePresence.ShowFarmType = value ); configMenu.AddBoolOption(mod, - name: () => "Show weather", - tooltip: () => "Show the current weather on small image", + name: () => Helper.Translation.Get("options.showWeather"), + tooltip: () => Helper.Translation.Get("options.showWeather.desc"), getValue: () => Config.GamePresence.ShowWeather, setValue: value => Config.GamePresence.ShowWeather = value ); configMenu.AddBoolOption(mod, - name: () => "Show play time", - tooltip: () => "Show how long you've been playing", + name: () => Helper.Translation.Get("options.showPlaytime"), + tooltip: () => Helper.Translation.Get("options.showPlaytime.desc"), getValue: () => Config.GamePresence.ShowPlayTime, setValue: value => Config.GamePresence.ShowPlayTime = value ); @@ -272,9 +271,9 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { output += $"\n\n{nulls} tag{(nulls != 1 ? "s" : "")} unavailable."; return output; }); - configMenu.AddPageLink(mod, "alltags", () => "Click here to show all tags."); + configMenu.AddPageLink(mod, "alltags", () => Helper.Translation.Get("options.showAllTags")); - configMenu.AddPage(mod, "alltags", () => "All Tags"); + configMenu.AddPage(mod, "alltags", () => Helper.Translation.Get("options.allTags")); configMenu.AddParagraph(mod, () => FormatTags(out _, out _, format: "{{{0}}}: {1}", pad: false, all: true) ); @@ -282,30 +281,30 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { private void RPCModMenuSection(IGenericModConfigMenuApi api, MenuPresence conf) { var mod = ModManifest; - api.AddPageLink(mod, "tags", () => "Show available tags"); + api.AddPageLink(mod, "tags", () => Helper.Translation.Get("options.showAvailableTags")); api.AddTextOption(mod, - name: () => "Line 1 (State)", + name: () => Helper.Translation.Get("options.line1"), getValue: () => conf.State, setValue: value => conf.State = value ); api.AddTextOption(mod, - name: () => "Line 2 (Details)", + name: () => Helper.Translation.Get("options.line2"), getValue: () => conf.Details, setValue: value => conf.Details = value ); api.AddTextOption(mod, - name: () => "Large Image Text", + name: () => Helper.Translation.Get("options.largeImageText"), getValue: () => conf.LargeImageText, setValue: value => conf.LargeImageText = value ); api.AddTextOption(mod, - name: () => "Small Image Text", + name: () => Helper.Translation.Get("options.smallImageText"), getValue: () => conf.SmallImageText, setValue: value => conf.SmallImageText = value ); api.AddBoolOption(mod, - name: () => "Force small image", - tooltip: () => "Always show small image, even if small text is empty and weather isn't shown.", + name: () => Helper.Translation.Get("options.forceSmallImage"), + tooltip: () => Helper.Translation.Get("options.forceSmallImage.desc"), getValue: () => conf.ForceSmallImage, setValue: value => conf.ForceSmallImage = value ); @@ -316,9 +315,9 @@ private void HandleButton(object sender, ButtonReleasedEventArgs e) { return; try { LoadConfig(); - Game1.addHUDMessage(new HUDMessage("DiscordRP config reloaded.", HUDMessage.newQuest_type)); + Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("console.reloadConfig"), HUDMessage.newQuest_type)); } catch (Exception err) { - Game1.addHUDMessage(new HUDMessage("Failed to reload DiscordRP config. Check console.", HUDMessage.error_type)); + Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("console.reloadConfig.failed"), HUDMessage.error_type)); Monitor.Log(err.ToString(), LogLevel.Error); } } @@ -377,7 +376,7 @@ private RichPresence GetPresence() { presence.Timestamps = timestampSession; if (Config.AddGetModButton) presence.Buttons = new Button[] { - new() { Label = "Get SDV Rich Presence Mod", Url = "https://ruintd.github.io/SVRichPresence/" } + new() { Label = Helper.Translation.Get("getModButton"), Url = "https://ruintd.github.io/SVRichPresence/" } }; presence.Assets = assets; diff --git a/i18n/default.json b/i18n/default.json index 954ce83..2068fbf 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -1,4 +1,11 @@ { + // Console Output + "console.androidNotSupported": "Discord RPC is not supported on Android.", + "console.modInitialisationAbort": "Aborting mod initialization.", + "console.connectedToDiscord": "Connected to Discord", + "console.reloadConfig": "DiscordRP config reloaded.", + "console.reloadConfig.failed": "Failed to reload DiscordRP config. Check console.", + // GenericModConfigMenu "options.showGlobalPlaytime": "Show global playtime", "options.addGetModButton": "Add Get Mod Button", @@ -6,10 +13,36 @@ "options.preview": "Preview", "options.customizePresenceInMenus": "Customize Presence in Menus", "options.customizePresenceInGame": "Customize Presence in Game", + "options.line1": "Line 1 (State)", + "options.line2": "Line 2 (Details)", + "options.largeImageText": "Large image text", + "options.smallImageText": "Small image text", + "options.forceSmallImage": "Force small image", + "options.forceSmallImage.desc": "Always show small image, even if small text is empty and weather isn't shown.", + "options.showSeason": "Show season", + "options.showSeason.desc": "Show the current season on large image", + "options.showFarmType": "Show farm type", + "options.showFarmType.desc": "Show the farm type on large image", + "options.showWeather": "Show weather", + "options.showWeather.desc": "Show the current weather on small image", + "options.showPlaytime": "Show play time", + "options.showPlaytime.desc": "Show how long you've been playing", + "options.showAllTags": "Click here to show all tags", + "options.showAvailableTags": "Show available tags", + "options.allTags": "All tags", + "options.tagFrom": "1 tag from {{name}}", + "options.tagsFrom": "{{count}} tags from {{name}}", + "options.unknownMods": "unknown mods", + + // GamePresence + "gamePresence.gettingStarted": "Getting Started", + "gamePresence.startingNewGame": "Starting a New Game", "co-op": "co-op", "hosting": "Hosting", "playing": "Playing", - "solo": "solo" + "solo": "solo", + + "getModButton": "Get SDV Rich Presence Mod" } \ No newline at end of file From ad06517efb7331007fb6aec831cfb2ec43875674 Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Sat, 23 Mar 2024 09:00:32 +0100 Subject: [PATCH 05/11] Console Commands --- RichPresenceMod.cs | 19 ++++++++----------- i18n/default.json | 11 ++++++++++- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index ee4fb04..ee28c5d 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -39,32 +39,31 @@ public override void Entry(IModHelper helper) { client.SetSubscription(EventType.Join); client.RegisterUriScheme(steamId); client.OnReady += (sender, e) => - Monitor.Log(Helper.Translation.Get("console.connectedToDiscord") + " : " + e.User.ToString(), LogLevel.Info); + Monitor.Log($"{Helper.Translation.Get("console.connectedToDiscord")}: {e.User}", LogLevel.Info); client.Initialize(); #region Console Commands Helper.ConsoleCommands.Add("DiscordReload", - "Reloads the config for Discord Rich Presence.", + Helper.Translation.Get("command.discordreload.desc"), (string command, string[] args) => { LoadConfig(); - Monitor.Log("Config reloaded.", LogLevel.Info); } ); Helper.ConsoleCommands.Add("DiscordFormat", - "Formats and prints a provided configuration string.", + Helper.Translation.Get("command.discordformat.desc"), (string command, string[] args) => { string text = this.api.FormatText(string.Join(" ", args)); - Monitor.Log("Result: " + text, LogLevel.Info); + Monitor.Log($"{Helper.Translation.Get("command.discordformat.result")}: {text}", LogLevel.Info); } ); Helper.ConsoleCommands.Add("DiscordTags", - "Lists tags usable for configuration strings.", + Helper.Translation.Get("command.discordtags.desc"), (string command, string[] args) => { bool all = string.Join("", args).ToLower().StartsWith("all"); - string output = "Available tags:\n"; + string output = $"{Helper.Translation.Get("command.discordtags.availableTags")}:\n"; output += FormatTags(out _, out int nulls, format: " {{{0}}}: {1}", pad: true, all: all); if (nulls > 0) - output += $"\n\n{nulls} tag{(nulls != 1 ? "s" : "")} unavailable; type `DiscordTags all` to show all"; + output += $"\n\n{Helper.Translation.Get((nulls > 1 ? "command.discordtags.unavailableTags" : "command.discordtags.unavailableTag"), new {count = nulls})}"; Monitor.Log(output, LogLevel.Info); } ); @@ -181,9 +180,7 @@ void section(Dictionary group, string name) { if (count == 0) return; output.Add(""); - output.Add(count > 1 ? - Helper.Translation.Get("options.tagsFrom", new { count, name }) : - Helper.Translation.Get("options.tagFrom", new { name })); + output.Add(Helper.Translation.Get(count > 1 ? "options.tagsFrom" : "options.tagFrom", new { count, name })); list(group); } diff --git a/i18n/default.json b/i18n/default.json index 2068fbf..b6086a0 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -1,4 +1,13 @@ { + // Commands + "command.discordreload.desc": "Reloads the config for Discord Rich Presence.", + "command.discordformat.desc": "Formats and prints a provided configuration string.", + "command.discordformat.result": "Result", + "command.discordtags.desc": "Lists tags usable for configuration strings.", + "command.discordtags.availableTags": "Available tags", + "command.discordtags.unavailableTag": "{{count}} unavailable tag; type `discordtags all` to show all", + "command.discordtags.unavailableTags": "{{count}} unavailable tags; type `discordtags all` to show all", + // Console Output "console.androidNotSupported": "Discord RPC is not supported on Android.", "console.modInitialisationAbort": "Aborting mod initialization.", @@ -30,7 +39,7 @@ "options.showAllTags": "Click here to show all tags", "options.showAvailableTags": "Show available tags", "options.allTags": "All tags", - "options.tagFrom": "1 tag from {{name}}", + "options.tagFrom": "{{count}} tag from {{name}}", "options.tagsFrom": "{{count}} tags from {{name}}", "options.unknownMods": "unknown mods", From b52bc99c202f824250abf911132ab8ad0f05113a Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Sat, 23 Mar 2024 09:07:49 +0100 Subject: [PATCH 06/11] Filling missing keys --- i18n/fr.json | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/i18n/fr.json b/i18n/fr.json index a1991c8..715319b 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -1,4 +1,20 @@ { + // Commands + "command.discordreload.desc": "Reloads the config for Discord Rich Presence.", + "command.discordformat.desc": "Formats and prints a provided configuration string.", + "command.discordformat.result": "Result", + "command.discordtags.desc": "Lists tags usable for configuration strings.", + "command.discordtags.availableTags": "Available tags", + "command.discordtags.unavailableTag": "{{count}} unavailable tag; type `discordtags all` to show all", + "command.discordtags.unavailableTags": "{{count}} unavailable tags; type `discordtags all` to show all", + + // Console Output + "console.androidNotSupported": "Discord RPC is not supported on Android.", + "console.modInitialisationAbort": "Aborting mod initialization.", + "console.connectedToDiscord": "Connected to Discord", + "console.reloadConfig": "DiscordRP config reloaded.", + "console.reloadConfig.failed": "Failed to reload DiscordRP config. Check console.", + // GenericModConfigMenu "options.showGlobalPlaytime": "Affiche le temps de jeu global", "options.addGetModButton": "Ajoute un bouton 'Obtenir le mod'", @@ -6,9 +22,36 @@ "options.preview": "Aperçu", "options.customizePresenceInMenus": "Personnaliser l'Activité dans le menu", "options.customizePresenceInGame": "Personnaliser l'Activité dans le jeu", + "options.line1": "Line 1 (State)", + "options.line2": "Line 2 (Details)", + "options.largeImageText": "Large image text", + "options.smallImageText": "Small image text", + "options.forceSmallImage": "Force small image", + "options.forceSmallImage.desc": "Always show small image, even if small text is empty and weather isn't shown.", + "options.showSeason": "Show season", + "options.showSeason.desc": "Show the current season on large image", + "options.showFarmType": "Show farm type", + "options.showFarmType.desc": "Show the farm type on large image", + "options.showWeather": "Show weather", + "options.showWeather.desc": "Show the current weather on small image", + "options.showPlaytime": "Show play time", + "options.showPlaytime.desc": "Show how long you've been playing", + "options.showAllTags": "Click here to show all tags", + "options.showAvailableTags": "Show available tags", + "options.allTags": "All tags", + "options.tagFrom": "{{count}} tag from {{name}}", + "options.tagsFrom": "{{count}} tags from {{name}}", + "options.unknownMods": "unknown mods", + + + // GamePresence + "gamePresence.gettingStarted": "Getting Started", + "gamePresence.startingNewGame": "Starting a New Game", "co-op": "co-op", "hosting": "Héberge", "playing": "Joue", - "solo": "solo" + "solo": "solo", + + "getModButton": "Get SDV Rich Presence Mod" } \ No newline at end of file From 282edc0c561c31e2dbfebf57f77f84b43d5f3345 Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Sat, 23 Mar 2024 09:36:43 +0100 Subject: [PATCH 07/11] French translation --- RichPresenceMod.cs | 2 +- i18n/default.json | 6 ++-- i18n/fr.json | 70 +++++++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index ee28c5d..718eb60 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -265,7 +265,7 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) { configMenu.AddPage(mod, "tags", () => "Tags"); configMenu.AddParagraph(mod, () => { string output = FormatTags(out _, out int nulls, pad: false); - output += $"\n\n{nulls} tag{(nulls != 1 ? "s" : "")} unavailable."; + output += $"\n\n{Helper.Translation.Get((nulls > 1 ? "options.unavailableTags" : "options.unavailableTag"), new { count = nulls })}"; return output; }); configMenu.AddPageLink(mod, "alltags", () => Helper.Translation.Get("options.showAllTags")); diff --git a/i18n/default.json b/i18n/default.json index b6086a0..c27fc34 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -9,11 +9,11 @@ "command.discordtags.unavailableTags": "{{count}} unavailable tags; type `discordtags all` to show all", // Console Output - "console.androidNotSupported": "Discord RPC is not supported on Android.", + "console.androidNotSupported": "DiscordRP is not supported on Android.", "console.modInitialisationAbort": "Aborting mod initialization.", "console.connectedToDiscord": "Connected to Discord", "console.reloadConfig": "DiscordRP config reloaded.", - "console.reloadConfig.failed": "Failed to reload DiscordRP config. Check console.", + "console.reloadConfig.failed": "Failed to reload Discord RPC config. Check console.", // GenericModConfigMenu "options.showGlobalPlaytime": "Show global playtime", @@ -38,6 +38,8 @@ "options.showPlaytime.desc": "Show how long you've been playing", "options.showAllTags": "Click here to show all tags", "options.showAvailableTags": "Show available tags", + "options.unavailableTag": "{{count}} unavailable tag", + "options.unavailableTags": "{{count}} unavailable tags", "options.allTags": "All tags", "options.tagFrom": "{{count}} tag from {{name}}", "options.tagsFrom": "{{count}} tags from {{name}}", diff --git a/i18n/fr.json b/i18n/fr.json index 715319b..bad7f8f 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -1,19 +1,19 @@ { // Commands - "command.discordreload.desc": "Reloads the config for Discord Rich Presence.", - "command.discordformat.desc": "Formats and prints a provided configuration string.", - "command.discordformat.result": "Result", - "command.discordtags.desc": "Lists tags usable for configuration strings.", - "command.discordtags.availableTags": "Available tags", - "command.discordtags.unavailableTag": "{{count}} unavailable tag; type `discordtags all` to show all", - "command.discordtags.unavailableTags": "{{count}} unavailable tags; type `discordtags all` to show all", + "command.discordreload.desc": "Recharge la configuration pour Discord Rich Presence.", + "command.discordformat.desc": "Met en forme et affiche le résultat de la configuration donnée.", + "command.discordformat.result": "Resultat", + "command.discordtags.desc": "Liste les tags utilisables pour la configuration.", + "command.discordtags.availableTags": "Tags disponibles", + "command.discordtags.unavailableTag": "{{count}} tag indisponible; Faites `discordtags all` pour tout afficher", + "command.discordtags.unavailableTags": "{{count}} tags indisponibles; Faites `discordtags all` pour tout afficher", // Console Output - "console.androidNotSupported": "Discord RPC is not supported on Android.", - "console.modInitialisationAbort": "Aborting mod initialization.", - "console.connectedToDiscord": "Connected to Discord", - "console.reloadConfig": "DiscordRP config reloaded.", - "console.reloadConfig.failed": "Failed to reload DiscordRP config. Check console.", + "console.androidNotSupported": "DiscordRP n'est pas supporté sur Android'.", + "console.modInitialisationAbort": "Initialisation du mod annulée.", + "console.connectedToDiscord": "Connecté à Discord", + "console.reloadConfig": "DiscordRP configuration rechargée.", + "console.reloadConfig.failed": "Échec du rechargement de la configuration de Discord RP. Consultez la console.", // GenericModConfigMenu "options.showGlobalPlaytime": "Affiche le temps de jeu global", @@ -22,36 +22,36 @@ "options.preview": "Aperçu", "options.customizePresenceInMenus": "Personnaliser l'Activité dans le menu", "options.customizePresenceInGame": "Personnaliser l'Activité dans le jeu", - "options.line1": "Line 1 (State)", - "options.line2": "Line 2 (Details)", - "options.largeImageText": "Large image text", - "options.smallImageText": "Small image text", - "options.forceSmallImage": "Force small image", - "options.forceSmallImage.desc": "Always show small image, even if small text is empty and weather isn't shown.", - "options.showSeason": "Show season", - "options.showSeason.desc": "Show the current season on large image", - "options.showFarmType": "Show farm type", - "options.showFarmType.desc": "Show the farm type on large image", - "options.showWeather": "Show weather", - "options.showWeather.desc": "Show the current weather on small image", - "options.showPlaytime": "Show play time", - "options.showPlaytime.desc": "Show how long you've been playing", - "options.showAllTags": "Click here to show all tags", - "options.showAvailableTags": "Show available tags", - "options.allTags": "All tags", - "options.tagFrom": "{{count}} tag from {{name}}", - "options.tagsFrom": "{{count}} tags from {{name}}", - "options.unknownMods": "unknown mods", + "options.line1": "Ligne 1 (État)", + "options.line2": "Ligne 2 (Détails)", + "options.largeImageText": "Texte de la grande image", + "options.smallImageText": "Texte de la petite image", + "options.forceSmallImage": "Forcer la petite image", + "options.forceSmallImage.desc": "Toujours forcer la petite image, même si le texte est vide et que la météo ne s'affiche pas.", + "options.showSeason": "Afficher la saison", + "options.showSeason.desc": "Affiche la saison actuelle sur la grande image.", + "options.showFarmType": "Afficher le type de ferme", + "options.showFarmType.desc": "Affiche le type de ferme actuelle sur la grande image.", + "options.showWeather": "Afficher la météo", + "options.showWeather.desc": "Affiche la météo actuelle sur la grande image.", + "options.showPlaytime": "Afficher le temps de jeu", + "options.showPlaytime.desc": "Affiche depuis combien de temps vous jouez.", + "options.showAllTags": "Cliquer ici pour afficher tous les tags", + "options.showAvailableTags": "Afficher les tags disponibles", + "options.allTags": "Tous les tags", + "options.tagFrom": "{{count}} tag de {{name}}", + "options.tagsFrom": "{{count}} tags de {{name}}", + "options.unknownMods": "mods inconnus", // GamePresence - "gamePresence.gettingStarted": "Getting Started", - "gamePresence.startingNewGame": "Starting a New Game", + "gamePresence.gettingStarted": "Vient de commencer", + "gamePresence.startingNewGame": "Démarre une nouvelle partie", "co-op": "co-op", "hosting": "Héberge", "playing": "Joue", "solo": "solo", - "getModButton": "Get SDV Rich Presence Mod" + "getModButton": "Obtenir SDV Rich Presence" } \ No newline at end of file From 1763718364514d170cf693643455b20d17c92cf5 Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Sat, 23 Mar 2024 10:08:37 +0100 Subject: [PATCH 08/11] Update fr.json --- i18n/fr.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/i18n/fr.json b/i18n/fr.json index bad7f8f..c50c68d 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -38,6 +38,8 @@ "options.showPlaytime.desc": "Affiche depuis combien de temps vous jouez.", "options.showAllTags": "Cliquer ici pour afficher tous les tags", "options.showAvailableTags": "Afficher les tags disponibles", + "options.unavailableTag": "{{count}} tag indisponible", + "options.unavailableTags": "{{count}} tags indisponibles", "options.allTags": "Tous les tags", "options.tagFrom": "{{count}} tag de {{name}}", "options.tagsFrom": "{{count}} tags de {{name}}", From 8410a74dfe1d49bc0ac48561ab57139b4e1c7af9 Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Sun, 24 Mar 2024 21:12:56 +0100 Subject: [PATCH 09/11] Translation update --- i18n/default.json | 7 +++---- i18n/fr.json | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/i18n/default.json b/i18n/default.json index c27fc34..c9f174e 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -50,10 +50,9 @@ "gamePresence.gettingStarted": "Getting Started", "gamePresence.startingNewGame": "Starting a New Game", - "co-op": "co-op", - "hosting": "Hosting", - "playing": "Playing", - "solo": "solo", + "hostingCoop": "Hosting coop", + "playingCoop": "Playing coop", + "playingSolo": "Playing solo", "getModButton": "Get SDV Rich Presence Mod" } \ No newline at end of file diff --git a/i18n/fr.json b/i18n/fr.json index c50c68d..bbf90b2 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -50,10 +50,9 @@ "gamePresence.gettingStarted": "Vient de commencer", "gamePresence.startingNewGame": "Démarre une nouvelle partie", - "co-op": "co-op", - "hosting": "Héberge", - "playing": "Joue", - "solo": "solo", + "hostingCoop": "Héberge en co-op", + "playingCoop": "Joue en co-op", + "playingSolo": "Joue en solo", "getModButton": "Obtenir SDV Rich Presence" } \ No newline at end of file From d731a080177df0c50c6a193a5d97c330f5f4b70c Mon Sep 17 00:00:00 2001 From: RuiNtD Date: Mon, 25 Mar 2024 01:55:20 -0600 Subject: [PATCH 10/11] Touch-ups for i18n Includes adding ModTranslationClassBuilder --- ModConfig.cs | 2 +- RichPresenceMod.cs | 196 ++++++++++++++++++++++++------------------ SVRichPresence.csproj | 1 + i18n/default.json | 73 ++++++++-------- i18n/fr.json | 73 ++++++++-------- 5 files changed, 183 insertions(+), 162 deletions(-) diff --git a/ModConfig.cs b/ModConfig.cs index 0a359d8..88ad598 100644 --- a/ModConfig.cs +++ b/ModConfig.cs @@ -13,11 +13,11 @@ internal class ModConfig internal class MenuPresence { - public bool ForceSmallImage = false; public string State = "In Menus"; public string Details = ""; public string LargeImageText = "{ Activity }"; public string SmallImageText = ""; + public bool ForceSmallImage = false; } internal class GamePresence : MenuPresence diff --git a/RichPresenceMod.cs b/RichPresenceMod.cs index 0fdce5e..85e8b78 100644 --- a/RichPresenceMod.cs +++ b/RichPresenceMod.cs @@ -25,6 +25,7 @@ public class RichPresenceMod : Mod public override void Entry(IModHelper helper) { + I18n.Init(Helper.Translation); api = new RichPresenceAPI(this); client = new DiscordRpcClient( clientId, @@ -34,34 +35,37 @@ public override void Entry(IModHelper helper) client.SetSubscription(EventType.Join); client.RegisterUriScheme(steamId); client.OnReady += (sender, e) => - Monitor.Log($"{Helper.Translation.Get("console.connectedToDiscord")}: {e.User}", LogLevel.Info); + Monitor.Log(I18n.Console_DiscordConnected(e.User.ToString()), LogLevel.Info); client.Initialize(); #region Console Commands Helper.ConsoleCommands.Add( "DiscordReload", - Helper.Translation.Get("command.discordreload.desc"), - (string command, string[] args) => { - LoadConfig(); + I18n.Command_Reload_Desc(), + (string command, string[] args) => + { + LoadConfig(); } ); Helper.ConsoleCommands.Add( "DiscordFormat", - Helper.Translation.Get("command.discordformat.desc"), - (string command, string[] args) => { + I18n.Command_Format_Desc(), + (string command, string[] args) => + { string text = this.api.FormatText(string.Join(" ", args)); - Monitor.Log($"{Helper.Translation.Get("command.discordformat.result")}: {text}", LogLevel.Info); + Monitor.Log(I18n.Command_Format_Result(text), LogLevel.Info); } ); Helper.ConsoleCommands.Add( "DiscordTags", - Helper.Translation.Get("command.discordtags.desc"), - (string command, string[] args) => { + I18n.Command_Tags_Desc(), + (string command, string[] args) => + { bool all = string.Join("", args).ToLower().StartsWith("all"); - string output = $"{Helper.Translation.Get("command.discordtags.availableTags")}:\n"; - output += FormatTags(out _, out int nulls, format: " {{{0}}}: {1}", pad: true, all: all); + string output = $"{I18n.TagList_Header()}\n"; + output += FormatTags(out int nulls, format: " {{{0}}}: {1}", pad: true, all: all); if (nulls > 0) - output += $"\n\n{Helper.Translation.Get((nulls > 1 ? "command.discordtags.unavailableTags" : "command.discordtags.unavailableTag"), new {count = nulls})}"; + output += $"\n\n{I18n.Command_Tags_Nulls(nulls)}"; Monitor.Log(output, LogLevel.Info); } ); @@ -74,9 +78,9 @@ public override void Entry(IModHelper helper) Helper.Events.GameLoop.SaveLoaded += SetTimestamp; Helper.Events.GameLoop.ReturnedToTitle += SetTimestamp; Helper.Events.GameLoop.SaveLoaded += (object sender, SaveLoadedEventArgs e) => - api.GamePresence = Helper.Translation.Get("gamePresence.gettingStarted"); + api.GamePresence = I18n.GamePresence_GettingStarted(); Helper.Events.GameLoop.SaveCreated += (object sender, SaveCreatedEventArgs e) => - api.GamePresence = Helper.Translation.Get("gamePresence.startingNewGame"); + api.GamePresence = I18n.GamePresence_StartingNewGame(); Helper.Events.GameLoop.GameLaunched += (object sender, GameLaunchedEventArgs e) => { SetTimestamp(); @@ -174,9 +178,9 @@ public override void Entry(IModHelper helper) () => Context.IsMultiplayer ? Context.IsMainPlayer - ? Helper.Translation.Get("hostingCoop") - : Helper.Translation.Get("playingCoop") - : Helper.Translation.Get("playingSolo") + ? I18n.HostingCoop() + : I18n.PlayingCoop() + : I18n.PlayingSolo() ); #endregion } @@ -195,7 +199,6 @@ private void WTag(string tag, Func func) => ); private string FormatTags( - out int count, out int nulls, string format = "{{{0}}}: {1}", bool pad = false, @@ -204,7 +207,6 @@ private string FormatTags( { var tags = api.ResolveAllTags(); nulls = 0; - count = 0; Dictionary> groups = new(); foreach (var tag in tags) @@ -224,7 +226,6 @@ private string FormatTags( if (!tag.Value.Success) val = "[ERROR]"; groups[owner][tag.Key] = val; - count++; } } @@ -245,7 +246,10 @@ void section(Dictionary group, string name) return; output.Add(""); - output.Add(Helper.Translation.Get(count > 1 ? "options.tagsFrom" : "options.tagFrom", new { count, name })); + if (name != "") + output.Add(I18n.TagList_ModHeader(count, name)); + else + output.Add(I18n.TagList_UnknownModsHeader(count)); list(group); } @@ -259,7 +263,7 @@ void section(Dictionary group, string name) continue; section(group.Value, group.Key); } - section(groups[""], Helper.Translation.Get("options.unknownMods")); + section(groups[""], ""); return string.Join("\n", output); } @@ -278,100 +282,117 @@ private void RegisterConfigMenu(object sender, GameLaunchedEventArgs e) configMenu.Register(mod, reset: () => Config = new ModConfig(), save: () => SaveConfig()); - configMenu.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.showGlobalPlaytime"), - getValue: () => Config.ShowGlobalPlayTime, - setValue: value => Config.ShowGlobalPlayTime = value + configMenu.AddBoolOption( + mod, + name: () => I18n.Options_ShowGlobalPlayTime(), + getValue: () => Config.ShowGlobalPlayTime, + setValue: value => Config.ShowGlobalPlayTime = value + ); + configMenu.AddBoolOption( + mod, + name: () => I18n.Options_AddGetModButton(), + tooltip: () => I18n.Options_AddGetModButton_Desc(), + getValue: () => Config.AddGetModButton, + setValue: value => Config.AddGetModButton = value ); - configMenu.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.addGetModButton"), - tooltip: () => Helper.Translation.Get("options.addGetModButton.desc"), - getValue: () => Config.AddGetModButton, - setValue: value => Config.AddGetModButton = value + + configMenu.AddSectionTitle(mod, () => I18n.Options_Preview()); + configMenu.AddParagraph( + mod, + () => + { + var text = $"{api.FormatText(Conf.State)}\n"; + text += $"{api.FormatText(Conf.Details)}\n"; + text += $"{api.FormatText(Conf.LargeImageText)}\n"; + text += $"{api.FormatText(Conf.SmallImageText)}\n"; + return text; + } ); - configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.preview")); - configMenu.AddParagraph(mod, () => { - var text = api.FormatText(Conf.State) + "\n"; - text += api.FormatText(Conf.Details) + "\n"; - var large = api.FormatText(Conf.LargeImageText); - if (large.Length > 0) text += $"{Helper.Translation.Get("options.largeImageText")}: {large}\n"; - var small = api.FormatText(Conf.SmallImageText); - if (small.Length > 0) text += $"{Helper.Translation.Get("options.smallImageText")}: {small}\n"; - return text; - }); - - configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.customizePresenceInMenus")); + configMenu.AddSectionTitle(mod, () => I18n.Options_MenuPresence()); RPCModMenuSection(configMenu, Config.MenuPresence); - configMenu.AddSectionTitle(mod, () => Helper.Translation.Get("options.customizePresenceInGame")); + configMenu.AddSectionTitle(mod, () => I18n.Options_GamePresence()); RPCModMenuSection(configMenu, Config.GamePresence); - configMenu.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.showSeason"), - tooltip: () => Helper.Translation.Get("options.showSeason.desc"), + configMenu.AddBoolOption( + mod, + name: () => I18n.Options_ShowSeason(), + tooltip: () => I18n.Options_ShowSeason_Desc(), getValue: () => Config.GamePresence.ShowSeason, setValue: value => Config.GamePresence.ShowSeason = value - ); - configMenu.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.showFarmType"), - tooltip: () => Helper.Translation.Get("options.showFarmType.desc"), + ); + configMenu.AddBoolOption( + mod, + name: () => I18n.Options_ShowFarmType(), + tooltip: () => I18n.Options_ShowFarmType_Desc(), getValue: () => Config.GamePresence.ShowFarmType, setValue: value => Config.GamePresence.ShowFarmType = value ); - configMenu.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.showWeather"), - tooltip: () => Helper.Translation.Get("options.showWeather.desc"), + configMenu.AddBoolOption( + mod, + name: () => I18n.Options_ShowWeather(), + tooltip: () => I18n.Options_ShowWeather_Desc(), getValue: () => Config.GamePresence.ShowWeather, setValue: value => Config.GamePresence.ShowWeather = value ); - configMenu.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.showPlaytime"), - tooltip: () => Helper.Translation.Get("options.showPlaytime.desc"), + configMenu.AddBoolOption( + mod, + name: () => I18n.Options_ShowPlayTime(), + tooltip: () => I18n.Options_ShowPlayTime_Desc(), getValue: () => Config.GamePresence.ShowPlayTime, setValue: value => Config.GamePresence.ShowPlayTime = value ); - configMenu.AddPage(mod, "tags", () => "Tags"); - configMenu.AddParagraph(mod, () => { - string output = FormatTags(out _, out int nulls, pad: false); - output += $"\n\n{Helper.Translation.Get((nulls > 1 ? "options.unavailableTags" : "options.unavailableTag"), new { count = nulls })}"; - return output; - }); - configMenu.AddPageLink(mod, "alltags", () => Helper.Translation.Get("options.showAllTags")); - - configMenu.AddPage(mod, "alltags", () => Helper.Translation.Get("options.allTags")); - configMenu.AddParagraph(mod, () => - FormatTags(out _, out _, format: "{{{0}}}: {1}", pad: false, all: true) + // Tags Page + configMenu.AddPage(mod, "tags", () => I18n.Options_Page_Tags()); + configMenu.AddParagraph( + mod, + () => + { + string output = FormatTags(out int nulls, pad: false); + output += $"\n\n{I18n.Options_UnavailableTags(nulls)}"; + return output; + } ); + configMenu.AddPageLink(mod, "alltags", () => I18n.Options_ShowAllTags()); + + // All Tags Page + configMenu.AddPage(mod, "alltags", () => I18n.Options_Page_AllTags()); + configMenu.AddParagraph(mod, () => FormatTags(out _, "{{{0}}}: {1}", pad: false, all: true)); } private void RPCModMenuSection(IGenericModConfigMenuApi api, MenuPresence conf) { var mod = ModManifest; - api.AddPageLink(mod, "tags", () => Helper.Translation.Get("options.showAvailableTags")); - api.AddTextOption(mod, - name: () => Helper.Translation.Get("options.line1"), + api.AddPageLink(mod, "tags", () => I18n.Options_ShowAvailableTags()); + api.AddTextOption( + mod, + name: () => I18n.Options_State(), getValue: () => conf.State, setValue: value => conf.State = value ); - api.AddTextOption(mod, - name: () => Helper.Translation.Get("options.line2"), + api.AddTextOption( + mod, + name: () => I18n.Options_Details(), getValue: () => conf.Details, setValue: value => conf.Details = value ); - api.AddTextOption(mod, - name: () => Helper.Translation.Get("options.largeImageText"), + api.AddTextOption( + mod, + name: () => I18n.Options_LargeImageText(), getValue: () => conf.LargeImageText, setValue: value => conf.LargeImageText = value ); - api.AddTextOption(mod, - name: () => Helper.Translation.Get("options.smallImageText"), + api.AddTextOption( + mod, + name: () => I18n.Options_SmallImageText(), getValue: () => conf.SmallImageText, setValue: value => conf.SmallImageText = value ); - api.AddBoolOption(mod, - name: () => Helper.Translation.Get("options.forceSmallImage"), - tooltip: () => Helper.Translation.Get("options.forceSmallImage.desc"), + api.AddBoolOption( + mod, + name: () => I18n.Options_ForceSmallImage(), + tooltip: () => I18n.Options_ForceSmallImage_Desc(), getValue: () => conf.ForceSmallImage, setValue: value => conf.ForceSmallImage = value ); @@ -384,9 +405,13 @@ private void HandleButton(object sender, ButtonReleasedEventArgs e) try { LoadConfig(); - Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("console.reloadConfig"), HUDMessage.newQuest_type)); - } catch (Exception err) { - Game1.addHUDMessage(new HUDMessage(Helper.Translation.Get("console.reloadConfig.failed"), HUDMessage.error_type)); + Game1.addHUDMessage(new HUDMessage(I18n.Notify_ReloadConfig(), HUDMessage.newQuest_type)); + } + catch (Exception err) + { + Game1.addHUDMessage( + new HUDMessage(I18n.Notify_ReloadConfig_Failed(), HUDMessage.error_type) + ); Monitor.Log(err.ToString(), LogLevel.Error); } } @@ -453,8 +478,9 @@ private RichPresence GetPresence() if (Config.ShowGlobalPlayTime) presence.Timestamps = timestampSession; if (Config.AddGetModButton) - presence.Buttons = new Button[] { - new() { Label = Helper.Translation.Get("getModButton"), Url = ModURL } + presence.Buttons = new Button[] + { + new() { Label = I18n.GetModButton(), Url = ModURL } }; presence.Assets = assets; diff --git a/SVRichPresence.csproj b/SVRichPresence.csproj index 1a0a8e8..fa38715 100644 --- a/SVRichPresence.csproj +++ b/SVRichPresence.csproj @@ -6,5 +6,6 @@ + diff --git a/i18n/default.json b/i18n/default.json index c9f174e..1ec2f6f 100644 --- a/i18n/default.json +++ b/i18n/default.json @@ -1,50 +1,47 @@ { // Commands - "command.discordreload.desc": "Reloads the config for Discord Rich Presence.", - "command.discordformat.desc": "Formats and prints a provided configuration string.", - "command.discordformat.result": "Result", - "command.discordtags.desc": "Lists tags usable for configuration strings.", - "command.discordtags.availableTags": "Available tags", - "command.discordtags.unavailableTag": "{{count}} unavailable tag; type `discordtags all` to show all", - "command.discordtags.unavailableTags": "{{count}} unavailable tags; type `discordtags all` to show all", + "command.reload.desc": "Reloads the config for Discord Rich Presence.", + "command.format.desc": "Formats and prints a provided configuration string.", + "command.format.result": "Result: {{result}}", + "command.tags.desc": "Lists tags usable for configuration strings.", + "command.tags.nulls": "{{count}} tags are unavailable; type `discordtags all` to show all", // Console Output - "console.androidNotSupported": "DiscordRP is not supported on Android.", - "console.modInitialisationAbort": "Aborting mod initialization.", - "console.connectedToDiscord": "Connected to Discord", - "console.reloadConfig": "DiscordRP config reloaded.", - "console.reloadConfig.failed": "Failed to reload Discord RPC config. Check console.", + "console.discordConnected": "Connected to Discord: {{user}}", + "notify.reloadConfig": "DiscordRP config reloaded.", + "notify.reloadConfig.failed": "Failed to reload Discord RPC config. Check console.", - // GenericModConfigMenu - "options.showGlobalPlaytime": "Show global playtime", - "options.addGetModButton": "Add Get Mod Button", - "options.addGetModButton.desc": "Support the mod by adding a link to it on your rich presence.", + // Config Menu + "options.ShowGlobalPlayTime": "Show global playtime", + "options.AddGetModButton": "Add Get Mod Button", + "options.AddGetModButton.desc": "Support the mod by adding a link to it on your rich presence.", "options.preview": "Preview", - "options.customizePresenceInMenus": "Customize Presence in Menus", - "options.customizePresenceInGame": "Customize Presence in Game", - "options.line1": "Line 1 (State)", - "options.line2": "Line 2 (Details)", + "options.MenuPresence": "Customize Presence in Menus", + "options.GamePresence": "Customize Presence in Game", + "options.State": "Line 1 (State)", + "options.Details": "Line 2 (Details)", "options.largeImageText": "Large image text", - "options.smallImageText": "Small image text", - "options.forceSmallImage": "Force small image", - "options.forceSmallImage.desc": "Always show small image, even if small text is empty and weather isn't shown.", - "options.showSeason": "Show season", - "options.showSeason.desc": "Show the current season on large image", - "options.showFarmType": "Show farm type", - "options.showFarmType.desc": "Show the farm type on large image", - "options.showWeather": "Show weather", - "options.showWeather.desc": "Show the current weather on small image", - "options.showPlaytime": "Show play time", - "options.showPlaytime.desc": "Show how long you've been playing", - "options.showAllTags": "Click here to show all tags", + "options.SmallImageText": "Small image text", + "options.ForceSmallImage": "Force small image", + "options.ForceSmallImage.desc": "Always show small image, even if small text is empty and weather isn't shown.", + "options.ShowSeason": "Show season", + "options.ShowSeason.desc": "Show the current season on large image", + "options.ShowFarmType": "Show farm type", + "options.ShowFarmType.desc": "Show the farm type on large image", + "options.ShowWeather": "Show weather", + "options.ShowWeather.desc": "Show the current weather on small image", + "options.ShowPlayTime": "Show play time", + "options.ShowPlayTime.desc": "Show how long you've been playing", "options.showAvailableTags": "Show available tags", - "options.unavailableTag": "{{count}} unavailable tag", - "options.unavailableTags": "{{count}} unavailable tags", - "options.allTags": "All tags", - "options.tagFrom": "{{count}} tag from {{name}}", - "options.tagsFrom": "{{count}} tags from {{name}}", - "options.unknownMods": "unknown mods", + "options.showAllTags": "Click here to show all tags", + "options.unavailableTags": "{{count}} tags are unavailable", + + "options.page.tags": "Tags", + "options.page.allTags": "All Tags", + "tagList.header": "Available tags:", + "tagList.modHeader": "{{count}} tags from {{name}}:", + "tagList.unknownModsHeader": "{{count}} tags from unknown mods:", // GamePresence "gamePresence.gettingStarted": "Getting Started", diff --git a/i18n/fr.json b/i18n/fr.json index bbf90b2..5071776 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -1,50 +1,47 @@ { // Commands - "command.discordreload.desc": "Recharge la configuration pour Discord Rich Presence.", - "command.discordformat.desc": "Met en forme et affiche le résultat de la configuration donnée.", - "command.discordformat.result": "Resultat", - "command.discordtags.desc": "Liste les tags utilisables pour la configuration.", - "command.discordtags.availableTags": "Tags disponibles", - "command.discordtags.unavailableTag": "{{count}} tag indisponible; Faites `discordtags all` pour tout afficher", - "command.discordtags.unavailableTags": "{{count}} tags indisponibles; Faites `discordtags all` pour tout afficher", + "command.reload.desc": "Recharge la configuration pour Discord Rich Presence.", + "command.format.desc": "Met en forme et affiche le résultat de la configuration donnée.", + "command.format.result": "Resultat: {{result}}", + "command.tags.desc": "Liste les tags utilisables pour la configuration.", + "command.tags.nulls": "{{count}} tags indisponibles; Faites `discordtags all` pour tout afficher", // Console Output - "console.androidNotSupported": "DiscordRP n'est pas supporté sur Android'.", - "console.modInitialisationAbort": "Initialisation du mod annulée.", - "console.connectedToDiscord": "Connecté à Discord", - "console.reloadConfig": "DiscordRP configuration rechargée.", - "console.reloadConfig.failed": "Échec du rechargement de la configuration de Discord RP. Consultez la console.", + "console.discordConnected": "Connecté à Discord: {{user}}", + "notify.reloadConfig": "DiscordRP configuration rechargée.", + "notify.reloadConfig.failed": "Échec du rechargement de la configuration de Discord RP. Consultez la console.", - // GenericModConfigMenu - "options.showGlobalPlaytime": "Affiche le temps de jeu global", - "options.addGetModButton": "Ajoute un bouton 'Obtenir le mod'", - "options.addGetModButton.desc": "Supporter le mod en ajoutant un lien pour le télécharger dans l'activité.", + // Config Menu + "options.ShowGlobalPlayTime": "Affiche le temps de jeu global", + "options.AddGetModButton": "Ajoute un bouton 'Obtenir le mod'", + "options.AddGetModButton.desc": "Supporter le mod en ajoutant un lien pour le télécharger dans l'activité.", "options.preview": "Aperçu", - "options.customizePresenceInMenus": "Personnaliser l'Activité dans le menu", - "options.customizePresenceInGame": "Personnaliser l'Activité dans le jeu", - "options.line1": "Ligne 1 (État)", - "options.line2": "Ligne 2 (Détails)", - "options.largeImageText": "Texte de la grande image", - "options.smallImageText": "Texte de la petite image", - "options.forceSmallImage": "Forcer la petite image", - "options.forceSmallImage.desc": "Toujours forcer la petite image, même si le texte est vide et que la météo ne s'affiche pas.", - "options.showSeason": "Afficher la saison", - "options.showSeason.desc": "Affiche la saison actuelle sur la grande image.", - "options.showFarmType": "Afficher le type de ferme", - "options.showFarmType.desc": "Affiche le type de ferme actuelle sur la grande image.", - "options.showWeather": "Afficher la météo", - "options.showWeather.desc": "Affiche la météo actuelle sur la grande image.", - "options.showPlaytime": "Afficher le temps de jeu", - "options.showPlaytime.desc": "Affiche depuis combien de temps vous jouez.", - "options.showAllTags": "Cliquer ici pour afficher tous les tags", + "options.MenuPresence": "Personnaliser l'Activité dans le menu", + "options.GamePresence": "Personnaliser l'Activité dans le jeu", + "options.State": "Ligne 1 (État)", + "options.Details": "Ligne 2 (Détails)", + "options.LargeImageText": "Texte de la grande image", + "options.SmallImageText": "Texte de la petite image", + "options.ForceSmallImage": "Forcer la petite image", + "options.ForceSmallImage.desc": "Toujours forcer la petite image, même si le texte est vide et que la météo ne s'affiche pas.", + "options.ShowSeason": "Afficher la saison", + "options.ShowSeason.desc": "Affiche la saison actuelle sur la grande image.", + "options.ShowFarmType": "Afficher le type de ferme", + "options.ShowFarmType.desc": "Affiche le type de ferme actuelle sur la grande image.", + "options.ShowWeather": "Afficher la météo", + "options.ShowWeather.desc": "Affiche la météo actuelle sur la grande image.", + "options.ShowPlayTime": "Afficher le temps de jeu", + "options.ShowPlayTime.desc": "Affiche depuis combien de temps vous jouez.", "options.showAvailableTags": "Afficher les tags disponibles", - "options.unavailableTag": "{{count}} tag indisponible", + "options.showAllTags": "Cliquer ici pour afficher tous les tags", "options.unavailableTags": "{{count}} tags indisponibles", - "options.allTags": "Tous les tags", - "options.tagFrom": "{{count}} tag de {{name}}", - "options.tagsFrom": "{{count}} tags de {{name}}", - "options.unknownMods": "mods inconnus", + "options.page.tags": "Tags", + "options.page.allTags": "Tous les Tags", + + "options.header": "Tags disponibles:", + "options.modHeader": "{{count}} tags de {{name}}:", + "options.unknownModsHeader": "{{count}} tags de mods inconnus:", // GamePresence "gamePresence.gettingStarted": "Vient de commencer", From e64366b95123df79c4b939cc1f422a0bcfb56583 Mon Sep 17 00:00:00 2001 From: Tenebrosful Date: Mon, 25 Mar 2024 10:06:27 +0100 Subject: [PATCH 11/11] Update fr.json --- i18n/fr.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i18n/fr.json b/i18n/fr.json index 5071776..a901698 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -39,9 +39,9 @@ "options.page.tags": "Tags", "options.page.allTags": "Tous les Tags", - "options.header": "Tags disponibles:", - "options.modHeader": "{{count}} tags de {{name}}:", - "options.unknownModsHeader": "{{count}} tags de mods inconnus:", + "tagList.header": "Tags disponibles:", + "tagList.modHeader": "{{count}} tags de {{name}}:", + "tagList.unknownModsHeader": "{{count}} tags de mods inconnus:", // GamePresence "gamePresence.gettingStarted": "Vient de commencer",