private async Task AddLocalizationToVideoTask(TranslationServiceClient service, Video video, string language, string localizationCountHash) { string vidTitle = video.Snippet.Title; string vidDescription = video.Snippet.Description; string vidLanguage = video.Snippet.DefaultLanguage; string targetLanguageCode = language; string sourceLanguageCode = vidLanguage; VideoLocalization localization = new VideoLocalization { Description = await service.SimpleTranslation(targetLanguageCode, sourceLanguageCode, vidDescription), Title = await service.SimpleTranslation(targetLanguageCode, sourceLanguageCode, vidTitle), }; video.Localizations[language] = localization; _ = ++intStore[localizationCountHash]; }
public async Task <ActionResult <string> > GetSimpleTranslation( [FromQuery] string targetLanguageCode, [FromQuery] string sourceLanguageCode, [FromBody] string text) { TranslationServiceClient service = await translateServiceAccessor.InitializeServiceAsync(); return(await service.SimpleTranslation(targetLanguageCode, sourceLanguageCode, text));; }