From 9ea68605a4aaa25875c20d3eacc70980c9bba8b3 Mon Sep 17 00:00:00 2001 From: Matthew Cech Date: Sat, 6 Apr 2019 23:02:16 -0700 Subject: [PATCH] = Localized beans, help, help builder, info, invite help builder localization currently will collapse for header titles. This isn't too big of a deal, but the word for 'commands' at least can be localized. --- localization.config | 57 +++++++++++++++++++--------- src/commands/CommandGiveBeans.java | 9 +++-- src/commands/CommandHelp.java | 8 +--- src/commands/CommandHelpBuilder.java | 5 ++- src/commands/CommandInfo.java | 6 +-- src/commands/CommandInvite.java | 3 +- 6 files changed, 55 insertions(+), 33 deletions(-) diff --git a/localization.config b/localization.config index 4f11193..f2268ef 100644 --- a/localization.config +++ b/localization.config @@ -1,25 +1,26 @@ [CommandEightBall] It is certain. = Ask again later. = -Cannot predict now. = My sources say no. = You may rely on it. = Concentrate and ask again. = +Answers a yes or no question! Warning = Kitty can not actually tell the future, she claims no responsibility for any lion mauling, lack of lottery wins, or felony charges. = +Without a doubt. = +It is decidedly so. = +My reply is no. = +As I see it, yes. = +Outlook good. = +Outlook not so good. = +Cannot predict now. = Signs point to yes. = Most likely. = Reply hazy, try again. = -Without a doubt. = Very doubtful. = -It is decidedly so. = Answers a yes or no question! Warning: Kitty can not actually tell the future, she claims no responsibility for any lion mauling, lack of lottery wins, or felony charges. = Don't count on it. = Yes. = -My reply is no. = Yes - definitely. = -As I see it, yes. = Better not tell you now. = -Outlook good. = -Outlook not so good. = [CommandColiru] Will try to compile any c++ code you put in! Supports up to C++14 standard, uses g++. = @@ -31,29 +32,51 @@ You have %s beans! = [CommandBetBeans] Please bet with at least 50 beans! = That's not a valid bet! = +You won %s beans! = Sorry, you didn't win, try again! = Allows you to bet your beans, set your amount after the command! Warning! House always wins!\nSets of 3 will get 5x, 4 will get 10x, and 5 will get 1000x = You don't have enough beans! = -You won %s beans! = [CommandChangeIndicator] -Indicator changed to `%s` = Changes the command indicator to any single character. By default, it's '!'. If more than one character is provided, the first one is used! = +Indicator changed to `%s` = + +[CommandHelpBuilder] +commands = +Emit help for all commands as formatted HTML = + +[CommandDoWork] +I finished with my work! = D = +I finished with my work! :D = +Occupies a core for a few seconds = [CommandBoop] -Kitty will react with a counter = %s booped %s! = Woah! %s booped me! That's %s total! = +Kitty will react with a counter = %s booped several others - %s! = +[CommandInvite] +Provies a direct invite link for KittyBot = + +[CommandInfo] +I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/ = +Provides author info and a link to Kitty's website = + +[CommandBlurry] +Blurs your icon or the icon of a friend you mentioned = + +[CommandHelp] +You can get help with a specific command by typing `!help command`!\nYou can also look at \nGeneral Commands: `boop, roll, choose, help, info, vote, results, showpoll, wolfram, cplus, java, beans, role, bet, yeet` = +Lets you look up specific commands, or get a link to a list of all commands. = + +[CommandGiveBeans] +That's not a valid number! = +Gave %s %s beans! = +Gives beans to the mentioned users! = +You didn't mention anyone! = + [CommandChoose] With an input of x,y,z where x y and z are all choices, kitty will choose one = I chooooooose %s! = -[CommandDoWork] -I finished with my work! :D = -Occupies a core for a few seconds = - -[CommandBlurry] -Blurs your icon or the icon of a friend you mentioned = - diff --git a/src/commands/CommandGiveBeans.java b/src/commands/CommandGiveBeans.java index 5f9a7a1..e22cc28 100644 --- a/src/commands/CommandGiveBeans.java +++ b/src/commands/CommandGiveBeans.java @@ -1,6 +1,7 @@ package commands; import core.Command; +import core.Localizer; import dataStructures.*; public class CommandGiveBeans extends Command @@ -8,7 +9,7 @@ public class CommandGiveBeans extends Command public CommandGiveBeans (KittyRole level, KittyRating rating) { super(level, rating); } @Override - public String HelpText() { return "Gives beans to the mentioned users!"; } + public String HelpText() { return Localizer.Stub("Gives beans to the mentioned users!"); } @Override public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) @@ -19,20 +20,20 @@ public class CommandGiveBeans extends Command } catch (NumberFormatException e) { - res.Call("That's not a valid number!"); + res.Call(Localizer.Stub("That's not a valid number!")); return; } if(input.mentions == null) { - res.Call("You didn't mention anyone!"); + res.Call(Localizer.Stub("You didn't mention anyone!")); return; } for(int i = 0; i < input.mentions.length; i++) { input.mentions[i].ChangeBeans(beans); - res.Call("Gave " + input.mentions[i].name + " " + beans + " beans!"); + res.Call(String.format(Localizer.Stub("Gave %s %s beans!"), input.mentions[i].name, "" + beans)); } } } diff --git a/src/commands/CommandHelp.java b/src/commands/CommandHelp.java index 580554b..cb3ec42 100644 --- a/src/commands/CommandHelp.java +++ b/src/commands/CommandHelp.java @@ -16,7 +16,7 @@ public class CommandHelp extends Command public CommandHelp(KittyRole level, KittyRating rating) { super(level, rating); } @Override - public String HelpText() { return "Lets you look up specific commands, or get a link to a list of all commands."; } + public String HelpText() { return Localizer.Stub("Lets you look up specific commands, or get a link to a list of all commands."); } @Override public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) @@ -25,11 +25,7 @@ public class CommandHelp extends Command if(help == null) { - help = "You can get help with a specific command by typing `!help command`!" - + "\nYou can also look at " - + "\nGeneral Commands: `boop, roll, choose, help, info, vote, " - + "results, showpoll, wolfram, cplus, java," - + "beans, role, bet, yeet`"; + help = Localizer.Stub("You can get help with a specific command by typing `!help command`!\nYou can also look at \nGeneral Commands: `boop, roll, choose, help, info, vote, results, showpoll, wolfram, cplus, java, beans, role, bet, yeet`"); } else { diff --git a/src/commands/CommandHelpBuilder.java b/src/commands/CommandHelpBuilder.java index 968b949..9b77b55 100644 --- a/src/commands/CommandHelpBuilder.java +++ b/src/commands/CommandHelpBuilder.java @@ -7,6 +7,7 @@ import java.util.ArrayList; import java.util.HashMap; import core.Command; +import core.Localizer; import core.Stats; import dataStructures.KittyChannel; import dataStructures.KittyGuild; @@ -25,7 +26,7 @@ public class CommandHelpBuilder extends Command { } @Override - public String HelpText() { return "Emit help for all commands as formatted HTML"; } + public String HelpText() { return Localizer.Stub("Emit help for all commands as formatted HTML"); } @Override public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) @@ -95,7 +96,7 @@ public class CommandHelpBuilder extends Command { roleStr = roleStr.substring(0, 1).toUpperCase() + roleStr.toLowerCase().substring(1); // Section header - accumulated += headerStart + roleStr + " commands" + headerEnd; + accumulated += headerStart + roleStr + " " + Localizer.Stub("commands") + headerEnd; accumulated += sectionStart; // Section content diff --git a/src/commands/CommandInfo.java b/src/commands/CommandInfo.java index 99ae8b8..568ad14 100644 --- a/src/commands/CommandInfo.java +++ b/src/commands/CommandInfo.java @@ -1,6 +1,7 @@ package commands; import core.Command; +import core.Localizer; import dataStructures.KittyChannel; import dataStructures.KittyGuild; import dataStructures.KittyRating; @@ -14,13 +15,12 @@ public class CommandInfo extends Command public CommandInfo(KittyRole level, KittyRating rating) { super(level, rating); } @Override - public String HelpText() { return "Provides author info and a link to Kitty's website"; } + public String HelpText() { return Localizer.Stub("Provides author info and a link to Kitty's website"); } @Override public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res) { - String info = "I'm made by `Rin#8904` and `Reverie Wisp#3703`!\n" - + "You can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/" ; + String info = Localizer.Stub("I'm made by `Rin#8904` and `Reverie Wisp#3703`!\nYou can find more info about me along with a Patreon link to support us and GitHub link for filing bugs https://www.rinsnowmew.com/bot/"); res.Call(info); } } \ No newline at end of file diff --git a/src/commands/CommandInvite.java b/src/commands/CommandInvite.java index 3bcb6a4..75080e4 100644 --- a/src/commands/CommandInvite.java +++ b/src/commands/CommandInvite.java @@ -1,6 +1,7 @@ package commands; import core.Command; +import core.Localizer; import dataStructures.*; import offline.Ref; @@ -9,7 +10,7 @@ public class CommandInvite extends Command public CommandInvite(KittyRole level, KittyRating rating) { super(level, rating); } @Override - public String HelpText() { return "Provies a direct invite link for KittyBot"; } + public String HelpText() { return Localizer.Stub("Provies a direct invite link for KittyBot"); } @Override public void OnRun(KittyGuild guild, KittyChannel channel, KittyUser user, UserInput input, Response res)