Since a head unit can support multiple languages, you may want to add support for more than one language to your SDL app. The SDL library allows you to check which language is currently used by the head unit. If desired, the app's name and the app's text-to-speech (TTS) name can be customized to reflect the head unit's current language. If your app name is not part of the current lexicon, you should tell the VR system how a native speaker will pronounce your app name by setting the TTS name using phonemes from either the Microsoft SAPI phoneme set or from the LHPLUS phoneme set.
The initial configuration of the SdlManager requires a default language when setting the Builder. If not set, the SDL library uses American English (EN_US) as the default language. The connection will fail if the head unit does not support the language set in the Builder. The RegisterAppInterface response RPC will return INVALID_DATA as the reason for rejecting the request.
If your app does not support the current head unit language, you should decide on a default language to use in your app. All text should be created using this default language. Unfortunately, your VR commands will probably not work as the VR system will not recognize your users' pronunciation.
After starting the SDLManager you can check the sdlManager.getRegisterAppInterfaceResponse() property for the head unit's language and hmiDisplayLanguage. The language property gives you the current VR system language; hmiDisplayLanguage the current display text language.
Language headUnitLanguage = sdlManager.getRegisterAppInterfaceResponse().getLanguage(); Language headUnitHMILanguage = sdlManager.getRegisterAppInterfaceResponse().getHmiDisplayLanguage();
To customize the app name for the head unit's current language, implement the following steps:
language in the Builder.sdlManagerListener's managerShouldUpdateLifecycle method. If the head unit's language is different from the default language and is a supported language, the method will be called with the head unit's current language. Return a LifecycleConfigurationUpdate with the new appName and/or ttsName.@Override public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language){ String appName; switch (language) { case ES_MX: appName = APP_NAME_ES; break; case FR_CA: appName = APP_NAME_FR; break; default: return null; } return new LifecycleConfigurationUpdate(appName,null,TTSChunkFactory.createSimpleTTSChunks(appName), null); }