.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

This commit is contained in:
Kwoth 2017-02-13 16:57:10 +01:00
parent 63dc5f0c46
commit 66f046a77c
3 changed files with 235 additions and 68 deletions

View File

@ -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" }
*/

View File

@ -3677,6 +3677,87 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to languageset langset.
/// </summary>
public static string languageset_cmd {
get {
return ResourceManager.GetString("languageset_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sets this server&apos;s response language If bot&apos;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..
/// </summary>
public static string languageset_desc {
get {
return ResourceManager.GetString("languageset_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}langset de-DE ` or `{0}langset default`.
/// </summary>
public static string languageset_usage {
get {
return ResourceManager.GetString("languageset_usage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to langsetdefault langsetd.
/// </summary>
public static string languagesetdefault_cmd {
get {
return ResourceManager.GetString("languagesetdefault_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sets the bot&apos;s default response language. All servers which use a default locale will use this one. Setting to `default` will use the host&apos;s current culture..
/// </summary>
public static string languagesetdefault_desc {
get {
return ResourceManager.GetString("languagesetdefault_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}langsetd en-US` or `{0}langsetd default`.
/// </summary>
public static string languagesetdefault_usage {
get {
return ResourceManager.GetString("languagesetdefault_usage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to languageslist langli.
/// </summary>
public static string languageslist_cmd {
get {
return ResourceManager.GetString("languageslist_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to List of languages for which translation (or part of it) exist atm..
/// </summary>
public static string languageslist_desc {
get {
return ResourceManager.GetString("languageslist_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}langli`.
/// </summary>
public static string languageslist_usage {
get {
return ResourceManager.GetString("languageslist_usage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to lcsc.
/// </summary>
@ -6755,33 +6836,6 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to setdefaultlocale sdl.
/// </summary>
public static string setdefaultlanguage_cmd {
get {
return ResourceManager.GetString("setdefaultlanguage_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sets the bot&apos;s default response language. All servers which use a default locale will use this one. Setting to `default` will use the host&apos;s current culture..
/// </summary>
public static string setdefaultlanguage_desc {
get {
return ResourceManager.GetString("setdefaultlanguage_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}sdl en-US` or `{0}sdl default`.
/// </summary>
public static string setdefaultlanguage_usage {
get {
return ResourceManager.GetString("setdefaultlanguage_usage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to setgame.
/// </summary>
@ -6809,33 +6863,6 @@ namespace NadekoBot.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to setlocale sl.
/// </summary>
public static string setlanguage_cmd {
get {
return ResourceManager.GetString("setlanguage_cmd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sets this server&apos;s response language) If bot&apos;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..
/// </summary>
public static string setlanguage_desc {
get {
return ResourceManager.GetString("setlanguage_desc", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to `{0}sl de-DE ` or `{0}sl default`.
/// </summary>
public static string setlanguage_usage {
get {
return ResourceManager.GetString("setlanguage_usage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to setmaxplaytime smp.
/// </summary>

View File

@ -3105,22 +3105,31 @@
<data name="timezone_usage" xml:space="preserve">
<value>`{0}timezone`</value>
</data>
<data name="setdefaultlanguage_cmd" xml:space="preserve">
<value>setdefaultlocale sdl</value>
<data name="languagesetdefault_cmd" xml:space="preserve">
<value>langsetdefault langsetd</value>
</data>
<data name="setdefaultlanguage_desc" xml:space="preserve">
<data name="languagesetdefault_desc" xml:space="preserve">
<value>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.</value>
</data>
<data name="setdefaultlanguage_usage" xml:space="preserve">
<value>`{0}sdl en-US` or `{0}sdl default`</value>
<data name="languagesetdefault_usage" xml:space="preserve">
<value>`{0}langsetd en-US` or `{0}langsetd default`</value>
</data>
<data name="setlanguage_cmd" xml:space="preserve">
<value>setlocale sl</value>
<data name="languageset_cmd" xml:space="preserve">
<value>languageset langset</value>
</data>
<data name="setlanguage_desc" xml:space="preserve">
<value>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.</value>
<data name="languageset_desc" xml:space="preserve">
<value>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.</value>
</data>
<data name="setlanguage_usage" xml:space="preserve">
<value>`{0}sl de-DE ` or `{0}sl default`</value>
<data name="languageset_usage" xml:space="preserve">
<value>`{0}langset de-DE ` or `{0}langset default`</value>
</data>
<data name="languageslist_cmd" xml:space="preserve">
<value>languageslist langli</value>
</data>
<data name="languageslist_desc" xml:space="preserve">
<value>List of languages for which translation (or part of it) exist atm.</value>
</data>
<data name="languageslist_usage" xml:space="preserve">
<value>`{0}langli`</value>
</data>
</root>