Set locale
setLocale(locale: Locale) updates the language/region (Locale) used for speech recognition.
Set locale before recognition
Call setLocale() before starting speech recognition to set the recognition language/region first.
- The locale configured before
request()is used as the baseline for that recognition session. - The locale set by
setLocale()is used as the language/region baseline for the next recognition request.
Supported locales
The supported locales are as follows.
ko-KR: Koreanen-US: Englishfr-CA: Frenches-US,es-MX: Spanish
Default behavior when setLocale() is not called
If setLocale() is not called, the SDK first checks whether the same app has a locale previously set via setLocale().
- If a previous value exists, the SDK uses that locale.
- If no previous value exists, the SDK uses the system locale.
Example
- Kotlin
- Java
import java.util.Locale
speechToText.setLocale(Locale.KOREA)
import java.util.Locale;
speechToText.setLocale(Locale.KOREA);