Initial commit

This commit is contained in:
Mira 2025-01-27 18:37:17 +01:00
commit ea04fd2785
Signed by untrusted user who does not match committer: Xorog
GPG key ID: 983798ED9C3E7C36
25 changed files with 2156 additions and 0 deletions

View file

@ -0,0 +1,16 @@
// Project Makoto
// Copyright (C) 2023 Fortunevale
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
namespace ProjectMakoto.Plugins.Translation.Entities;
internal sealed class LibreTranslateLanguage
{
public string? code { get; set; }
public string? name { get; set; }
}

View file

@ -0,0 +1,23 @@
// Project Makoto
// Copyright (C) 2023 Fortunevale
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
namespace ProjectMakoto.Plugins.Translation.Entities;
internal sealed class LibreTranslateTranslation
{
public string? translatedText { get; set; }
public DetectedLanguage? detectedLanguage { get; set; }
internal sealed class DetectedLanguage
{
public decimal? confidence { get; set; }
public string? language { get; set; }
}
}

10
Entities/PluginConfig.cs Normal file
View file

@ -0,0 +1,10 @@
// Project Makoto Example Plugin
// Copyright (C) 2023 Fortunevale
// This code is licensed under MIT license (see 'LICENSE'-file for details)
namespace ProjectMakoto.Plugins.Translation.Entities;
public class PluginConfig
{
public string LibreTranslateHost = "127.0.0.1";
}

View file

@ -0,0 +1,44 @@
using ProjectMakoto.Database;
using ProjectMakoto.Enums;
namespace ProjectMakoto.Plugins.Translations.Entities;
[TableName("users")]
public class TranslateTable : PluginDatabaseTable
{
public TranslateTable(BasePlugin plugin, ulong identifierValue) : base(plugin, identifierValue)
{
this.Id = identifierValue;
}
[ColumnName("userid"), ColumnType(ColumnTypes.BigInt), Primary]
internal ulong Id { get; init; }
[ColumnName("last_google_source"), ColumnType(ColumnTypes.Text), Nullable]
public string LastGoogleSource
{
get => this.GetValue<string>(this.Id, "last_google_source");
set => _ = this.SetValue(this.Id, "last_google_source", value);
}
[ColumnName("last_google_target"), ColumnType(ColumnTypes.Text), Nullable]
public string LastGoogleTarget
{
get => this.GetValue<string>(this.Id, "last_google_target");
set => _ = this.SetValue(this.Id, "last_google_target", value);
}
[ColumnName("last_libretranslate_source"), ColumnType(ColumnTypes.Text), Nullable]
public string LastLibreTranslateSource
{
get => this.GetValue<string>(this.Id, "last_libretranslate_source");
set => _ = this.SetValue(this.Id, "last_libretranslate_source", value);
}
[ColumnName("last_libretranslate_target"), ColumnType(ColumnTypes.Text), Nullable]
public string LastLibreTranslateTarget
{
get => this.GetValue<string>(this.Id, "last_libretranslate_target");
set => _ = this.SetValue(this.Id, "last_libretranslate_target", value);
}
}

36
Entities/Translations.cs Normal file
View file

@ -0,0 +1,36 @@
// Project Makoto
// Copyright (C) 2023 Fortunevale
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY
namespace ProjectMakoto.Plugins.Translation.Entities;
#pragma warning disable CS8981
#pragma warning disable CS8618
#pragma warning disable IDE1006
public class Translations : ITranslations
{
public Dictionary<string, int> Progress = new();
public CommandTranslation[] CommandList { get; set; }
#region AutoGenerated
public commands Commands;
public sealed class commands
{
public translateMessage TranslateMessage;
public sealed class translateMessage
{
public SingleTranslationKey Translated;
public MultiTranslationKey Queue;
public SingleTranslationKey Translating;
public SingleTranslationKey SelectTargetDropdown;
public SingleTranslationKey SelectTarget;
public SingleTranslationKey SelectSourceDropdown;
public SingleTranslationKey SelectSource;
public SingleTranslationKey SelectProvider;
public SingleTranslationKey NoContent;
}
}
#endregion AutoGenerated
}