Skip to content

Commit

Permalink
Improve voices list of sample sites - group voices by language
Browse files Browse the repository at this point in the history
  • Loading branch information
jsakamoto committed May 30, 2024
1 parent 263cf97 commit c6a8073
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions SampleSites/Components/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@
Voice:
<select @onchange="OnChangeVoice" style="max-width:100%;">
<option value="@(default(string))">(unset)</option>
@foreach (var voice in Voices.OrderBy(v => v.Lang).ThenBy(v => v.VoiceURI))
@foreach (var voicesOfLang in Voices.GroupBy(v => v.Lang))
{
<option @key="voice.VoiceIdentity" value="@voice.VoiceIdentity" selected="@(voice.VoiceIdentity == this.VoiceId)">@voice.Name (@voice.Lang)</option>
<optgroup label="@voicesOfLang.Key">
@foreach (var voice in voicesOfLang.OrderBy(v => v.Lang).ThenBy(v => v.VoiceURI))
{
<option @key="voice.VoiceIdentity" value="@voice.VoiceIdentity" selected="@(voice.VoiceIdentity == this.VoiceId)">@voice.Name</option>
}
</optgroup>
}
</select>
</p>
Expand Down

0 comments on commit c6a8073

Please sign in to comment.