Native Android
š Native Android Internationalization for REL-ID IDV SDK
This guide provides steps to programmatically change the SDK language in a Native Android app using the REL-ID IDV SDK, based on Section 11.5.2 of the integration guide.
š§¾ Overview
Internationalization allows users to select their preferred language within the app. To reflect this change in all REL-ID SDK components, you must store the selected locale in the appās shared preferences so that the SDK can adapt accordingly.
š§ Implementation
Use the following code snippets to store the locale when the user changes the app language.
š± Java
public void setLocale(Context context, String locale){
// Example locale: "es" for Spanish, "fr" for French
SharedPreferences sharedpreferences = context.getSharedPreferences("customAppConfig", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString("appLanguage", locale);
editor.commit();
}š± Kotlin
fun setLocale(context: Context, locale: String) {
// Example locale: "es" for Spanish, "fr" for French
val sharedpreferences = context.getSharedPreferences("customAppConfig", Context.MODE_PRIVATE)
val editor = sharedpreferences.edit()
editor.putString("appLanguage", locale)
editor.commit()
}š§ Notes
- The locale string should be in the ISO 639-1 format (e.g.,
"en","hi","de"). - The key
"appLanguage"is used by the SDK to read the preferred language. - This setting should be updated as soon as the user switches language preferences in the app.
By saving the selected locale this way, the REL-ID SDK will dynamically adapt its UI and messages to the userās language preference, enabling full internationalization support.
Updated 9 months ago
