botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[C#] Localization

Open rlilov opened this issue 10 years ago • 3 comments

I am following the documentation Localization section In my Class field is described like this: (AAAA and BBB are for simplicity). [Prompt("AAAA. {?To keep current {} just type: c}")] [Describe("BBBB")] public string UnitNumber;

Bot is developed in English

using rview I generate resx file, add it to the project and set neutral language to English resx file look like this UnitNumber_description;VALUE BBBB UnitNumber_promptDefinition;LIST AAAA. {?To keep current {} just type: c}

when I run the bot, instead of showing Prompt text it will ask "Please enter' BBBB. I have a feeling that it takes Describe string adding in front "Please enter'

I wonder what I am doing wrong as when I run Microsoft.Bot.Sample.AnnotatedSandwichBot it behaves correctly.

rlilov avatar Jun 07 '16 09:06 rlilov

This should work. It sounds like your prompt is coming from the default select one template which is "Please enter {&}". ({&} means fill in from describe.) It is hard to tell what else might be wrong. If you would like me to take a look, put a minimal repro into a GitHub repository and share the link.

chrimc62 avatar Jun 07 '16 19:06 chrimc62

Thanks, I removed [Prompt("AAAA. {?To keep current {} just type: c}")] from field declaration and instead placed it in build chain .Field(nameof(VGMData.UnitNumber),("AAAA. {?To keep current {} just type: c}") regenerated resx and this seems to have fixed the problem

rlilov avatar Jun 08 '16 11:06 rlilov

This should work exactly the same in either case. It also works fine in the AnnotatedSandwichBot--I even tried adding a [Describe] attribute and it worked as expected. The only thing I can think of is that Visual Studio does not always do a great job of copying updated resource assemblies so I wonder if your changes were not getting propagated. Please reopen the issue if you can find some cause or clean repro case.

chrimc62 avatar Jun 08 '16 19:06 chrimc62