The React SDK enables you to use hooks to retrieve the user’s preferences.
Getting Started
1. Install the SDK
Install the SDK with your preferred package manager.
2. Wrap Your App with the Provider
Wrap your application with the UserPreferencesProvider component.
For development, you can use the sandbox mode to test different language preferences:
The sandbox prop should only be used for local development. Do not use it in production.
3. Access Language Preferences
Use the useUserPreferences hook to access the user’s language preference.
The language preference is controlled by the user through the Microapp platform. Your application should respect this preference and adapt accordingly.
4. Create Translation Files
Store your translations in a separate file to keep them organized and maintainable.
5. Render Localized Content
Use the language preference to display content in the appropriate language.
6. Localize API Requests (Optional)
When fetching data from an API, you can include the user’s language preference in the request headers.