MultiLanguageGenerator class
LanguageGenerator which uses implements a map of locale->LanguageGenerator for the locale and has a policy which controls fallback (try en-us -> en -> default).
- Extends
Properties
$kind | |
language |
Gets or sets the language generators for multiple languages. |
Inherited Properties
language |
Language policy required by language generator. |
Methods
try |
Implementation of lookup by locale. |
Inherited Methods
configure(Record<string, unknown>) | Fluent method for configuring the object. |
generate(Dialog |
Find a language generator that matches the current context locale. |
get |
Property Details
$kind
static $kind: string
Property Value
string
languageGenerators
Gets or sets the language generators for multiple languages.
languageGenerators: Map<string, LanguageGenerator>
Property Value
Map<string, LanguageGenerator>
Inherited Property Details
languagePolicy
Language policy required by language generator.
languagePolicy: LanguagePolicy
Property Value
Inherited From MultiLanguageGeneratorBase.languagePolicy
Method Details
tryGetGenerator(DialogContext, string)
Implementation of lookup by locale.
function tryGetGenerator(dialogContext: DialogContext, locale: string): { exist: boolean, result: LanguageGenerator }
Parameters
- dialogContext
-
DialogContext
Context for the current turn of conversation with the user.
- locale
-
string
Locale to lookup.
Returns
{ exist: boolean, result: LanguageGenerator }
An object with a boolean showing existence and the language generator.
Inherited Method Details
configure(Record<string, unknown>)
Fluent method for configuring the object.
function configure(config: Record<string, unknown>): this
Parameters
- config
-
Record<string, unknown>
Configuration settings to apply.
Returns
this
The Configurable after the operation is complete.
Inherited From Configurable.configure
generate(DialogContext, string, D)
Find a language generator that matches the current context locale.
function generate(dialogContext: DialogContext, template: string, data: D): Promise<T>
Parameters
- dialogContext
-
DialogContext
Context for the current turn of conversation.
- template
-
string
Template to use.
- data
-
D
Data to bind to.
Returns
Promise<T>
A promise representing the asynchronous operation.
Inherited From MultiLanguageGeneratorBase.generate
getConverter(Object)
function getConverter(property: Object): Converter | ConverterFactory
Parameters
- property
-
Object
The key of the conditional selector configuration.
Returns
Converter | ConverterFactory
The converter for the selector configuration.
Inherited From MultiLanguageGeneratorBase.getConverter