You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I use the example code given in the readme then I get an error that the language code "en" is deprecated and to use "en-GB" instead, however, if I try and change to this then my program hangs indefinitely.
Call the translation function as follows: TextResult t= TranslateText(speech.OriginalText).Result;
Receive error "One or more errors occurred. (targetLanguageCode="en" is deprecated, please use "en-GB" or "en-US" instead)"
I have tried changing my translation function as follows: return await translator.TranslateTextAsync(originalText, LanguageCode.Norwegian, "en-GB");
And this causes the program to hang indefinitely.
The text was updated successfully, but these errors were encountered:
Edit: Sorry I didnt see the .Result at the end of your lines, I corrected my answer.
Hi, thanks for reaching out!
there is maybe a related issue here: #15
How are you executing this code? In Visual Studio with its runner? Via console with dotnet run? Would be great to have a reproducible example for this.
Regarding the en language code being deprecated, could you point to where in the README you found this snippet? en is deprecated as a target language code, but I can only find it as a source language code in the readme (which is allowed)
Wrong previous answer:
Your TranslateText is still async, and returns a Task<TextResult>, not a TextResult.
Changing TextResult t= TranslateText(speech.OriginalText).Result;
to TextResult t = await TranslateText(speech.OriginalText).Result;
should fix your hanging issue.
We don't currently offer a synchronous way to get translation results in the library.
If I use the example code given in the readme then I get an error that the language code "en" is deprecated and to use "en-GB" instead, however, if I try and change to this then my program hangs indefinitely.
Steps to reproduce the behavior:
Call the translation function as follows:
TextResult t= TranslateText(speech.OriginalText).Result;
Receive error "One or more errors occurred. (targetLanguageCode="en" is deprecated, please use "en-GB" or "en-US" instead)"
I have tried changing my translation function as follows:
return await translator.TranslateTextAsync(originalText, LanguageCode.Norwegian, "en-GB");
And this causes the program to hang indefinitely.
The text was updated successfully, but these errors were encountered: