Updated translation service and finished splitting out responsibilities for now

This commit is contained in:
gamer147
2025-11-18 10:07:23 -05:00
parent 3bb8f7f158
commit 0c1705ebe1
48 changed files with 617 additions and 1134 deletions

View File

@@ -5,15 +5,15 @@ using Language = FictionArchive.Common.Enums.Language;
namespace FictionArchive.Service.TranslationService.Services.TranslationEngines.DeepLTranslate;
public class DeepLTranslationAdapater : ITranslationEngineAdapter
public class DeepLTranslationEngine : ITranslationEngine
{
private readonly DeepLClient _deepLClient;
private readonly ILogger<DeepLTranslationAdapater> _logger;
private readonly ILogger<DeepLTranslationEngine> _logger;
private const string DisplayName = "DeepL";
private const string Key = "deepl";
public DeepLTranslationAdapater(DeepLClient deepLClient, ILogger<DeepLTranslationAdapater> logger)
public DeepLTranslationEngine(DeepLClient deepLClient, ILogger<DeepLTranslationEngine> logger)
{
_deepLClient = deepLClient;
_logger = logger;
@@ -45,7 +45,8 @@ public class DeepLTranslationAdapater : ITranslationEngineAdapter
Language.En => LanguageCode.EnglishAmerican,
Language.Kr => LanguageCode.Korean,
Language.Ch => LanguageCode.Chinese,
Language.Ja => LanguageCode.Japanese
Language.Ja => LanguageCode.Japanese,
_ => throw new ArgumentOutOfRangeException(nameof(language), language, null)
};
}
}

View File

@@ -3,7 +3,7 @@ using FictionArchive.Service.TranslationService.Models;
namespace FictionArchive.Service.TranslationService.Services.TranslationEngines;
public interface ITranslationEngineAdapter
public interface ITranslationEngine
{
public TranslationEngineDescriptor Descriptor { get; }
public Task<string?> GetTranslation(string body, Language from, Language to);