Ashwin Kumar
Ashwin Kumar

Reputation: 1248

How to verify if localization is working correctly in Bot framework

I have used RView and MAT tools to create resource files for french language as described in https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-formflow-localize to localize the form flow. How can I verify if the localization is working correctly. Basically I need a way to test the form flow in my emulator in French language. What's the best/right way to set the CurrentUICulture or to test this out?

Upvotes: 1

Views: 1014

Answers (2)

Pieter Heemeryck
Pieter Heemeryck

Reputation: 683

If you want your locale set to e.g. French all the time (i.e. for the entire conversation), you can set the locale in the activity in MessagesController.cs before calling the dialog, like so:

activity.Locale ="fr";
await Conversation.SendAsync(activity, () => new RootDialog());

It is mentioned in the documentation that activity.Locale overrides the culture of the thread in which the dialogs are used. Because of this, you would have a hard time setting the culture yourself manually in the dialogs.

Upvotes: 2

Grace Feng
Grace Feng

Reputation: 16652

You can set locale in bot emulator like this:

enter image description here

Then the point problem is that whether Bot SDK can get locale info from client channels and automatically set culture info based on that. I couldn't find any official documents that can point out this problem, we can only run test on that.

If the bot can't get locale from client side, there're two workarounds to solve this issue.

  1. To prompt user, show dialog to let user choose preferred language, and then we can save user's choice for example in a table of azure storage.

  2. Use Text Analytics API to automatically detect the user's language based upon user's input.

Upvotes: 2

Related Questions