dchumpitaz
dchumpitaz

Reputation: 71

How can I support other languages using FormFlow?

I built a bot and it's working well, I'm using FormFlow to complete a questionnaire. I need the commands working in Spanish, but it only works in English (help, quit, reset...), except in the emulator.

Using the emulator and changing the Locale to "es" is working: Emulator in Spanish When I type "ayuda", the help is showed. It's ok.

In the Bot profile page, the bot was published in spanish (using "es"): Bot profile in spanish

The bot was published in Skype, Facebook Messenger, Slack and Telegram.

When I use the bot in Android with language in "Estados Unidos - Español" or "España - Español" and type "ayuda" or other command in spanish, the bot answers the input in english with "'Ayuda' is not a [field] option" message, but when the input is "Help" it's working well.

Skype Android in spanish

Is there something I'm missing?

Upvotes: 6

Views: 369

Answers (2)

jcmontx
jcmontx

Reputation: 439

I had the same problem. Fixed it by changing the thread's culture in the form builder:

public static IForm<YourDialogForm> BuildForm()
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("es-AR");
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("es-AR");
        return new FormBuilder<YourDialogForm>()
            //your code
            .Build();
    }

disclaimer: not sure if it's the best place to change the culture

Upvotes: 0

dchumpitaz
dchumpitaz

Reputation: 71

I use ngrok for review the messages exchanged between Emulator and the bot, using the Locale field (with es, es-US, es-PA, es-ES, etc) the messages in spanish is working.

After this, I write a little command in the bot for get the Locale, this field return an empty value ever (with es, en, etc).

Finally, I set the locale in the MessagesController in the Post method.

activity.Locale = "es-US";

The bot is working in spanish like I want.

Is this the best solution?

Upvotes: 1

Related Questions