Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 940 Bytes

README.md

File metadata and controls

26 lines (18 loc) · 940 Bytes

ChooseLanguageBot

Emulator Example

Once the user has chosen a language, the Locale is stored in PrivateConversationData and the activity locale is modified accordingly in the MessagesController before message processing:

if (activity.Type == ActivityTypes.Message)
{
    using (var scope = DialogModule.BeginLifetimeScope(Conversation.Container, activity))
    {
        var botData = scope.Resolve<IBotData>();
        await botData.LoadAsync(CancellationToken.None);
                    
        var lcid = botData.PrivateConversationData.GetValueOrDefault<string>("LCID");
        if (!string.IsNullOrEmpty(lcid))                    
            activity.Locale = lcid;
                    
        await botData.FlushAsync(CancellationToken.None);
    }

    await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
}