Fixed source culture for DeepL service

This commit is contained in:
Thorsten Sommer 2022-09-21 19:56:50 +02:00
parent 1393d703a1
commit a179e8dd23
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -52,6 +52,9 @@ public static class DeepL
var sourceCultureIndex = await AppSettings.GetDeepLSourceCultureIndex(); var sourceCultureIndex = await AppSettings.GetDeepLSourceCultureIndex();
var sourceCulture = await AppSettings.GetCultureCode(sourceCultureIndex); var sourceCulture = await AppSettings.GetCultureCode(sourceCultureIndex);
// In case of the source culture, we cannot specify the region, so we need to remove it:
sourceCulture = sourceCulture.Split('-')[0];
using var deepl = new Translator(deepLAPIKey); using var deepl = new Translator(deepLAPIKey);
var translation = await deepl.TranslateTextAsync(text, sourceCulture, targetCulture); var translation = await deepl.TranslateTextAsync(text, sourceCulture, targetCulture);