The Localization SDK enables you to access and respond to user language preferences without requiring a particular frontend framework.
Getting Started
1. Install the SDK
Install the SDK with your preferred package manager.
2. Import and Initialize the SDK
To use the Localization SDK in your code, import it in any file where you need to use it.
When developing locally, you can use the sandbox configuration to test different language preferences:
The sandbox prop should only be used for local development. Do not use it in production.
3. Getting User Language Preference
You can use the getPreferences() method to retrieve the user’s language preference:
4. Listen to Language Preference Updates
The SDK provides a way to listen to updates to the user’s language preference with the onUpdate() method:
5. Create Translation Files
Store translations in separate files outside of your application logic.
6. Render Localized Content
Display content based on the user’s language preference.
7. Localize API Requests (Optional)
If you are making API requests, you can pass the user’s language preference in the headers.