Configure Localization
Display text in the user’s preferred language.
Our microapp is looking great. But it’s optimized for English users. Let’s make it so that the text appears in the user’s preferred language. This will enable more people to use our microapp.
Microapp currently supports the following languages:
- English
- Spanish
- Portuguese (Brazilian)
Implementing Localization
To implement localization in your microapp, you can follow our localization guides based on your framework of choice:
- React Localization Guide - For React, Next.js, and similar frameworks
- TypeScript Localization Guide - For other frameworks or vanilla JavaScript/TypeScript
Below is a general example of how you might implement localization in a React-based application:
1. Install the Microapp SDK
First, install the Microapp SDK for your framework:
2. Create a Translations Object
Create a translations object that contains text in different languages:
3. Use the Translations in Your UI
For React applications, you can use the useLang
hook to access the user’s language preference:
For other frameworks, refer to our TypeScript Localization Guide for implementation details.
Testing Localization
To test your localization implementation, you can:
- Use browser developer tools to change your language settings
- Use the Microapp testing tools to simulate different language preferences
- Test your application with users who speak different languages
Great work! Your microapp is now localized. Next, let’s distribute it.
Now that you have a basic understanding of localization for your microapp, we encourage you to explore our comprehensive Localization documentation for more detailed guidance.