Configuration
When importing the languageDetector
module, you can pass an object with settings to it.
All fields of this object are optional.
When to detect language
Field | Type | By default | Description |
---|---|---|---|
detectorMode | string | default | Language detection mode:
|
firstShortQueryCheck | boolean | false | Detect the language in the first request, even if it contains fewer than two words. |
detectorStates | array<string> | — | List of states that always require language detection when the bot transitions to them, regardless of detectorMode . |
noDetectorStates | array<string> | — | List of states that do not require language detection when the bot transitions to them, regardless of detectorMode . |
Logic for language selection
Field | Type | By default | Description |
---|---|---|---|
defaultLanguage | string | — | Default language. Specify the ISO code. If the bot cannot detect the language, then the bot uses the default language. You may not specify |
previousLanguagePreference | boolean | false | Write the language of the previous request to $session.language , if the bot cannot detect the language. If the value is false , the bot uses defaultLanguage . |
targetLanguages | array<string> | — | List of ISO codes of target languages:
|
sameGroupLanguageReplacement | boolean | true | Replace the received language with a related one if the received language belongs to the same group as one of the languages in Language groups are specified in |
Detection methods settings
Field | Type | By default | Description |
---|---|---|---|
confidenceThreshold | float | 1.5 | Threshold value when detecting language using Detect Language API. If the To use the API, add a key to the project. |
onlyCailaMethod | boolean | false | Use only the $caila.detectLanguage method to detect the language. |
Additional states
Field | Type | Description |
---|---|---|
stateWithLanguageQuestion | string | State with a question of which language to speak. If the bot cannot detect the language, it will transition to this state. In this state, you must assign the ISO language code to the If the bot transitions to this state, it sets the value of You can see the code for such a state in the example. |
stateForChangingLanguage | string | State with the intent to change the language. In this state, you must assign the ISO language code to the If the bot transitions to this state, it sets the value of You can see the code for such a state in the example. |