Internationalization (i18n) for Forge apps is now available through Forge's Early Access Program (EAP). For details on how to sign up for the EAP, see the changelog announcement.
EAPs are offered to selected users for testing and feedback purposes. APIs and features under EAP are unsupported and subject to change without notice. APIs and features under EAP are not recommended for use in production environments.
For more details, see Forge EAP, Preview, and GA.
With internationalization (i18n), you can make your Forge app available in multiple languages. Once internationalized, your app can translate based on a user’s language. Note that you need to choose the languages you want your app to support and configure the corresponding translation files. For a full list of supported languages and their locale codes, see Forge supported locale codes.
Internationalization can be used by UI Kit apps, including apps using the Frame component, as well as Custom UI apps. The internationalization capability in Forge supports both:
Internationalization does not support UI Kit 1, the legacy version of UI Kit. If you have a UI Kit 1 app that you would like to internationalize, you will first have to upgrade to the latest version of UI Kit.
You must also update to the latest Forge CLI version with i18n support, ^10.6.0
. To do this:
Install the Forge CLI globally by running: npm install -g @forge/cli@^10.6.0
or npm install -g @forge/cli@latest
Verify that the CLI is installed correctly by running: forge --version
Additionally, if you'd like to add internationalization support to your app frontend code using the i18n functions or the useTranslation UI Kit hook, please ensure that you are using the latest version of @forge/bridge
and @forge/react
.
@forge/bridge
package to the project by running: npm install @forge/bridge@latest
@forge/react
package to the project by running: npm install @forge/react@latest
Internationalizing your Forge app involves creating translation files, updating your manifest, and updating your app code. Here's an overview of what is required:
Create translation files: Create JSON files that define translation keys and their corresponding translated strings. You need a translation file for each language your app supports. For configuration details, see Translation files.
Configure your manifest: Configure your app’s manifest.yml
file to specify the path to the translation files. Additionally, you must define the fallback configurations for your app in the manifest. For more information, see Translations.
Add translatable keys to the module properties: Use translation resources to configure translatable module properties in the manifest.yml
file. For guidance, see Translatable module properties.
Add internationalization support to your app frontend code using APIs and UI hooks: To make UI elements in your app's frontend code translatable, add translation resources to your app's code. You can use the Forge internationalization hooks and APIs to translate this content based on a user’s locale. For UI Kit apps, we recommend using the useTranslation UI Kit hook. Both UI Kit and Custom UI apps can use the i18n function.
Translation fallback is essential to guarantee that users can still access meaningful content in cases where translations for their preferred locale are unavailable. It ensures a consistent and user-friendly experience, stepping in when the desired locale is not supported, translations are incomplete, or only partial translations are available.
There are two fallback configurations available when internationalizing your Forge app:
Default fallback (required): Your app must have an overall default fallback locale. This locale will be used if the user’s locale is not found in your configured translation files. The translation file for the default fallback locale must contain all translation keys used in your app.
Locale-specific fallback configurations (optional): You also have the option to add fallback configurations specific to given target locales. For example, if English (US)
is your default fallback and the user’s locale is Portuguese (Brazil)
, you might prefer Portuguese (Portugal)
as a fallback instead of English (US)
. In this case, you could configure English (US)
as the overall default fallback and Portuguese (Portugal)
as the fallback for the target locale Portuguese (Brazil)
.
For more information on configuring translation fallbacks in the manifest, see Fallback configuration.
Tutorial: Create a question generator app using internationalization
Follow a step-by-step tutorial to see how we created a question generator app that uses internationalization and UI Kit.
For the EAP release, internationalization support can be added to the following modules:
Internationalization for Forge is backwards compatible with internationalized Connect apps. This means you can seamlessly transition your existing translation keys and translation files from Connect to Forge, maintaining the language support of your app.
For more information, see Moving internationalized Connect apps to Forge.
Rate this page: