[英]How to localize Microsoft Bot Application?
I am creating a bot application using Microsoft Bot Framework
and want to localize the bot with multiple languages. 我正在使用
Microsoft Bot Framework
创建bot应用程序,并希望使用多种语言对bot进行本地化。 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
. 我知道有关
Localizing MVC Web Application
但是我没有为Bot Application
的Dialogs
执行此操作。
Create a Resources.resx file for your default language. 为您的默认语言创建一个Resources.resx文件。 From there you can create another resx for other languages such as Resources.fr.resx for french.
在这里,您可以为其他语言创建另一个resx,例如用于法语的Resources.fr.resx。 Then change the language in your c# app using something like this:
然后使用以下方法在c#应用程序中更改语言:
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.
因此,如果将文化设置为“ en-EN”,则将找不到任何内容,因为我们只有Resources.resx和Resources.fr.resx,因此它将返回默认值(Resources.resx),该语言可以是英语,德语或其他任何形式其他。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.