microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
878 stars 484 forks source link

Choice options separator should be multi language #5766

Closed Clooney24 closed 2 years ago

Clooney24 commented 3 years ago

Describe the bug

I run a multi language composer bot but in User Input control, I only can set a single language text for inline separators.

Version

Version: 1.4.1 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

To Reproduce

Steps to reproduce the behavior:

  1. Run a multi language bot
  2. Create a user input
  3. try to use multi language separators in choice options

Expected behavior

use expression to fetch language specific text from lg-templates

Screenshots

image

dmvtech commented 3 years ago

Hi @Clooney24

I assume you are using simple choices or structured choices, correct?

Clooney24 commented 3 years ago

@dmvtech yes in that case it was a confirm input. The text of the options are in correct language but the seperator not. English output it is correct "(1) Yes or (2) No" and in German output is "(1) Ja or (2) Nein" but should be "(1) Ja oder (2) Nein".

dmvtech commented 3 years ago

Hi @Clooney24 Thanks for your patience. There is a limitation in this situation. Unfortunately using an expression to a template such as ${OrSeparator()} (where that template has the appropriate word set for the locale in each .lg) didn't work. (I believe because as it's not a response it itself; it wouldn't go through that path).

The end goal should be able to be done with a non-trivial expression. I'm working on getting an example for you.

dmvtech commented 3 years ago

Hi @Clooney24

It is partially more trivial than I thought.

For choices, you can of course use something like:

German

# FoodChoices()
- ["Obst", "Brot"]

English

# FoodChoices()
- ["Bread","Fruit"]

But for the or separator, I have found that if using an expression, even an empty one, that it does the translation automatically. I have no idea why or how, this is being done, but it is the case.

The bad part there, is that Composer won't like to 'keep' an empty expression. I have noticed it rolling back to object type for choice options (with English options) instead of expression (when the field is left empty).

image image

But that can be easily remedied by using an expression for choice options, to a dummy template: =${OrSeparator()}

# OrSeparator()
- Some bogus text here

Conversely, I tried setting actual templates to be used, and that did not work (but still did automatic translation of choice options. No different than a dummy template):

German

# OrSeparator()
- [", "," oder2 ",", oder2 ",true]

English

# OrSeparator()
- [", "," or2 ",", or2 ",true]

I'll look into this latter issue, but please test with the 'dummy' template and see if that works at all for you.

boydc2014 commented 3 years ago

@Clooney24, @dmvtech i confirmed that LG subsystem isn't wired up to choiceOptions yet.

So, we can't support using LG for multi-lang at this moment, what we have now is a few default hard-coded separators defined in here https://github.com/microsoft/botbuilder-dotnet/blob/f1a16c0e215b2815f24752b1c0d7d654cfcc1274/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Input/ChoiceInput.cs#L45.

cwhitten commented 3 years ago

Moving to botbuilder-dotnet

cwhitten commented 3 years ago

Teeing up for R15

ceciliaavila commented 2 years ago

Hi @tracyboehrer, we forgot to assign this issue to us, but here you have the PR that fixes it: #6366