Bot 框架 javascript_nodejs v4:无法在 DateTimePrompt(荷兰语)中使用默认语言环境
Bot framework javascript_nodejs v4: Unable to use Default Locale in DateTimePrompt (Dutch)
在瀑布对话步骤中,我需要用户提供日期。用户语言是荷兰语。我尝试了多种选择,但语言环境一直使用 'en-en'。无法识别“4 月 1 日”和“6 月 26 日”等荷兰语日期。
我的提示:
this.addDialog(new DateTimePrompt(WHEN_PROMPT, this.datePromptValidator, 'nl-nl'));
我是这样用的
const promptOptions = { retryPrompt: 'Hier kan ik geen datum uithalen.' };
return await stepContext.prompt(WHEN_PROMPT, promptOptions);
和验证器
async datePromptValidator(promptContext) {
return promptContext.recognized.succeeded;
}
希望得到一些帮助...
如果没有指示用户的语言环境是什么应该,那么“defaultLocale”更多的是一种后备。
在当前代码中,activity.locale
is used first, if it exists:
const locale: string = activity.locale || this.defaultLocale || 'en-us';
这是what's specified in the param info:
- @param defaultLocale (Optional) locale to use if
TurnContext.activity.locale
is not specified. Defaults to a value of en-us
.
其他提示也一样:
如果您在测试时运行喜欢这个,下面是在一些客户端中更改区域设置的方法:
模拟器:
网络聊天:
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: 'YOUR_DIRECT_LINE_TOKEN'
}),
userID: 'YOUR_USER_ID',
username: 'Web Chat User',
locale: 'en-US', // CHANGE THIS HERE!!
botAvatarInitials: 'WC',
userAvatarInitials: 'WW'
},
document.getElementById('webchat')
);
团队:
点击您的个人资料,然后点击设置,然后:
在瀑布对话步骤中,我需要用户提供日期。用户语言是荷兰语。我尝试了多种选择,但语言环境一直使用 'en-en'。无法识别“4 月 1 日”和“6 月 26 日”等荷兰语日期。
我的提示:
this.addDialog(new DateTimePrompt(WHEN_PROMPT, this.datePromptValidator, 'nl-nl'));
我是这样用的
const promptOptions = { retryPrompt: 'Hier kan ik geen datum uithalen.' };
return await stepContext.prompt(WHEN_PROMPT, promptOptions);
和验证器
async datePromptValidator(promptContext) {
return promptContext.recognized.succeeded;
}
希望得到一些帮助...
如果没有指示用户的语言环境是什么应该,那么“defaultLocale”更多的是一种后备。
在当前代码中,activity.locale
is used first, if it exists:
const locale: string = activity.locale || this.defaultLocale || 'en-us';
这是what's specified in the param info:
- @param defaultLocale (Optional) locale to use if
TurnContext.activity.locale
is not specified. Defaults to a value ofen-us
.
其他提示也一样:
如果您在测试时运行喜欢这个,下面是在一些客户端中更改区域设置的方法:
模拟器:
网络聊天:
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
token: 'YOUR_DIRECT_LINE_TOKEN'
}),
userID: 'YOUR_USER_ID',
username: 'Web Chat User',
locale: 'en-US', // CHANGE THIS HERE!!
botAvatarInitials: 'WC',
userAvatarInitials: 'WW'
},
document.getElementById('webchat')
);
团队:
点击您的个人资料,然后点击设置,然后: