From 7552303a6e4f5e7726ff44006968f12abc497c0e Mon Sep 17 00:00:00 2001 From: Basique Evangelist Date: Wed, 6 Feb 2019 20:38:51 +0300 Subject: [PATCH] Add joke belarusian locale + add locale notes --- JetKarmaBot/Commands/ChangeLocaleCommand.cs | 3 ++- JetKarmaBot/Services/Localization.cs | 5 +++++ JetKarmaBot/lang/be-BY.json | 3 ++- JetKarmaBot/lang/en-US.json | 3 ++- JetKarmaBot/lang/ru-RU.json | 3 ++- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/JetKarmaBot/Commands/ChangeLocaleCommand.cs b/JetKarmaBot/Commands/ChangeLocaleCommand.cs index a0bad1f..a60455e 100644 --- a/JetKarmaBot/Commands/ChangeLocaleCommand.cs +++ b/JetKarmaBot/Commands/ChangeLocaleCommand.cs @@ -57,7 +57,8 @@ namespace JetKarmaBot.Commands Client.SendTextMessageAsync( args.Message.Chat.Id, - currentLocale["jetkarmabot.changelocale.justchanged"], +(currentLocale.HasNote ? currentLocale["jetkarmabot.changelocale.beforenote"] + currentLocale.Note + "\n" : "") + + currentLocale["jetkarmabot.changelocale.justchanged"], replyToMessageId: args.Message.MessageId); return true; } diff --git a/JetKarmaBot/Services/Localization.cs b/JetKarmaBot/Services/Localization.cs index ba61371..aedba8e 100644 --- a/JetKarmaBot/Services/Localization.cs +++ b/JetKarmaBot/Services/Localization.cs @@ -105,15 +105,20 @@ namespace JetKarmaBot private Dictionary locale; private string localeName; private string[] commonNames; + private string note; public Locale(JObject locale, string localeName) { this.locale = locale.Property("strings").Value.ToObject>(); this.localeName = localeName; this.commonNames = locale.Property("names").Value.ToObject(); + if (locale.ContainsKey("note")) this.note = locale.Property("note").Value.ToObject(); } public string[] CommonNames => commonNames; public string Name => localeName; + public bool HasNote => note != null; + + public string Note => note; public string this[string name] => locale.ContainsKey(name) ? locale[name] : "unknown"; } } \ No newline at end of file diff --git a/JetKarmaBot/lang/be-BY.json b/JetKarmaBot/lang/be-BY.json index 5ef2e6f..d1a72dd 100644 --- a/JetKarmaBot/lang/be-BY.json +++ b/JetKarmaBot/lang/be-BY.json @@ -19,6 +19,7 @@ "jetkarmabot.changelocale.justchanged": "Так дакладна.", "jetkarmabot.changelocale.getlocale": "Я зараз кажу па-беларускай.", "jetkarmabot.changelocale.listalltext": "Я ведаю:", - "jetkarmabot.changelocale.errorall": "Мне б хацелася гаварыць на ўсіх мовах у той жа самы час, але з-за абмежаванняў сусвету, мне гэта не дазваляецца." + "jetkarmabot.changelocale.errorall": "Мне б хацелася гаварыць на ўсіх мовах у той жа самы час, але з-за абмежаванняў сусвету, мне гэта не дазваляецца.", + "jetkarmabot.changelocale.beforenote": "Увага: " } } \ No newline at end of file diff --git a/JetKarmaBot/lang/en-US.json b/JetKarmaBot/lang/en-US.json index aadbca1..a6450af 100644 --- a/JetKarmaBot/lang/en-US.json +++ b/JetKarmaBot/lang/en-US.json @@ -18,6 +18,7 @@ "jetkarmabot.changelocale.justchanged": "Roger that.", "jetkarmabot.changelocale.getlocale": "I'm currently speaking English.", "jetkarmabot.changelocale.listalltext": "I know:", - "jetkarmabot.changelocale.errorall": "I would like to speak all languages at once, but because of the rules of the universe, I am not allowed to do that." + "jetkarmabot.changelocale.errorall": "I would like to speak all languages at once, but because of the rules of the universe, I am not allowed to do that.", + "jetkarmabot.changelocale.beforenote": "Warning: " } } \ No newline at end of file diff --git a/JetKarmaBot/lang/ru-RU.json b/JetKarmaBot/lang/ru-RU.json index b6ef6ae..112b596 100644 --- a/JetKarmaBot/lang/ru-RU.json +++ b/JetKarmaBot/lang/ru-RU.json @@ -18,6 +18,7 @@ "jetkarmabot.changelocale.justchanged": "Так точно.", "jetkarmabot.changelocale.getlocale": "Я сейчас говорю по-русски.", "jetkarmabot.changelocale.listalltext": "Я знаю:", - "jetkarmabot.changelocale.errorall": "Мне бы хотелось говорить на всех языках в то же самое время, но из-за ограничений вселенной, мне это не позволяется." + "jetkarmabot.changelocale.errorall": "Мне бы хотелось говорить на всех языках в то же самое время, но из-за ограничений вселенной, мне это не позволяется.", + "jetkarmabot.changelocale.beforenote": "Внимание: " } } \ No newline at end of file