csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
348 stars 217 forks source link

error_language_not_supported when offline #486

Closed JanKubesIsBest closed 2 months ago

JanKubesIsBest commented 2 months ago

Hi, first off, thanks for the wonderful project.

I have run into error. Even tho the default language on phone (pixel 4, android 13) is Czech, the speech_to_text stops working when I turnoff internet, with error "error_language_not_supported". Same error occurs when I use pixel 6 pro, android 14, where Czech is second language.

In speech_to_text returns Czech as a locale both on 6pro and 4.

Code:

_speechToText.initialize( finalTimeout: const Duration(seconds: 10), onError: (SpeechRecognitionError error) async { print(error); }, ) ;

await _speechToText.listen(
  onResult: _onSpeechResult,
  localeId: czechLocaleId,
  // I feel like this works better
  listenOptions: SpeechListenOptions(
      cancelOnError: false,
      partialResults: true,
      onDevice: true,
      listenMode: ListenMode.confirmation),
);
muknta commented 2 months ago

the same

muknta commented 2 months ago

@JanKubesIsBest just tried to send localeId to library as en-US, not en_US as it was stored by my phone. And it works.

sowens-csd commented 2 months ago

Have you tried downloading the local language pack for Czech? I don't know if there is one but it's worth checking. I know that on device language support is more limited than online but I'm not sure which languages are supported.

JanKubesIsBest commented 2 months ago

Hi, thanks for replies. I accidentally clicked closed issue, sorry about that.

Both cs_CZ and cs-CZ are not working.

I don't know what do you mean by language pack? I have installed Czech on my Pixel 6 as a system language, is there any other pack I should download?

Thanks for replies.

sowens-csd commented 2 months ago

Here's what you could try, this is from a Pixel 6a. Look in Settings | System | Languages & Input | On-device speech recognition.

There's an Add a Lanuguage option there. I didn't see Czech as an option but your device might be different.

JanKubesIsBest commented 2 months ago

Hi, thanks for the reply.

I don't see the Czech language either, is there any workaround?

sowens-csd commented 2 months ago

Unfortunately not as far as I know. Maybe the Android team will add on-device support at some point but as far as I know they haven't published a schedule.