From 04a442d9d79cd5b177547f16e130d5c147a91732 Mon Sep 17 00:00:00 2001 From: Shiv Sarthak Sabhlok Date: Fri, 19 May 2023 19:14:11 +0530 Subject: [PATCH] Added 'LocaleName' in VoiceInfo Class (#679) --- src/sdk/SynthesisVoicesResult.ts | 2 +- src/sdk/VoiceInfo.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sdk/SynthesisVoicesResult.ts b/src/sdk/SynthesisVoicesResult.ts index 1d802ec8..d5f6da7d 100644 --- a/src/sdk/SynthesisVoicesResult.ts +++ b/src/sdk/SynthesisVoicesResult.ts @@ -22,7 +22,7 @@ export class SynthesisVoicesResult extends SynthesisResult { super(requestId, ResultReason.VoicesListRetrieved, undefined, new PropertyCollection()); this.privVoices = []; for (const item of json) { - this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] })); + this.privVoices.push(new VoiceInfo(item as { Name: string; LocalName: string; LocaleName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] })); } } else { super(requestId, ResultReason.Canceled, errorDetails ? errorDetails : "Error information unavailable", new PropertyCollection()); diff --git a/src/sdk/VoiceInfo.ts b/src/sdk/VoiceInfo.ts index 240a6db4..24982a43 100644 --- a/src/sdk/VoiceInfo.ts +++ b/src/sdk/VoiceInfo.ts @@ -34,17 +34,19 @@ export class VoiceInfo { private privLocale: string; private privShortName: string; private privLocalName: string; + private privLocaleName: string; private privGender: SynthesisVoiceGender; private privVoiceType: SynthesisVoiceType; private privStyleList: string[] = []; private privVoicePath: string; - public constructor(json: { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; Locale: string; StyleList: string[] }) { + public constructor(json: { Name: string; LocalName: string; ShortName: string; Gender: string; VoiceType: string; LocaleName: string ; Locale: string; StyleList: string[] }) { this.privVoicePath = ""; if (!!json) { this.privName = json.Name; this.privLocale = json.Locale; this.privShortName = json.ShortName; + this.privLocaleName = json.LocaleName; this.privLocalName = json.LocalName; this.privVoiceType = json.VoiceType.endsWith("Standard") ? SynthesisVoiceType.OnlineStandard : SynthesisVoiceType.OnlineNeural; this.privGender = json.Gender === "Male" ? SynthesisVoiceGender.Male : json.Gender === "Female" ? SynthesisVoiceGender.Female : SynthesisVoiceGender.Unknown; @@ -72,6 +74,10 @@ export class VoiceInfo { return this.privLocalName; } + public get localeName(): string { + return this.privLocaleName; + } + public get gender(): SynthesisVoiceGender { return this.privGender; }