Beispiel #1
0
        public async Task <string[]> TranslateTextAsync(string text, string fromLang, string toLang, bool ignoreGoogle = false, bool ignoreAzure = false)
        {
            var translations = new string[2];

            if (!ignoreGoogle)
            {
                translations[0] = await _googleProvider.TranslateTextAsync(text, fromLang, toLang).ConfigureAwait(false);
            }
            if (!ignoreAzure)
            {
                translations[1] = await _azureProvider.TranslateAzureAsync(text, fromLang, toLang).ConfigureAwait(false);
            }
            return(translations);
        }