lele
lele

Reputation: 103

How to convert Korean to text using flutter(dart)?

I am currently developing an application that converts Korean to text using flutter. I've been trying to use the speech_to_text package, but I'm wondering if the only language I can use is English.

Or do you have any other suggestions?

Upvotes: 1

Views: 705

Answers (1)

Ben Butterworth
Ben Butterworth

Reputation: 28710

Have a look at the speech_to_text's Switching Recognition Language documentation:

The speech_to_text plugin uses the default locale for the device for speech recognition by default. However it also supports using any language installed on the device. To find the available languages and select a particular language use these properties.

There's a locales property on the SpeechToText instance that provides the list of locales installed on the device as LocaleName instances. Then the listen method takes an optional localeId named param which would be the localeId property of any of the values returned in locales. A call looks like this:

    var locales = await speech.locales();

    // Some UI or other code to select a locale from the list
    // resulting in an index, selectedLocale

    var selectedLocale = locales[selectedLocale];
    speech.listen(
        onResult: resultListener,
        localeId: selectedLocale.localeId,
        ); ```

If the user has Korean locale installed on their device, you should be able to find it in locales. Why don't you place a breakpoint on var selectedLocale ... or run print(locales).

Upvotes: 1

Related Questions