如何在Bot Builder(C#SDK)中使用RView工具在Form Flow中本地化字符串 [英] How to use RView tool in Bot Builder (C# SDK) to localize strings in Form Flow
问题描述
我需要将FormFlow中的所有字符串和枚举本地化为德语.如何使用RView工具生成资源文件?我已阅读以下内容,但我不明白如何使用它.有人可以通过简单的步骤进行解释
I need to localize all the strings and Enums in FormFlow for the German language. How can I use RView tool to generate resource files? I have read following but I couldn't understand how to use it. Can someone explain in simple steps
https://docs .microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-formflow-localize
推荐答案
我认为这很清楚,但是让我们尝试编写一些步骤:
I think that it's pretty clear, but let's try to write some steps:
- 在您的代码中,寻找用于构建表单的静态方法,用于 示例这一个在 ContosoFlowers 示例中.. li>
- 一旦找到它,然后捕获两件事:名称空间和程序集名称.在 ContosoFlowers 的示例中,它将是
ContosoFlowers.Models
和程序集ContosoFlowers.dll
(在生成项目后,该文件位于bin文件夹中). - 在rview -g {AssemblyName} {Namespace}.{NameOfTheBuildFormMethod}.的身份运行
rview
工具. > ContosoFlowers 示例为rview -g ContosoFlowers.dll ContosoFlowers.Models.BuildOrderForm
- 按照重复说明的配置项目部分中所述的步骤,将生成的
resx
文件添加到您的解决方案中.
- In your code, look for the static method that builds the form, for example this one in the ContosoFlowers example.
- Once you found it, then capture two things: the namespace and the assembly name. In the context of the ContosoFlowers sample the namespace it will be
ContosoFlowers.Models
and the assemblyContosoFlowers.dll
(it's on the bin folder after you build the project). - Run the
rview
tool asrview -g {AssemblyName} {Namespace}.{NameOfTheBuildFormMethod}.
Following the ContosoFlowers sample it will berview -g ContosoFlowers.dll ContosoFlowers.Models.BuildOrderForm
- Folllow the steps described in the Configure your project section of the doumentation to add the resulting
resx
file to your solution.
注意:BotBuilder SDK nuget软件包随附了RView工具.如果将NuGet添加到您的项目中,然后再转到packages文件夹,然后再将其添加到Microsoft.Bot.Builder文件夹,则将找到带有
RView.exe
文件的tools文件夹.或者,您可以在 https://上获取该工具的源代码. github.com/Microsoft/BotBuilder/tree/master/CSharp/Tools/RView
Note: The RView tool is included with the BotBuilder SDK nuget package. Once you add the NuGet to your project if you go to packages folder and then to the Microsoft.Bot.Builder folder, you will find a tools folder with the
RView.exe
file. Alternatively, you can get the source code of the tool at https://github.com/Microsoft/BotBuilder/tree/master/CSharp/Tools/RView
注释2 :如果进行更改并想要重新创建resx文件,请不要忘记将中性语言"(后退)更改为(无)",否则rview工具会给出您收到一条错误消息(未处理的异常:System.Reflection.TargetInvocationException:调用的目标已引发异常.---> System.Resources.MissingManifestResourceException:缺少资源System.Collections.Generic.List`1 [System.String ] ...)
Note 2: If you make changes and want to recreate the resx file, do not forget to change the Neutral Language (back) to '(None)', or else the rview tool will give you an error message (Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Resources.MissingManifestResourceException: Missing resources System.Collections.Generic.List`1[System.String] ...)
这篇关于如何在Bot Builder(C#SDK)中使用RView工具在Form Flow中本地化字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!