2

I'm currently tying to make a formflow in C# using bot framework, here's my code so far:

[Serializable]
[Template(TemplateUsage.EnumSelectOne, "Selecciona un estadio: {||}", ChoiceStyle = ChoiceStyleOptions.PerLine)]
public class StadiumInfoForm
{
    [Prompt("Selecciona un estadio: ", ChoiceFormat = "{1}")]
    public StadiumOptions? estadio;
    public static IForm<StadiumInfoForm> BuildForm()
    {
        var form = new FormBuilder<StadiumInfoForm>()
                .Message($"¿De qué estadio te gustaría saber?")
                .AddRemainingFields();
        PromptAttribute title = new PromptAttribute();
        List<string> quitCommands = new List<string>();
        quitCommands.Add("Salir");
        quitCommands.Add("Cancelar");
        quitCommands.Add("No");
        quitCommands.Add("Quiero salir");
        quitCommands.Add("Nada");
        form.Configuration.Commands[FormCommand.Quit].Terms = quitCommands.ToArray();
        return form.Build();
    }
}

As you can see the form will be in spanish, the problem is that the prompt displayed at the top of the form always reads "Please select an estadio", I tried changing it following this documentation but to no avail, how can I change this attribute of the form to display something like "Seleccione un estadio por favor"

I'll upload more code if needed.

Community
  • 1
  • 1
IvanHid
  • 669
  • 7
  • 25
  • `the problem is that the prompt displayed at the top of the form always reads "Please select an estadio"` Does issue appear when you test your bot with emulator? – Fei Han Jun 18 '18 at 06:28

1 Answers1

1

Maybe the template of the class "confusing" the FormFlow?

[Serializable]
[Template(TemplateUsage.NavigationFormat, "{&}")]
public class StadiumInfoForm
{
    [Prompt("Seleccione un estadio por favor{||}", ChoiceFormat = "{1}")]
    public StadiumOptions? estadio;

{&} is a pattern language

With only these changes it works for me

enter image description here

P.S. If you want to change the language of the entire FormFlow you can add activity.Locale = "es-ES"; in the Post method of your "MessagesController"

Elelio
  • 287
  • 5
  • 18