d4n3436 / GTranslate

A collection of free translation APIs (Google Translate, Bing Translator, Microsoft Translator and Yandex.Translate).
MIT License
69 stars 11 forks source link

AggregateTranslator.TranslateAsync() returns no list of translated texts from the defined Translators. #4

Closed abussl closed 1 year ago

abussl commented 1 year ago

AggregateTranslator.TranslateAsync() returns no list of translated texts from the defined Translators.

Detected bug/malfunction: The function returns after the first iteration.

This should be possible:

var backTranslator = new AggregateTranslator(new List<GTranslate.Translators.ITranslator>()
{
    new GoogleTranslator(),
    new MicrosoftTranslator(),
    new YandexTranslator(),
    new BingTranslator()
});

//Expected:
List<ITranslationResult> result = await backTranslator.TranslateAsync(translatedText?.Text, "de");

//Currently:
// Only returns the result of GoogleTranslator in a single instance;

Thank you for sharing your work and happy new year :-)

d4n3436 commented 1 year ago

Hello, that's the intended behavior. AggregrateTranslator uses the translation services in the order provided. If one fails, the next translator is used.