Reputation: 1901
I wanted to implement an api call for Azure Cognitive Services TTS. And by courtesy of @Md Farid Uddin Kiron stackoverflow user and the question that we discussed on this link So, I pulled down an sample code that is an .netcore web app which communicates with Azure. Sample link is here
I have a following problem: The app works perfectly with predefined languages in a model such as:
public List<SelectListItem> LanguagePreference { get; set; } = new List<SelectListItem>
{
new SelectListItem { Value = "NA", Text = "-Select-" },
new SelectListItem { Value = "en-US", Text = "English (United States)" },
new SelectListItem { Value = "en-IN", Text = "English (India)" },
new SelectListItem { Value = "ta-IN", Text = "Tamil (India)" },
new SelectListItem { Value = "hi-IN", Text = "Hindi (India)" },
new SelectListItem { Value = "te-IN", Text = "Telugu (India)" }
};
but when I add for example an italian language (it-IT, hr-HR - those are language codes for fields Value), the code breaks in HomeController on method Translate.
Upvotes: 1
Views: 272
Reputation: 22419
I have reproduce your problem successfully.
As per my findings there are some key points to language supports like:
Subscription Free subscription doesn't allow all language
var requestBody = this.GenerateSsml(lang, "Female",
this.ServiceName(lang), content);
Note: language that doesn't support Female also can be the issue.
Your Case:
In your code you could try with below code at LanguagePreference
list
new SelectListItem { Value = "es-ES", Text = "es-ES,(Spanish)" }
Also Change on below code under ServiceName
I have tested with Spanish which works fine.
values.Add("es-ES", "Microsoft Server Speech Text to Speech Voice (es-ES, Laura, Apollo)");
Point To Remember:
Our code base is alright. problem is not related to code. Please be sure your subscriptions and region support translation you are trying. can also rise your support ticket on azure portal.
Upvotes: 1