Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Support i18n via 'text' functions #1747

Merged
merged 3 commits into from
Oct 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/botkit/src/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,11 @@ export class BotkitConversation<O extends object = {}> extends Dialog<O> {
let outgoing;
let text = '';

// If text is a function, call the function to get the actual text value.
if (typeof line.text === 'function') {
text = await line.text(vars);
}

// if the text is just a string, use it.
// otherwise, if it is an array, pick a random element
if (line.text && typeof(line.text)=='string') {
Expand Down