React Native
š React Native Internationalization for Ditto ID SDK
This guide explains how to programmatically set the language in your React Native app using the Ditto ID SDK. This feature is useful when your app supports dynamic language switching based on user preferences.
š§¾ Overview
Internationalization (i18n) allows users to change the language of your app on the fly. To ensure that the Ditto ID SDK reflects the selected language, the SDK must be informed whenever the app locale changes.
š§ Implementation Steps
1. Import the SDK Client
import RdnaClient from 'react-native-rdna-client';2. Define a Method to Set Locale
const setApplicationLanguage = (locale: string) => {
// Examples of locale values: "es" for Spanish, "fr" for French
RdnaClient.setSDKLanguage(localeCode, 0, reactCallBack)
};3. Usage
Call setApplicationLanguage(locale) whenever the user selects a new language in your app settings or preferences.
š Notes
- The
localevalue should be the standard language code (e.g.,"en","hi","ja"). - This setting applies to all Ditto ID SDK modules: document capture, selfie capture, core, etc.
- The change is applied immediately to all UI components managed by the SDK.
By following these steps, you ensure that Ditto ID SDK synchronizes its interface language with your appās selected locale, enhancing the user experience across different regions.
Updated 2 months ago
