sneaky little bugs :3

This commit is contained in:
Kwoth 2017-02-13 15:29:02 +01:00
parent 8d496563dc
commit 34e0399c7e
8 changed files with 469 additions and 12 deletions

View File

@ -27,11 +27,15 @@ namespace NadekoBot.Modules.Administration
if (name.Trim().ToLowerInvariant() == "default") if (name.Trim().ToLowerInvariant() == "default")
{ {
NadekoBot.Localization.RemoveGuildCulture(Context.Guild); NadekoBot.Localization.RemoveGuildCulture(Context.Guild);
ci = NadekoBot.Localization.DefaultCultureInfo;
} }
else
{
ci = new CultureInfo(name); ci = new CultureInfo(name);
NadekoBot.Localization.SetGuildCulture(Context.Guild, ci); 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) { catch(Exception) {
@ -50,11 +54,15 @@ namespace NadekoBot.Modules.Administration
if (name.Trim().ToLowerInvariant() == "default") if (name.Trim().ToLowerInvariant() == "default")
{ {
NadekoBot.Localization.ResetDefaultCulture(); NadekoBot.Localization.ResetDefaultCulture();
ci = NadekoBot.Localization.DefaultCultureInfo;
} }
else
{
ci = new CultureInfo(name); ci = new CultureInfo(name);
NadekoBot.Localization.SetDefaultCulture(ci); 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) catch (Exception)
{ {

View File

@ -31,8 +31,10 @@ namespace NadekoBot.Modules
protected override void BeforeExecute() protected override void BeforeExecute()
{ {
_cultureInfo = (Context.Guild == null _cultureInfo = (Context.Guild == null
? CultureInfo.CurrentCulture ? NadekoBot.Localization.DefaultCultureInfo
: NadekoBot.Localization.GetCultureInfo(Context.Guild)); : NadekoBot.Localization.GetCultureInfo(Context.Guild));
_log.Warn("Culture info is {0}", _cultureInfo);
} }
//public Task<IUserMessage> ReplyConfirmLocalized(string titleKey, string textKey, string url = null, string footer = null) //public Task<IUserMessage> ReplyConfirmLocalized(string titleKey, string textKey, string url = null, string footer = null)

View File

@ -6828,7 +6828,7 @@ namespace NadekoBot.Resources {
} }
/// <summary> /// <summary>
/// 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`.
/// </summary> /// </summary>
public static string setlocale_usage { public static string setlocale_usage {
get { get {

View File

@ -3121,6 +3121,6 @@
<value>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.</value> <value>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.</value>
</data> </data>
<data name="setlocale_usage" xml:space="preserve"> <data name="setlocale_usage" xml:space="preserve">
<value>`{}sl de-DE ` or `{0}sl default`</value> <value>`{0}sl de-DE ` or `{0}sl default`</value>
</data> </data>
</root> </root>

View File

@ -0,0 +1,260 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NadekoBot.Resources {
using System;
using System.Reflection;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to {0} has already fainted..
/// </summary>
public static string pokemon_already_fainted {
get {
return ResourceManager.GetString("pokemon_already_fainted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} already has full HP..
/// </summary>
public static string pokemon_already_full {
get {
return ResourceManager.GetString("pokemon_already_full", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your type is already {0}.
/// </summary>
public static string pokemon_already_that_type {
get {
return ResourceManager.GetString("pokemon_already_that_type", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to used {0}{1} on {2}{3} for {4} damage..
/// </summary>
public static string pokemon_attack {
get {
return ResourceManager.GetString("pokemon_attack", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can&apos;t attack again without retaliation!.
/// </summary>
public static string pokemon_cant_attack_again {
get {
return ResourceManager.GetString("pokemon_cant_attack_again", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can&apos;t attack yourself..
/// </summary>
public static string pokemon_cant_attack_yourself {
get {
return ResourceManager.GetString("pokemon_cant_attack_yourself", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has fainted!.
/// </summary>
public static string pokemon_fainted {
get {
return ResourceManager.GetString("pokemon_fainted", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to healed {0} with one {1}.
/// </summary>
public static string pokemon_healed {
get {
return ResourceManager.GetString("pokemon_healed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} has {1} HP remaining..
/// </summary>
public static string pokemon_hp_remaining {
get {
return ResourceManager.GetString("pokemon_hp_remaining", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can&apos;t use {0}. Type `{1}ml` to see a list of moves you can use..
/// </summary>
public static string pokemon_invalid_move {
get {
return ResourceManager.GetString("pokemon_invalid_move", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Movelist for {0} type.
/// </summary>
public static string pokemon_moves {
get {
return ResourceManager.GetString("pokemon_moves", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You don&apos;t have enough {0}.
/// </summary>
public static string pokemon_no_currency {
get {
return ResourceManager.GetString("pokemon_no_currency", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It&apos;s not effective..
/// </summary>
public static string pokemon_not_effective {
get {
return ResourceManager.GetString("pokemon_not_effective", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to revived {0} with one {1}.
/// </summary>
public static string pokemon_revive_other {
get {
return ResourceManager.GetString("pokemon_revive_other", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You revived yourself with one {0}.
/// </summary>
public static string pokemon_revive_yourself {
get {
return ResourceManager.GetString("pokemon_revive_yourself", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Your type has been changed to {0} for a {1}.
/// </summary>
public static string pokemon_settype_success {
get {
return ResourceManager.GetString("pokemon_settype_success", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It&apos;s somewhat effective..
/// </summary>
public static string pokemon_somewhat_effective {
get {
return ResourceManager.GetString("pokemon_somewhat_effective", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It&apos;s super effective!.
/// </summary>
public static string pokemon_super_effective {
get {
return ResourceManager.GetString("pokemon_super_effective", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You used too many moves in a row, so you can&apos;t move!.
/// </summary>
public static string pokemon_too_many_moves {
get {
return ResourceManager.GetString("pokemon_too_many_moves", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Type of {0} is {1}.
/// </summary>
public static string pokemon_type_of_user {
get {
return ResourceManager.GetString("pokemon_type_of_user", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to User not found..
/// </summary>
public static string pokemon_user_not_found {
get {
return ResourceManager.GetString("pokemon_user_not_found", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You fainted, so you are not able to move!.
/// </summary>
public static string pokemon_you_fainted {
get {
return ResourceManager.GetString("pokemon_you_fainted", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="pokemon_already_fainted" xml:space="preserve">
<value>{0} has already fainted.</value>
</data>
<data name="pokemon_already_full" xml:space="preserve">
<value>{0} already has full HP.</value>
</data>
<data name="pokemon_already_that_type" xml:space="preserve">
<value>Your type is already {0}</value>
</data>
<data name="pokemon_attack" xml:space="preserve">
<value>used {0}{1} on {2}{3} for {4} damage.</value>
<comment>Kwoth used punch:type_icon: on Sanity:type_icon: for 50 damage.</comment>
</data>
<data name="pokemon_cant_attack_again" xml:space="preserve">
<value>You can't attack again without retaliation!</value>
</data>
<data name="pokemon_cant_attack_yourself" xml:space="preserve">
<value>You can't attack yourself.</value>
</data>
<data name="pokemon_fainted" xml:space="preserve">
<value>{0} has fainted!</value>
</data>
<data name="pokemon_healed" xml:space="preserve">
<value>healed {0} with one {1}</value>
</data>
<data name="pokemon_hp_remaining" xml:space="preserve">
<value>{0} has {1} HP remaining.</value>
</data>
<data name="pokemon_invalid_move" xml:space="preserve">
<value>You can't use {0}. Type `{1}ml` to see a list of moves you can use.</value>
</data>
<data name="pokemon_moves" xml:space="preserve">
<value>Movelist for {0} type</value>
</data>
<data name="pokemon_not_effective" xml:space="preserve">
<value>It's not effective.</value>
</data>
<data name="pokemon_no_currency" xml:space="preserve">
<value>You don't have enough {0}</value>
</data>
<data name="pokemon_revive_other" xml:space="preserve">
<value>revived {0} with one {1}</value>
</data>
<data name="pokemon_revive_yourself" xml:space="preserve">
<value>You revived yourself with one {0}</value>
</data>
<data name="pokemon_settype_success" xml:space="preserve">
<value>Your type has been changed to {0} for a {1}</value>
</data>
<data name="pokemon_somewhat_effective" xml:space="preserve">
<value>It's somewhat effective.</value>
</data>
<data name="pokemon_super_effective" xml:space="preserve">
<value>It's super effective!</value>
</data>
<data name="pokemon_too_many_moves" xml:space="preserve">
<value>You used too many moves in a row, so you can't move!</value>
</data>
<data name="pokemon_type_of_user" xml:space="preserve">
<value>Type of {0} is {1}</value>
</data>
<data name="pokemon_user_not_found" xml:space="preserve">
<value>User not found.</value>
</data>
<data name="pokemon_you_fainted" xml:space="preserve">
<value>You fainted, so you are not able to move!</value>
</data>
</root>

View File

@ -69,7 +69,7 @@ namespace NadekoBot.Services
} }
} }
internal void SetDefaultCulture(CultureInfo ci) public void SetDefaultCulture(CultureInfo ci)
{ {
DefaultCultureInfo = ci; DefaultCultureInfo = ci;
} }