In a waterfall dialog step, I need a date from the user. The users language is Dutch. I have tried multiple options, but the locale keeps using 'en-en'. Dutch dates like '1 April' and '26 Juni' are not recognized.
My prompt:
this.addDialog(new DateTimePrompt(WHEN_PROMPT, this.datePromptValidator, 'nl-nl'));
I use it like this
const promptOptions = { retryPrompt: 'Hier kan ik geen datum uithalen.' };
return await stepContext.prompt(WHEN_PROMPT, promptOptions);
and the validator
async datePromptValidator(promptContext) {
return promptContext.recognized.succeeded;
}
Would appreciate some help...
This of "defaultLocale" as more of a fall-back if there's no indication what the user's locale is supposed to be.
In the current code, activity.locale
is used first, if it exists:
const locale: string = activity.locale || this.defaultLocale || 'en-us';
This is 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
.
This is the same for other prompts:
If you're running into this when testing, here's how to change locale in a few clients:
Emulator:
WebChat:
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')
);
Teams:
Click your profile, then Settings, then: