如何为BotFramework节点bot设置本地化? [英] How to set up localization for BotFramework node bot?
问题描述
我需要一种通过机器人命令切换语言的方法,即传递某种语言ID,例如"en"或"fr",以供框架(ILocalizer)本地化程序使用.问题是我找不到如何告诉框架在会话中应使用哪种语言的问题.还是用户.或讯息.
I need a way to switch languages via bot commands, that is to pass somewhere language id like 'en' or 'fr' for the framework (ILocalizer)localizer to use. The problem is I can't find how do I tell the framework what language it should use for the session. Or user. Or message.
最初,我认为应该有诸如session.setLanguage/Locale之类的东西-那里没有.我想念什么?
Originally I thought there should be something like session.setLanguage/Locale - there's not. What am I missing?
到目前为止,我唯一发现的是setLanguage,它是建议使用local()代替".但是没有local()定义( https://docs.botframework .com/zh-CN/node/builder/chat-reference/classes/_botbuilder_d_.message.html#setlanguage ).
The only thing I've found so far is setLanguage, which is "DEPRECATED use local() instead.". BUT there's no local() definition ( https://docs.botframework.com/en-us/node/builder/chat-reference/classes/_botbuilder_d_.message.html#setlanguage).
推荐答案
浏览BotBuilder Git存储库中的示例,我看到有一个本地化示例
Going through the examples in the BotBuilder Git repository, I see there is a localization example
链接: https://github.com/Microsoft/BotBuilder/tree/master/Node/examples/basics-localization
请查看这是否是您需要的.
Please see if this is what you need.
这篇关于如何为BotFramework节点bot设置本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!