microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

[.NET SDK] Azure Functions Bot won't localize built-in messages/texts #4390

Closed dogfuntom closed 6 years ago

dogfuntom commented 6 years ago

Bot Info

Issue Description

Even if locale is forced explicitly and emulator shows that all incoming and outcoming messages has that locale, the bot still uses English texts ("yes", "I didn't understand. Say something in reply.", etc.) instead of localized texts.

(But if the same is repeated in Azure App Service Bot, then all such texts are localized correctly.)

Code Example

if (activity != null)
{
    activity.Locale = "ru-RU";
    ...
}

Reproduction Steps

  1. Create an Azure Functions Bot from basic template.
  2. (optional) Forcibly set locale as in code example above.
  3. Launch in emulator with needed locale. Observe English texts despite locale is correct in details in both incoming and outcoming messages.
  4. (optional) Observe the same behaviour in all possible environments: Visual Studio + Emulator, Azure + Emulator, and in actual channel (I tried Telegram).

Expected Behavior

Localized texts ("yes" → "да", etc.). Note that unlike Functions Bot, App Service Bot shows localized built-in text in the identical circumstances.

Actual Results

English texts despite locale is correct and supported (e.g. by App Service Bot). image 1

gopal300 commented 6 years ago

Hi JasonSowers, did you find any information about this because i am facing the similar problem.

JasonSowers commented 6 years ago

Sorry for the delay this fell off my radar and I had been out of the country.

In your image, you are using the emulator. If you set the locale in the emulator itself it will show up with the yes/no options in Russian as you need. Are you seeing this in other channels as well?

image

This was simply using this code:

    public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
    {
        PromptDialog.Confirm(context, afterPrompt, "Do you like nachos");
    }

    public async Task afterPrompt(IDialogContext context, IAwaitable<bool> argument)
    {
        bool isCorrect = await argument;
        if (isCorrect)
        {
            await context.PostAsync("some text");
        }
        else
        {
            await context.PostAsync("some text 2");
        }
    }
JasonSowers commented 6 years ago

Going to assume this is resolved now, if you have any other issues please open a new issue.