From a179e8dd231a5a6f3a85f6c5a2b8c659b49264af Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Wed, 21 Sep 2022 19:56:50 +0200 Subject: [PATCH] Fixed source culture for DeepL service --- I18N Commander/Processor/DeepL.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/I18N Commander/Processor/DeepL.cs b/I18N Commander/Processor/DeepL.cs index bbfe58e..49be452 100644 --- a/I18N Commander/Processor/DeepL.cs +++ b/I18N Commander/Processor/DeepL.cs @@ -52,6 +52,9 @@ public static class DeepL var sourceCultureIndex = await AppSettings.GetDeepLSourceCultureIndex(); 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); var translation = await deepl.TranslateTextAsync(text, sourceCulture, targetCulture);