Set locale
setLocale(locale: Locale) updates the language/region (Locale) used for speech synthesis.
Set locale before synthesis
Call setLocale() before sending a synthesis request to set the synthesis language/region first.
- The locale configured before
speak()is used as the baseline for that synthesis request. - The locale set by
setLocale()is used as the language/region baseline for the next speech synthesis 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
textToSpeech.setLocale(Locale.KOREA)
import java.util.Locale;
textToSpeech.setLocale(Locale.KOREA);