Skip to content

Small helper library to allow Alexa.NET skills the ability to manage speech by locale

License

Notifications You must be signed in to change notification settings

stoiveyp/Alexa.NET.LocaleSpeech

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alexa.NET.LocaleSpeech

A small library to allow locale speech to be maintained seperately to the skill logic using it

This is done by registering "stores", classes that can support one or more locales.

Create a LocaleSpeech Store

The easiest kind of store to create is a DictionaryLocaleStore.

You can create stores for specific locales (en-GB, fr-CA) or general language (en, fr)

var store = new DictionaryLocaleSpeechStore();
    store.AddLanguage("en", new Dictionary<string,object>
    {
        { "key", "value" },
        { "ssmlKey", new Speech(new PlainText("ssml value {0}")) }
    }

Register a store

LocaleSpeech will check for specific, then general, in that order.

var factory = new LocaleSpeechFactory(store);

Create locale speech for a skill request

This uses the request locale

 var localeSpeech = factory.CreateClient(skillRequest);

Set speech with ResponseBuilder

Generate IOutputSpeech objects based on store keys

ResponseBuilder.Tell(localeSpeech.Get("key"));
ResponseBuilder.Ask(localeSpeech.Get("ssmlKey",specificValue);

About

Small helper library to allow Alexa.NET skills the ability to manage speech by locale

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages