How to localize Microsoft Bot Application?

China☆狼群 提交于 2019-12-12 05:29:57

问题


I am creating a bot application using Microsoft Bot Framework and want to localize the bot with multiple languages. I have created resource files but I don't know how to proceed with setting the culture. I know about Localizing MVC Web Application but I am not getting how do I do this for the Dialogs in Bot Application.


回答1:


Create a Resources.resx file for your default language. From there you can create another resx for other languages such as Resources.fr.resx for french. Then change the language in your c# app using something like this:

Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr-FR");
Console.WriteLine(Properties.Resources.Hello);

To switch back to default set the culture to anything you haven't accounted for. So if you set culture to "en-EN" it will not find anything because we only have Resources.resx and Resources.fr.resx, so it will return to default (Resources.resx) which could be english, german, or anything else.



来源:https://stackoverflow.com/questions/42856006/how-to-localize-microsoft-bot-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!