I'm building a Flutter app that uses the https://pub.dev/packages/speech_to_text v6.6.2 package for speech-to-text functionality. My app works perfectly with Japanese (ja-JP) voice input on the Android emulator via VS Code. However, when I run the same app on my Google Pixel 8a (same Android 15 version), the speech recognition seems to default to English, even though I have installed all the Japanese language packs on the Pixel. Even when the locale is set to ja_JP on my Pixel, speaking in Japanese results in an English output, and is the same outcome when I try to set it to languages other than Japanese.
- Is this a locale issue at a deeper level than what my mobile settings can change?
- Is it perhaps something I can fix with my build settings, etc.?
- Why is ja_JP supported on the emulator but not on my Pixel?
Here is a snippet of the relevant parts of my code:
// speech_to_text
late SpeechToText _speechToText;
bool _speechEnabled = false;
bool _isMicRecording = false;
String? _voiceMessage = '';
@override
void initState() {
super.initState();
_speechToText = SpeechToText();
_initSpeech();
}
// Initialize SpeechToText
void _initSpeech() async {
_speechEnabled = await _speechToText.initialize();
setState(() {});
}
// Start listening for speech
void _startListening() async {
setState(() {
_isMicRecording = true;
});
await _speechToText.listen(
onResult: _onSpeechResult,
listenFor: Duration(minutes: 1),
pauseFor: Duration(minutes: 1),
listenOptions: SpeechListenOptions(
partialResults: true,
),
localeId: 'ja_JP', // Where I set the locale
);
}
What I've tried:
- Download Japanese language pack on Pixel
- Delete English, set JP as default language
- Tried my app with 2 other android devices, same result
- added ALL permissions I need in AndroidManifest.xml
What I've noticed:
The emulator does not have Japanese installed in its system settings, yet it still recognizes Japanese speech without issues.
Setting the Pixel's language to EN doesn't show ja_JP in its list of locales, but setting the Pixel to JP makes the locale appear. Either way, even though it says its set to ja_JP, the voice input is always English
Any advice helps, thank you!