1 Answer
- Newest
- Most votes
- Most comments
0
Updated code with solution that works for me:
using (var client = new AmazonTranslateClient(awsCredentials, selectedRegion))
{
var request = new Amazon.Translate.Model.TranslateTextRequest();
request.Text = toTranslate;
request.SourceLanguageCode = sourceLanguage; // SourceLanguageItem.LanguageCode;
request.TargetLanguageCode = translateLanguage; // TranslateLanguageItem.LanguageCode;
TranslationSettings settings = new TranslationSettings();
settings.Formality = "FORMAL";
request.Settings = settings;
answered a year ago
Relevant content
- Accepted Answerasked a year ago
- Accepted Answerasked 6 months ago
- Accepted Answerasked 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
Still no luck (it's been a month now) and I'm still getting the same error even with the recently announced update for both real time and asynchronous operations (https://aws.amazon.com/about-aws/whats-new/2022/10/amazon-translate-formality-customization-support-dutch-korean-mexican-spanish/). Note: I also tried request.Settings.Profanity and the object is coming back null so I can't even check to see what the setting is.
I thought maybe replacing request.Settings.Formality = "FORMAL" to request.Settings.Formality = Formality.FORMAL; would do the trick but still getting the System.NullReferenceException error.