diff --git a/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs b/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs index 7f555b89..2db38bc7 100644 --- a/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/LocalizationCommands.cs @@ -24,14 +24,18 @@ namespace NadekoBot.Modules.Administration CultureInfo ci = null; try { - if(name.Trim().ToLowerInvariant() == "default") + if (name.Trim().ToLowerInvariant() == "default") { NadekoBot.Localization.RemoveGuildCulture(Context.Guild); + ci = NadekoBot.Localization.DefaultCultureInfo; + } + else + { + ci = new CultureInfo(name); + NadekoBot.Localization.SetGuildCulture(Context.Guild, ci); } - ci = new CultureInfo(name); - NadekoBot.Localization.SetGuildCulture(Context.Guild, ci); - await Context.Channel.SendConfirmAsync($"Your guild's locale is now {ci}.").ConfigureAwait(false); + await Context.Channel.SendConfirmAsync($"Your guild's locale is now {Format.Bold(ci.ToString())} - {Format.Bold(ci.NativeName)}.").ConfigureAwait(false); } catch(Exception) { @@ -50,11 +54,15 @@ namespace NadekoBot.Modules.Administration if (name.Trim().ToLowerInvariant() == "default") { NadekoBot.Localization.ResetDefaultCulture(); + ci = NadekoBot.Localization.DefaultCultureInfo; + } + else + { + ci = new CultureInfo(name); + NadekoBot.Localization.SetDefaultCulture(ci); } - ci = new CultureInfo(name); - NadekoBot.Localization.SetDefaultCulture(ci); - await Context.Channel.SendConfirmAsync($"Your guild's locale is now {ci}.").ConfigureAwait(false); + await Context.Channel.SendConfirmAsync($"Bot's default locale is now {Format.Bold(ci.ToString())} - {Format.Bold(ci.NativeName)}.").ConfigureAwait(false); } catch (Exception) { diff --git a/src/NadekoBot/Modules/Help/Help.cs b/src/NadekoBot/Modules/Help/Help.cs index a15501b0..c447db40 100644 --- a/src/NadekoBot/Modules/Help/Help.cs +++ b/src/NadekoBot/Modules/Help/Help.cs @@ -82,7 +82,7 @@ namespace NadekoBot.Modules.Help var alias = com.Aliases.Skip(1).FirstOrDefault(); if (alias != null) str += $" **/ `{alias}`**"; - var embed = new EmbedBuilder() + var embed = new EmbedBuilder() .AddField(fb => fb.WithName(str).WithValue($"{ string.Format(com.Summary, com.Module.Aliases.First())} { GetCommandRequirements(com)}").WithIsInline(true)) .AddField(fb => fb.WithName("**Usage**").WithValue($"{string.Format(com.Remarks, com.Module.Aliases.First())}").WithIsInline(false)) .WithColor(NadekoBot.OkColor); diff --git a/src/NadekoBot/Modules/NadekoModule.cs b/src/NadekoBot/Modules/NadekoModule.cs index 89e685f3..24a21954 100644 --- a/src/NadekoBot/Modules/NadekoModule.cs +++ b/src/NadekoBot/Modules/NadekoModule.cs @@ -31,8 +31,10 @@ namespace NadekoBot.Modules protected override void BeforeExecute() { _cultureInfo = (Context.Guild == null - ? CultureInfo.CurrentCulture + ? NadekoBot.Localization.DefaultCultureInfo : NadekoBot.Localization.GetCultureInfo(Context.Guild)); + + _log.Warn("Culture info is {0}", _cultureInfo); } //public Task ReplyConfirmLocalized(string titleKey, string textKey, string url = null, string footer = null) diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 3659c523..3c6d7404 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -6828,7 +6828,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to `{}sl de-DE ` or `{0}sl default`. + /// Looks up a localized string similar to `{0}sl de-DE ` or `{0}sl default`. /// public static string setlocale_usage { get { diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 0c1566d0..577a1b72 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -3121,6 +3121,6 @@ Sets this server's response locale (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. - `{}sl de-DE ` or `{0}sl default` + `{0}sl de-DE ` or `{0}sl default` \ No newline at end of file diff --git a/src/NadekoBot/Resources/ResponseStrings-sr-SP.Designer.cs b/src/NadekoBot/Resources/ResponseStrings-sr-SP.Designer.cs new file mode 100644 index 00000000..4d43d571 --- /dev/null +++ b/src/NadekoBot/Resources/ResponseStrings-sr-SP.Designer.cs @@ -0,0 +1,260 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NadekoBot.Resources { + using System; + using System.Reflection; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class ResponseStrings_sr_SP { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + internal ResponseStrings_sr_SP() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NadekoBot.Resources.ResponseStrings-sr-SP", typeof(ResponseStrings_sr_SP).GetTypeInfo().Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to {0} has already fainted.. + /// + public static string pokemon_already_fainted { + get { + return ResourceManager.GetString("pokemon_already_fainted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} already has full HP.. + /// + public static string pokemon_already_full { + get { + return ResourceManager.GetString("pokemon_already_full", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your type is already {0}. + /// + public static string pokemon_already_that_type { + get { + return ResourceManager.GetString("pokemon_already_that_type", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to used {0}{1} on {2}{3} for {4} damage.. + /// + public static string pokemon_attack { + get { + return ResourceManager.GetString("pokemon_attack", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You can't attack again without retaliation!. + /// + public static string pokemon_cant_attack_again { + get { + return ResourceManager.GetString("pokemon_cant_attack_again", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You can't attack yourself.. + /// + public static string pokemon_cant_attack_yourself { + get { + return ResourceManager.GetString("pokemon_cant_attack_yourself", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} has fainted!. + /// + public static string pokemon_fainted { + get { + return ResourceManager.GetString("pokemon_fainted", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to healed {0} with one {1}. + /// + public static string pokemon_healed { + get { + return ResourceManager.GetString("pokemon_healed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0} has {1} HP remaining.. + /// + public static string pokemon_hp_remaining { + get { + return ResourceManager.GetString("pokemon_hp_remaining", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You can't use {0}. Type `{1}ml` to see a list of moves you can use.. + /// + public static string pokemon_invalid_move { + get { + return ResourceManager.GetString("pokemon_invalid_move", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Movelist for {0} type. + /// + public static string pokemon_moves { + get { + return ResourceManager.GetString("pokemon_moves", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You don't have enough {0}. + /// + public static string pokemon_no_currency { + get { + return ResourceManager.GetString("pokemon_no_currency", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to It's not effective.. + /// + public static string pokemon_not_effective { + get { + return ResourceManager.GetString("pokemon_not_effective", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to revived {0} with one {1}. + /// + public static string pokemon_revive_other { + get { + return ResourceManager.GetString("pokemon_revive_other", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You revived yourself with one {0}. + /// + public static string pokemon_revive_yourself { + get { + return ResourceManager.GetString("pokemon_revive_yourself", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Your type has been changed to {0} for a {1}. + /// + public static string pokemon_settype_success { + get { + return ResourceManager.GetString("pokemon_settype_success", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to It's somewhat effective.. + /// + public static string pokemon_somewhat_effective { + get { + return ResourceManager.GetString("pokemon_somewhat_effective", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to It's super effective!. + /// + public static string pokemon_super_effective { + get { + return ResourceManager.GetString("pokemon_super_effective", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You used too many moves in a row, so you can't move!. + /// + public static string pokemon_too_many_moves { + get { + return ResourceManager.GetString("pokemon_too_many_moves", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type of {0} is {1}. + /// + public static string pokemon_type_of_user { + get { + return ResourceManager.GetString("pokemon_type_of_user", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to User not found.. + /// + public static string pokemon_user_not_found { + get { + return ResourceManager.GetString("pokemon_user_not_found", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to You fainted, so you are not able to move!. + /// + public static string pokemon_you_fainted { + get { + return ResourceManager.GetString("pokemon_you_fainted", resourceCulture); + } + } + } +} diff --git a/src/NadekoBot/Resources/ResponseStrings-sr-SP.resx b/src/NadekoBot/Resources/ResponseStrings-sr-SP.resx new file mode 100644 index 00000000..63ef2430 --- /dev/null +++ b/src/NadekoBot/Resources/ResponseStrings-sr-SP.resx @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0} has already fainted. + + + {0} already has full HP. + + + Your type is already {0} + + + used {0}{1} on {2}{3} for {4} damage. + Kwoth used punch:type_icon: on Sanity:type_icon: for 50 damage. + + + You can't attack again without retaliation! + + + You can't attack yourself. + + + {0} has fainted! + + + healed {0} with one {1} + + + {0} has {1} HP remaining. + + + You can't use {0}. Type `{1}ml` to see a list of moves you can use. + + + Movelist for {0} type + + + It's not effective. + + + You don't have enough {0} + + + revived {0} with one {1} + + + You revived yourself with one {0} + + + Your type has been changed to {0} for a {1} + + + It's somewhat effective. + + + It's super effective! + + + You used too many moves in a row, so you can't move! + + + Type of {0} is {1} + + + User not found. + + + You fainted, so you are not able to move! + + \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/Localization.cs b/src/NadekoBot/Services/Impl/Localization.cs index dc64dd3e..73891d4a 100644 --- a/src/NadekoBot/Services/Impl/Localization.cs +++ b/src/NadekoBot/Services/Impl/Localization.cs @@ -69,7 +69,7 @@ namespace NadekoBot.Services } } - internal void SetDefaultCulture(CultureInfo ci) + public void SetDefaultCulture(CultureInfo ci) { DefaultCultureInfo = ci; }