diff --git a/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs b/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs index 55b03213..daea20a0 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs @@ -28,6 +28,13 @@ namespace NadekoBot.Modules.Administration [RequireUserPermission(GuildPermission.Administrator)] public async Task LanguageSet([Remainder] string name = null) { + if (string.IsNullOrWhiteSpace(name)) + { + var cul = NadekoBot.Localization.GetCultureInfo(Context.Guild); + await Context.Channel.SendConfirmAsync("This server's language is set to " + cul + " - " + cul.NativeName).ConfigureAwait(false); + return; + } + CultureInfo ci = null; try { @@ -53,8 +60,14 @@ namespace NadekoBot.Modules.Administration [NadekoCommand, Usage, Description, Aliases] [OwnerOnly] - public async Task LanguageSetDefault(string name) + public async Task LanguageSetDefault([Remainder]string name = null) { + if (string.IsNullOrWhiteSpace(name)) + { + var cul = NadekoBot.Localization.GetCultureInfo(Context.Guild); + await Context.Channel.SendConfirmAsync("Bot's language is set to " + cul + " - " + cul.NativeName).ConfigureAwait(false); + return; + } CultureInfo ci = null; try { diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 5526e556..487e5ec8 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -3687,7 +3687,7 @@ namespace NadekoBot.Resources { } /// - /// 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.. + /// 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. Provide no arguments to see currently set language.. /// public static string languageset_desc { get { @@ -3714,7 +3714,7 @@ namespace NadekoBot.Resources { } /// - /// 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.. + /// 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. Provide no arguments to see currently set language.. /// public static string languagesetdefault_desc { get { diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index fab8d243..4ba617cd 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -3109,7 +3109,7 @@ 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. + 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. Provide no arguments to see currently set language. `{0}langsetd en-US` or `{0}langsetd default` @@ -3118,7 +3118,7 @@ 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. Provide no arguments to see currently set language. `{0}langset de-DE ` or `{0}langset default` diff --git a/src/NadekoBot/Services/Impl/Localization.cs b/src/NadekoBot/Services/Impl/Localization.cs index df703381..e4906712 100644 --- a/src/NadekoBot/Services/Impl/Localization.cs +++ b/src/NadekoBot/Services/Impl/Localization.cs @@ -89,13 +89,17 @@ namespace NadekoBot.Services public void SetDefaultCulture(CultureInfo ci) { + using (var uow = DbHandler.UnitOfWork()) + { + var bc = uow.BotConfig.GetOrCreate(); + bc.Locale = ci.Name; + uow.Complete(); + } DefaultCultureInfo = ci; } - public void ResetDefaultCulture() - { - DefaultCultureInfo = CultureInfo.CurrentCulture; - } + public void ResetDefaultCulture() => + SetDefaultCulture(CultureInfo.CurrentCulture); public CultureInfo GetCultureInfo(IGuild guild) => GetCultureInfo(guild.Id);