mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Added full list of supported languages for .trans command, improved .translangs output
This commit is contained in:
@@ -10,142 +10,11 @@ using System.Xml;
|
||||
|
||||
namespace NadekoBot.Services;
|
||||
|
||||
public class GoogleApiService : IGoogleApiService, INService
|
||||
public sealed partial class GoogleApiService : IGoogleApiService, INService
|
||||
{
|
||||
private static readonly Regex
|
||||
_plRegex = new("(?:youtu\\.be\\/|list=)(?<id>[\\da-zA-Z\\-_]*)", RegexOptions.Compiled);
|
||||
|
||||
public IReadOnlyDictionary<string, string> Languages { get; } = new Dictionary<string, string>
|
||||
{
|
||||
{ "afrikaans", "af" },
|
||||
{ "albanian", "sq" },
|
||||
{ "arabic", "ar" },
|
||||
{ "armenian", "hy" },
|
||||
{ "azerbaijani", "az" },
|
||||
{ "basque", "eu" },
|
||||
{ "belarusian", "be" },
|
||||
{ "bengali", "bn" },
|
||||
{ "bulgarian", "bg" },
|
||||
{ "catalan", "ca" },
|
||||
{ "chinese", "zh-CN" },
|
||||
{ "chinese-trad", "zh-TW" },
|
||||
{ "croatian", "hr" },
|
||||
{ "czech", "cs" },
|
||||
{ "danish", "da" },
|
||||
{ "dutch", "nl" },
|
||||
{ "english", "en" },
|
||||
{ "esperanto", "eo" },
|
||||
{ "estonian", "et" },
|
||||
{ "filipino", "tl" },
|
||||
{ "finnish", "fi" },
|
||||
{ "french", "fr" },
|
||||
{ "galician", "gl" },
|
||||
{ "german", "de" },
|
||||
{ "georgian", "ka" },
|
||||
{ "greek", "el" },
|
||||
{ "haitian Creole", "ht" },
|
||||
{ "hebrew", "iw" },
|
||||
{ "hindi", "hi" },
|
||||
{ "hungarian", "hu" },
|
||||
{ "icelandic", "is" },
|
||||
{ "indonesian", "id" },
|
||||
{ "irish", "ga" },
|
||||
{ "italian", "it" },
|
||||
{ "japanese", "ja" },
|
||||
{ "korean", "ko" },
|
||||
{ "lao", "lo" },
|
||||
{ "latin", "la" },
|
||||
{ "latvian", "lv" },
|
||||
{ "lithuanian", "lt" },
|
||||
{ "macedonian", "mk" },
|
||||
{ "malay", "ms" },
|
||||
{ "maltese", "mt" },
|
||||
{ "norwegian", "no" },
|
||||
{ "persian", "fa" },
|
||||
{ "polish", "pl" },
|
||||
{ "portuguese", "pt" },
|
||||
{ "romanian", "ro" },
|
||||
{ "russian", "ru" },
|
||||
{ "serbian", "sr" },
|
||||
{ "slovak", "sk" },
|
||||
{ "slovenian", "sl" },
|
||||
{ "spanish", "es" },
|
||||
{ "swahili", "sw" },
|
||||
{ "swedish", "sv" },
|
||||
{ "tamil", "ta" },
|
||||
{ "telugu", "te" },
|
||||
{ "thai", "th" },
|
||||
{ "turkish", "tr" },
|
||||
{ "ukrainian", "uk" },
|
||||
{ "urdu", "ur" },
|
||||
{ "vietnamese", "vi" },
|
||||
{ "welsh", "cy" },
|
||||
{ "yiddish", "yi" },
|
||||
{ "af", "af" },
|
||||
{ "sq", "sq" },
|
||||
{ "ar", "ar" },
|
||||
{ "hy", "hy" },
|
||||
{ "az", "az" },
|
||||
{ "eu", "eu" },
|
||||
{ "be", "be" },
|
||||
{ "bn", "bn" },
|
||||
{ "bg", "bg" },
|
||||
{ "ca", "ca" },
|
||||
{ "zh-tw", "zh-TW" },
|
||||
{ "zh-cn", "zh-CN" },
|
||||
{ "hr", "hr" },
|
||||
{ "cs", "cs" },
|
||||
{ "da", "da" },
|
||||
{ "nl", "nl" },
|
||||
{ "en", "en" },
|
||||
{ "eo", "eo" },
|
||||
{ "et", "et" },
|
||||
{ "tl", "tl" },
|
||||
{ "fi", "fi" },
|
||||
{ "fr", "fr" },
|
||||
{ "gl", "gl" },
|
||||
{ "de", "de" },
|
||||
{ "ka", "ka" },
|
||||
{ "el", "el" },
|
||||
{ "ht", "ht" },
|
||||
{ "iw", "iw" },
|
||||
{ "hi", "hi" },
|
||||
{ "hu", "hu" },
|
||||
{ "is", "is" },
|
||||
{ "id", "id" },
|
||||
{ "ga", "ga" },
|
||||
{ "it", "it" },
|
||||
{ "ja", "ja" },
|
||||
{ "ko", "ko" },
|
||||
{ "lo", "lo" },
|
||||
{ "la", "la" },
|
||||
{ "lv", "lv" },
|
||||
{ "lt", "lt" },
|
||||
{ "mk", "mk" },
|
||||
{ "ms", "ms" },
|
||||
{ "mt", "mt" },
|
||||
{ "no", "no" },
|
||||
{ "fa", "fa" },
|
||||
{ "pl", "pl" },
|
||||
{ "pt", "pt" },
|
||||
{ "ro", "ro" },
|
||||
{ "ru", "ru" },
|
||||
{ "sr", "sr" },
|
||||
{ "sk", "sk" },
|
||||
{ "sl", "sl" },
|
||||
{ "es", "es" },
|
||||
{ "sw", "sw" },
|
||||
{ "sv", "sv" },
|
||||
{ "ta", "ta" },
|
||||
{ "te", "te" },
|
||||
{ "th", "th" },
|
||||
{ "tr", "tr" },
|
||||
{ "uk", "uk" },
|
||||
{ "ur", "ur" },
|
||||
{ "vi", "vi" },
|
||||
{ "cy", "cy" },
|
||||
{ "yi", "yi" }
|
||||
};
|
||||
|
||||
private readonly YouTubeService _yt;
|
||||
private readonly UrlshortenerService _sh;
|
||||
@@ -154,7 +23,7 @@ public class GoogleApiService : IGoogleApiService, INService
|
||||
private readonly IBotCredsProvider _creds;
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
|
||||
public GoogleApiService(IBotCredsProvider creds, IHttpClientFactory factory)
|
||||
public GoogleApiService(IBotCredsProvider creds, IHttpClientFactory factory) : this()
|
||||
{
|
||||
_creds = creds;
|
||||
_httpFactory = factory;
|
||||
|
Reference in New Issue
Block a user