public ActionResult TranslateComment(TranslateCommentViewModel comment) { var translate = new AmazonTranslateClient("AWS-ACCESS-KEY", "AWS-SECRET-KEY", RegionEndpoint.USEast1); var request = new TranslateTextRequest() { Text = comment.CommentText, SourceLanguageCode = "en", TargetLanguageCode = comment.TargetLanguage }; var model = new TranslatedCommentViewModel() { CommentText = comment.CommentText, SubmitterName = comment.SubmitterName, TargetLangauge = comment.TargetLanguage, TranslateResponse = translate.TranslateText(request) // Make the actual call to Amazon Translate }; return(View(model)); }
public ActionResult TranslateComment(TranslateCommentViewModel comment) { var translate = new AmazonTranslateClient("AKIAX3JSZJ36DOCUNIJY", "vTKVVvQs01qY25LczK5uSdD3gev49cdXfKNr7LRT", RegionEndpoint.USEast1); var request = new TranslateTextRequest() { Text = comment.CommentText, SourceLanguageCode = "en", TargetLanguageCode = comment.TargetLanguage }; var task = translate.TranslateTextAsync(request); //.TranslateText(request) // Make the actual call to Amazon Translate task.Wait(); var model = new TranslatedCommentViewModel() { CommentText = comment.CommentText, SubmitterName = comment.SubmitterName, TargetLangauge = comment.TargetLanguage, TranslateResponse = task.Result }; return(View(model)); }
public ActionResult AddComment() { var model = new TranslateCommentViewModel(); return(View(model)); }