From 66f046a77c0f14238f485353244d3296c7e84bef Mon Sep 17 00:00:00 2001 From: Kwoth Date: Mon, 13 Feb 2017 16:57:10 +0100 Subject: [PATCH] .langli, .langset, .langsetd added which: list all languages for which translation exists atm, set server's language, set default bot language (this is used if not server language is set, default) respectively --- .../Commands/LocalizationCommands.cs | 137 +++++++++++++++++- .../Resources/CommandStrings.Designer.cs | 135 ++++++++++------- src/NadekoBot/Resources/CommandStrings.resx | 31 ++-- 3 files changed, 235 insertions(+), 68 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs b/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs index 7247c29d..55b03213 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs @@ -26,7 +26,7 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] [RequireUserPermission(GuildPermission.Administrator)] - public async Task SetLanguage([Remainder] string name = null) + public async Task LanguageSet([Remainder] string name = null) { CultureInfo ci = null; try @@ -53,7 +53,7 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [OwnerOnly] - public async Task SetDefaultLanguage(string name) + public async Task LanguageSetDefault(string name) { CultureInfo ci = null; try @@ -80,7 +80,7 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [OwnerOnly] - public async Task ListLanguages(string name) + public async Task LanguagesList(string name) { await Context.Channel.SendConfirmAsync("List Of Languages", string.Join("\n", SupportedLocales.Select(x => $"{Format.Code(x.Key)} => {x.Value}"))); @@ -88,3 +88,134 @@ namespace NadekoBot.Modules.Administration } } } +/* list of language codes for reference. + * taken from https://github.com/dotnet/coreclr/blob/ee5862c6a257e60e263537d975ab6c513179d47f/src/mscorlib/src/System/Globalization/CultureData.cs#L192 + { "029", "en-029" }, + { "AE", "ar-AE" }, + { "AF", "prs-AF" }, + { "AL", "sq-AL" }, + { "AM", "hy-AM" }, + { "AR", "es-AR" }, + { "AT", "de-AT" }, + { "AU", "en-AU" }, + { "AZ", "az-Cyrl-AZ" }, + { "BA", "bs-Latn-BA" }, + { "BD", "bn-BD" }, + { "BE", "nl-BE" }, + { "BG", "bg-BG" }, + { "BH", "ar-BH" }, + { "BN", "ms-BN" }, + { "BO", "es-BO" }, + { "BR", "pt-BR" }, + { "BY", "be-BY" }, + { "BZ", "en-BZ" }, + { "CA", "en-CA" }, + { "CH", "it-CH" }, + { "CL", "es-CL" }, + { "CN", "zh-CN" }, + { "CO", "es-CO" }, + { "CR", "es-CR" }, + { "CS", "sr-Cyrl-CS" }, + { "CZ", "cs-CZ" }, + { "DE", "de-DE" }, + { "DK", "da-DK" }, + { "DO", "es-DO" }, + { "DZ", "ar-DZ" }, + { "EC", "es-EC" }, + { "EE", "et-EE" }, + { "EG", "ar-EG" }, + { "ES", "es-ES" }, + { "ET", "am-ET" }, + { "FI", "fi-FI" }, + { "FO", "fo-FO" }, + { "FR", "fr-FR" }, + { "GB", "en-GB" }, + { "GE", "ka-GE" }, + { "GL", "kl-GL" }, + { "GR", "el-GR" }, + { "GT", "es-GT" }, + { "HK", "zh-HK" }, + { "HN", "es-HN" }, + { "HR", "hr-HR" }, + { "HU", "hu-HU" }, + { "ID", "id-ID" }, + { "IE", "en-IE" }, + { "IL", "he-IL" }, + { "IN", "hi-IN" }, + { "IQ", "ar-IQ" }, + { "IR", "fa-IR" }, + { "IS", "is-IS" }, + { "IT", "it-IT" }, + { "IV", "" }, + { "JM", "en-JM" }, + { "JO", "ar-JO" }, + { "JP", "ja-JP" }, + { "KE", "sw-KE" }, + { "KG", "ky-KG" }, + { "KH", "km-KH" }, + { "KR", "ko-KR" }, + { "KW", "ar-KW" }, + { "KZ", "kk-KZ" }, + { "LA", "lo-LA" }, + { "LB", "ar-LB" }, + { "LI", "de-LI" }, + { "LK", "si-LK" }, + { "LT", "lt-LT" }, + { "LU", "lb-LU" }, + { "LV", "lv-LV" }, + { "LY", "ar-LY" }, + { "MA", "ar-MA" }, + { "MC", "fr-MC" }, + { "ME", "sr-Latn-ME" }, + { "MK", "mk-MK" }, + { "MN", "mn-MN" }, + { "MO", "zh-MO" }, + { "MT", "mt-MT" }, + { "MV", "dv-MV" }, + { "MX", "es-MX" }, + { "MY", "ms-MY" }, + { "NG", "ig-NG" }, + { "NI", "es-NI" }, + { "NL", "nl-NL" }, + { "NO", "nn-NO" }, + { "NP", "ne-NP" }, + { "NZ", "en-NZ" }, + { "OM", "ar-OM" }, + { "PA", "es-PA" }, + { "PE", "es-PE" }, + { "PH", "en-PH" }, + { "PK", "ur-PK" }, + { "PL", "pl-PL" }, + { "PR", "es-PR" }, + { "PT", "pt-PT" }, + { "PY", "es-PY" }, + { "QA", "ar-QA" }, + { "RO", "ro-RO" }, + { "RS", "sr-Latn-RS" }, + { "RU", "ru-RU" }, + { "RW", "rw-RW" }, + { "SA", "ar-SA" }, + { "SE", "sv-SE" }, + { "SG", "zh-SG" }, + { "SI", "sl-SI" }, + { "SK", "sk-SK" }, + { "SN", "wo-SN" }, + { "SV", "es-SV" }, + { "SY", "ar-SY" }, + { "TH", "th-TH" }, + { "TJ", "tg-Cyrl-TJ" }, + { "TM", "tk-TM" }, + { "TN", "ar-TN" }, + { "TR", "tr-TR" }, + { "TT", "en-TT" }, + { "TW", "zh-TW" }, + { "UA", "uk-UA" }, + { "US", "en-US" }, + { "UY", "es-UY" }, + { "UZ", "uz-Cyrl-UZ" }, + { "VE", "es-VE" }, + { "VN", "vi-VN" }, + { "YE", "ar-YE" }, + { "ZA", "af-ZA" }, + { "ZW", "en-ZW" } + */ diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 11519c80..5526e556 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -3677,6 +3677,87 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to languageset langset. + /// + public static string languageset_cmd { + get { + return ResourceManager.GetString("languageset_cmd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sets this server's response language If bot's response strings have been translated to that language, bot will use that language in this server. Reset by using `default` as the locale name.. + /// + public static string languageset_desc { + get { + return ResourceManager.GetString("languageset_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `{0}langset de-DE ` or `{0}langset default`. + /// + public static string languageset_usage { + get { + return ResourceManager.GetString("languageset_usage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to langsetdefault langsetd. + /// + public static string languagesetdefault_cmd { + get { + return ResourceManager.GetString("languagesetdefault_cmd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sets the bot's default response language. All servers which use a default locale will use this one. Setting to `default` will use the host's current culture.. + /// + public static string languagesetdefault_desc { + get { + return ResourceManager.GetString("languagesetdefault_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `{0}langsetd en-US` or `{0}langsetd default`. + /// + public static string languagesetdefault_usage { + get { + return ResourceManager.GetString("languagesetdefault_usage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to languageslist langli. + /// + public static string languageslist_cmd { + get { + return ResourceManager.GetString("languageslist_cmd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to List of languages for which translation (or part of it) exist atm.. + /// + public static string languageslist_desc { + get { + return ResourceManager.GetString("languageslist_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `{0}langli`. + /// + public static string languageslist_usage { + get { + return ResourceManager.GetString("languageslist_usage", resourceCulture); + } + } + /// /// Looks up a localized string similar to lcsc. /// @@ -6755,33 +6836,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to setdefaultlocale sdl. - /// - public static string setdefaultlanguage_cmd { - get { - return ResourceManager.GetString("setdefaultlanguage_cmd", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Sets the bot's default response language. All servers which use a default locale will use this one. Setting to `default` will use the host's current culture.. - /// - public static string setdefaultlanguage_desc { - get { - return ResourceManager.GetString("setdefaultlanguage_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `{0}sdl en-US` or `{0}sdl default`. - /// - public static string setdefaultlanguage_usage { - get { - return ResourceManager.GetString("setdefaultlanguage_usage", resourceCulture); - } - } - /// /// Looks up a localized string similar to setgame. /// @@ -6809,33 +6863,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to setlocale sl. - /// - public static string setlanguage_cmd { - get { - return ResourceManager.GetString("setlanguage_cmd", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Sets this server's response language) If bot's response strings have been translated to that language, bot will use that language in this server. Reset by using `default` as the locale name.. - /// - public static string setlanguage_desc { - get { - return ResourceManager.GetString("setlanguage_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `{0}sl de-DE ` or `{0}sl default`. - /// - public static string setlanguage_usage { - get { - return ResourceManager.GetString("setlanguage_usage", resourceCulture); - } - } - /// /// Looks up a localized string similar to setmaxplaytime smp. /// diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 23fb8072..fab8d243 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -3105,22 +3105,31 @@ `{0}timezone` - - setdefaultlocale sdl + + langsetdefault langsetd - + Sets the bot's default response language. All servers which use a default locale will use this one. Setting to `default` will use the host's current culture. - - `{0}sdl en-US` or `{0}sdl default` + + `{0}langsetd en-US` or `{0}langsetd default` - - setlocale sl + + languageset langset - - Sets this server's response language) If bot's response strings have been translated to that language, bot will use that language in this server. Reset by using `default` as the locale name. + + Sets this server's response language If bot's response strings have been translated to that language, bot will use that language in this server. Reset by using `default` as the locale name. - - `{0}sl de-DE ` or `{0}sl default` + + `{0}langset de-DE ` or `{0}langset default` + + + languageslist langli + + + List of languages for which translation (or part of it) exist atm. + + + `{0}langli` \ No newline at end of file