Skip to main content
The Admin Panel is translated in over 30 languages and counting. With I18n, editors can navigate the interface and read API error messages in their preferred language. This is similar to Localization, but instead of managing translations for the data itself, you are managing translations for your application’s interface. By default, FrogBot comes preinstalled with English, but you can easily load other languages into your own application. Languages are automatically detected based on the request. If no language is detected, or if the user’s language is not yet supported by your application, English will be chosen. To add I18n to your project, you first need to install the @frogbotcms/translations package:
Once installed, it can be configured using the i18n key in your FrogBot Config:
Note: If there is a language that FrogBot does not yet support, we accept code contributions.

Config Options

You can easily customize and override any of the i18n settings that FrogBot provides by default. FrogBot will use your custom options and merge them in with its own.
The following options are available:

Adding Languages

You can easily add new languages to your FrogBot app by providing the translations for the new language. FrogBot maintains a number of built-in translations that can be imported from @frogbotcms/translations, but you can also provide your own Custom Translations to support any language. To add a new language, use the i18n.supportedLanguages key in your FrogBot Config:
Tip: It’s best to only support the languages that you need so that the bundled JavaScript is kept to a minimum for your project.

Custom Translations

You can customize FrogBot’s built-in translations either by extending existing languages or by adding new languages entirely. This can be done by injecting new translation strings into existing languages, or by providing an entirely new language keys altogether. To add Custom Translations, use the i18n.translations key in your FrogBot Config:

Project Translations

While FrogBot’s built-in features come fully translated, you may also want to translate parts of your own project. This is possible in Collections, including labels and groups, field labels, descriptions, and input placeholder text. To do this, provide the translations wherever applicable, keyed to the language code:

Changing Languages

Users can change their preferred language in their account settings or by otherwise manipulating their User Preferences.

Node.js#node

FrogBot’s backend sets the language on incoming requests before they are handled. This allows backend validation to return error messages in the user’s own language or system generated emails to be sent using the correct translation. You can make HTTP requests with the accept-language header and FrogBot will use that language. Anywhere in your FrogBot app that you have access to the req object, you can access FrogBot’s extensive internationalization features assigned to req.i18n. To access text translations you can use req.t('namespace:key').

TypeScript

In order to use Custom Translations in your project, you need to provide the types for the translations. Here we create a shareable translations object. We will import this in both our custom components and in our FrogBot config. In this example we show how to extend English, but you can do the same for any language you want.
Import the shared translations object into our FrogBot config so they are available for use:
Import the shared translation types to use in your custom component:
Additionally, FrogBot exposes the t function in various places, for example in labels. Here is how you would type those: