-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Button Text / User Input Choices in Prompt Translation/Localization not possible #9342
Comments
@saskialorraine - Taking a look at this to see if there are any workable solutions. I'll reach out to you when I know more. |
@saskialorraine In en-us.lg file :
In ko-kr.lg file :
Then create a response with text that refers to the template you created :
The same goes for attachments. Instead of text in the template function you would instead write json for an adaptive card like this (in your case your card would have a button rather than what I have below), and like above with text, you would change the text of your buttons depending on your locale :
|
@stevkan Thanks, that would be great! @johnkm516 Thanks for your answer! Did I understand that correctly though, that your solution would be to not use the prompts from BFC itself but exchange all of my questions with Adaptive Cards and read out those inputs? That might be a solution indeed... but absolutely not a handy nor scalable one. |
I am not sure what you mean by not scalable.
then in your LG template, use a foreach loop and join the templates together with a comma delimiter.
In your case you would create a template that has JSON for a button, and use the foreach loop and join to dynamically populate the buttons depending on how many buttons you want. Templating is far more flexible and scalable than the base prompts on BFC. You would create a template such as the example above once, and then pass in data that dynamically populates your card. This includes all the capabilities of adaptive cards, such as video media, images, etc. You can see all the pre-built functions that you can call in LG templates here : |
hello @johnkm516 thanks a lot for your detailed answers! It is very much appreciated! I do see the advantages of the templating and adaptive cards, but the main issue is that we've already built a huge Bot Project with the BFC prompts and it would just mean a lot of work to replace those.. And in my opinion it is just a huge flaw if not a sort of bug that the buttons can just not easily be placed in the lg files for an easy translation or a different solution for Button translation |
@saskialorraine I think the BFC prompts are the way they are currently because it was created before multi-locale support was even a thing. Furthermore BFC prompts use a custom choice recognizer to detect user responses on top of having the input buttons, it's not just a simple card dialog. This has put the developers in a precarious position because the design for locale support was meant to be done via the addition of LG files for each different locale, yet legacy actions such as prompts hardcode text in dialog files rather than generating an LG template like it's automatically done in Send Response. For a better understanding of how the locale support works, I suggest you look over Microsoft.Bot.Builder.Dialogs.Adaptive.Actions.SendActivity.cs, which now serves as the base for basically every bot generated response for multi-lingual bots as multi-lingual bots reference LG files for templating different responses per locale. Here's the thing : even if BFC prompts are modified for multi-lingual support, it's going to reference LG files. That's the design direction of multi-lingual support. That means all the BFC prompts that's currently hardcoded in dialog files that you have currently has to be migrated over to LG files anyways. It's also difficult for MS to update BFC prompts because like you, many older chatbots use it and updating BFC prompts might break older chatbots. It's kind of a rock and a hard place type of situation IMO. MS might update BFC prompts and simultaneously change Composer or release a script to parse the dialog files and automatically update BFC prompts into the new updated prompt and migrate the prompts to LG files, but I'm not sure if this would be a priority or be released in due time. It would be faster if you coded your own parser to do the migration for you. Since dialog files are in JSON form it shouldn't be too difficult to code a program that finds and replaces ChoiceInput activities with SendActivity and append the appropriate LG files with the input in the dialog file. Edit : To add, while I originally thought BFC prompts didn't currently support multi-lingual bots properly, you can simply reference the LG template in the dialog file instead. I was confused because currently BFC throws a warning when templating. But I found that this was a bug and there is currently a pull request that fixes it : |
Hello together. @johnkm516 Again: Thanks for your answer, very interesting and insightful. We kinda figured it out/found a solution that we will probably use. BUT still it would just be very much appreciated and frankly easier and less time consuming if the Button texts would automatically appear as templates in the LG files instead of appearing in the dialog file. |
@johnkm516 - Thank you for your insight and help on this issue. Your thoughts are on point and much appreciated! @saskialorraine - I'm glad you were able to find a workable solution. I marked this as a feature request for future consideration. Of course, there is no ETA at this point on when this might be addressed. |
@saskialorraine How did you get it to work? No matter how I write template variables into the choices array, they get printed as strings... |
@alitilitex Could you provide a few screenshots? :) I worked with Composer quite a long time ago, so I would need some more information. My first guess would be that you maybe didn't use a "=" before writing the variables in the choices. But if you create the template names according to my screenshot it should work. |
Hello there,
Currently the responses/texts are being stored in the bots lg files, which is fine and works great with translation.
Unfortunately, the texts which the buttons contain are stored in the dialog files.
For translation, the LG Files are being duplicated and named accordingly (e.g. de-de, en-us).
BUT for the dialog files that is not possible.
There is only one dialog file.
My question: is there a way to either have the button/input choices text in the lg files and then referring to the dialog file with e.g. a template, or is there another scalable and practical way to translate the button texts?
Greetings and thanks in advance.
The text was updated successfully, but these errors were encountered: