Translate !8ball

This commit is contained in:
Daan Boerlage 2021-03-29 19:02:31 +02:00
parent 5b99ee951b
commit 153ce3dca4
Signed by: daan
GPG key ID: FCE070E1E4956606
5 changed files with 558 additions and 29 deletions

View file

@ -88,6 +88,10 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Corona.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Localization\EightBall.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>EightBall.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Localization\Ship.Designer.cs">
@ -153,5 +157,10 @@
<AutoGen>True</AutoGen>
<DependentUpon>Corona.resx</DependentUpon>
</Compile>
<Compile Update="Localization\EightBall.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>EightBall.resx</DependentUpon>
</Compile>
</ItemGroup>
</Project>

View file

@ -1,18 +1,18 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading.Tasks;
using Discord.Commands;
using Geekbot.Core;
using Geekbot.Core.ErrorHandling;
using Geekbot.Core.GuildSettingsManager;
namespace Geekbot.Bot.Commands.Randomness
{
public class EightBall : ModuleBase
public class EightBall : GeekbotCommandBase
{
private readonly IErrorHandler _errorHandler;
public EightBall(IErrorHandler errorHandler)
public EightBall(IErrorHandler errorHandler, IGuildSettingsManager guildSettingsManager) : base(errorHandler, guildSettingsManager)
{
_errorHandler = errorHandler;
}
[Command("8ball", RunMode = RunMode.Async)]
@ -21,36 +21,19 @@ namespace Geekbot.Bot.Commands.Randomness
{
try
{
var replies = new List<string>
var enumerator = Localization.EightBall.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true).GetEnumerator();
var replies = new List<string>();
while (enumerator.MoveNext())
{
"It is certain",
"It is decidedly so",
"Without a doubt",
"Yes, definitely",
"You may rely on it",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes",
"Reply hazy try again",
"Ask again later",
"Better not tell you now",
"Cannot predict now",
"Concentrate and ask again",
"Don't count on it",
"My reply is no",
"My sources say no",
"Outlook not so good",
"Very doubtful"
};
replies.Add(enumerator.Value?.ToString());
}
var answer = new Random().Next(replies.Count);
await ReplyAsync(replies[answer]);
}
catch (Exception e)
{
await _errorHandler.HandleCommandException(e, Context);
await ErrorHandler.HandleCommandException(e, Context);
}
}
}

243
src/Bot/Localization/EightBall.Designer.cs generated Normal file
View file

@ -0,0 +1,243 @@
//------------------------------------------------------------------------------
// <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 Geekbot.Bot.Localization {
using System;
/// <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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class EightBall {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal EightBall() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Geekbot.Bot.Localization.EightBall", typeof(EightBall).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)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to As I see it, yes.
/// </summary>
internal static string AsISeeItYes {
get {
return ResourceManager.GetString("AsISeeItYes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ask again later.
/// </summary>
internal static string AskAgainLater {
get {
return ResourceManager.GetString("AskAgainLater", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Better not tell you now.
/// </summary>
internal static string BetterNotTellYouNow {
get {
return ResourceManager.GetString("BetterNotTellYouNow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot predict now.
/// </summary>
internal static string CannotPredictNow {
get {
return ResourceManager.GetString("CannotPredictNow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Concentrate and ask again.
/// </summary>
internal static string ConcentrateAndAskAgain {
get {
return ResourceManager.GetString("ConcentrateAndAskAgain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Don&apos;t count on it.
/// </summary>
internal static string DontCountOnIt {
get {
return ResourceManager.GetString("DontCountOnIt", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It is certain.
/// </summary>
internal static string ItIsCertain {
get {
return ResourceManager.GetString("ItIsCertain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It is decidedly so.
/// </summary>
internal static string ItIsDecidedlySo {
get {
return ResourceManager.GetString("ItIsDecidedlySo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Most likely.
/// </summary>
internal static string MostLikely {
get {
return ResourceManager.GetString("MostLikely", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to My reply is no.
/// </summary>
internal static string MyReplyIsNo {
get {
return ResourceManager.GetString("MyReplyIsNo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to My sources say no.
/// </summary>
internal static string MySourcesSayNo {
get {
return ResourceManager.GetString("MySourcesSayNo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Outlook good.
/// </summary>
internal static string OutlookGood {
get {
return ResourceManager.GetString("OutlookGood", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Outlook not so good.
/// </summary>
internal static string OutlookNotSoGood {
get {
return ResourceManager.GetString("OutlookNotSoGood", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Reply hazy try again.
/// </summary>
internal static string ReplyHazyTryAgain {
get {
return ResourceManager.GetString("ReplyHazyTryAgain", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Signs point to yes.
/// </summary>
internal static string SignsPointToYes {
get {
return ResourceManager.GetString("SignsPointToYes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Very doubtful.
/// </summary>
internal static string VeryDoubtful {
get {
return ResourceManager.GetString("VeryDoubtful", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Without a doubt.
/// </summary>
internal static string WithoutADoubt {
get {
return ResourceManager.GetString("WithoutADoubt", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Yes.
/// </summary>
internal static string Yes {
get {
return ResourceManager.GetString("Yes", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Yes, definitely.
/// </summary>
internal static string YesDefinitely {
get {
return ResourceManager.GetString("YesDefinitely", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You may rely on it.
/// </summary>
internal static string YouMayRelyOnIt {
get {
return ResourceManager.GetString("YouMayRelyOnIt", resourceCulture);
}
}
}
}

View file

@ -0,0 +1,94 @@
<root>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ItIsCertain" xml:space="preserve">
<value>Es isch sicher</value>
<comment/>
</data>
<data name="ItIsDecidedlySo" xml:space="preserve">
<value>So isch es entschiede worde</value>
<comment/>
</data>
<data name="WithoutADoubt" xml:space="preserve">
<value>Ohni zwifel</value>
<comment/>
</data>
<data name="YesDefinitely" xml:space="preserve">
<value>Ja, absolut</value>
<comment/>
</data>
<data name="YouMayRelyOnIt" xml:space="preserve">
<value>Chasch davo usgoh</value>
<comment/>
</data>
<data name="AsISeeItYes" xml:space="preserve">
<value>Wie ich es gsehn, ja</value>
<comment/>
</data>
<data name="MostLikely" xml:space="preserve">
<value>Sehr waschinli</value>
<comment/>
</data>
<data name="OutlookGood" xml:space="preserve">
<value>Ussicht isch guet</value>
<comment/>
</data>
<data name="Yes" xml:space="preserve">
<value>Ja</value>
<comment/>
</data>
<data name="SignsPointToYes" xml:space="preserve">
<value>Ahzeiche zeigend uf ja</value>
<comment/>
</data>
<data name="ReplyHazyTryAgain" xml:space="preserve">
<value>Antwort isch verschwumme, versuechs nomol</value>
<comment/>
</data>
<data name="AskAgainLater" xml:space="preserve">
<value>Frög spöter nomol</value>
<comment/>
</data>
<data name="BetterNotTellYouNow" xml:space="preserve">
<value>Segs dir jetzt besser nid</value>
<comment/>
</data>
<data name="CannotPredictNow" xml:space="preserve">
<value>Im mommnet chani das nid vorussege</value>
<comment/>
</data>
<data name="ConcentrateAndAskAgain" xml:space="preserve">
<value>Konzentrier di und frog nomol</value>
<comment/>
</data>
<data name="DontCountOnIt" xml:space="preserve">
<value>Zähl nid druf</value>
<comment/>
</data>
<data name="MyReplyIsNo" xml:space="preserve">
<value>Mini antwort isch nei</value>
<comment/>
</data>
<data name="MySourcesSayNo" xml:space="preserve">
<value>Mini quellene seged nei</value>
<comment/>
</data>
<data name="OutlookNotSoGood" xml:space="preserve">
<value>Ussicht isch ned so guet</value>
<comment/>
</data>
<data name="VeryDoubtful" xml:space="preserve">
<value>Sehr froglich</value>
<comment/>
</data>
</root>

View file

@ -0,0 +1,200 @@
<?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="ItIsCertain" xml:space="preserve">
<value>It is certain</value>
<comment/>
</data>
<data name="ItIsDecidedlySo" xml:space="preserve">
<value>It is decidedly so</value>
<comment/>
</data>
<data name="WithoutADoubt" xml:space="preserve">
<value>Without a doubt</value>
<comment/>
</data>
<data name="YesDefinitely" xml:space="preserve">
<value>Yes, definitely</value>
<comment/>
</data>
<data name="YouMayRelyOnIt" xml:space="preserve">
<value>You may rely on it</value>
<comment/>
</data>
<data name="AsISeeItYes" xml:space="preserve">
<value>As I see it, yes</value>
<comment/>
</data>
<data name="MostLikely" xml:space="preserve">
<value>Most likely</value>
<comment/>
</data>
<data name="OutlookGood" xml:space="preserve">
<value>Outlook good</value>
<comment/>
</data>
<data name="Yes" xml:space="preserve">
<value>Yes</value>
<comment/>
</data>
<data name="SignsPointToYes" xml:space="preserve">
<value>Signs point to yes</value>
<comment/>
</data>
<data name="ReplyHazyTryAgain" xml:space="preserve">
<value>Reply hazy try again</value>
<comment/>
</data>
<data name="AskAgainLater" xml:space="preserve">
<value>Ask again later</value>
<comment/>
</data>
<data name="BetterNotTellYouNow" xml:space="preserve">
<value>Better not tell you now</value>
<comment/>
</data>
<data name="CannotPredictNow" xml:space="preserve">
<value>Cannot predict now</value>
<comment/>
</data>
<data name="ConcentrateAndAskAgain" xml:space="preserve">
<value>Concentrate and ask again</value>
<comment/>
</data>
<data name="DontCountOnIt" xml:space="preserve">
<value>Don't count on it</value>
<comment/>
</data>
<data name="MyReplyIsNo" xml:space="preserve">
<value>My reply is no</value>
<comment/>
</data>
<data name="MySourcesSayNo" xml:space="preserve">
<value>My sources say no</value>
<comment/>
</data>
<data name="OutlookNotSoGood" xml:space="preserve">
<value>Outlook not so good</value>
<comment/>
</data>
<data name="VeryDoubtful" xml:space="preserve">
<value>Very doubtful</value>
<comment/>
</data>
</root>