Skip to content

I18N

The Dashjoin platform uses English as its default language. You can activate other languages and also support allowing users to choose a language. Note that only the non-developer pages are internationalized. Developer pages, such as the function catalog or the query editor, support English only.

Setting the Locale

The Internationalization (I18N) settings are defined in the file /assets/logincfg.json. This is also the place where you configure OpenID providers. Please refer to the administration section for more information on how to provide this file.

The default locale defines which language is used by the platform initially. It can be set to an ISO 639 two-letter code. To choose german, for instance, use the following setting:

    "defaultLocale": "de"

Using the Browser Locale

Browsers transmit the user's preferred locale to the web server using the accept-language header. If you would like to set the default locale to this value, set the default locale to browser:

    "defaultLocale": "browser"

In case no translations are available for the browser's locale, the system defaults to English.

Allowing Users to Switch Locales

If your users speak different languages, you can specify a set of languages to be supported by the system using the locales array. To setup german and english, use the following key in the logincfg.json file:

    "locales": ["en", "de"]

Minimally, this array must contain the default language. If two or more languages are specified, the user interface shows a language picker on both the login screen and the toolbar.

Providing Translations

If you choose to accept the browser's locale or if you allow users to change the locale, your widgets should support different languages as well. Consider the following simple text widget:

{
    "widget": "text",
    "text": "Hello World"
}

The simples approach is to define the internationalized texts in the system configuration (/config/dj-config). There is an I18N category. If we translate the text to German, we change the "de" system setting to:

{
    "ID": "de",
    "category": "i18n",
    "map": {
        "Hello World": "Hallo Welt"
    }
}

In this case, the I18N key happens to be the English version of the text. This is ok for short, static texts. If texts are longer or likely to change over time, you should pick a generic key:

{
    "widget": "text",
    "text": "my.app.helloworld"
}

The translations are provided as follows. Note that the dot can be used to group messages. For more information about this I18N format, visit the Polyglot JS site.

{
    "ID": "de",
    "category": "i18n",
    "map": {
        "my": {
            "app": {
                "helloworld": "Hallo Welt"
            }
        }
    }
}

Translating Tablenames, Columnnames, and Forms

The same principle is also applied to table names, column names, and the labels in forms. If you would like to translate EMPLOYEE_ID to MITARBEITER_ID, use this line in the de.json config file:

    "EMPLOYEE_ID": "MITARBEITER_ID",

The login screen and the cookie banner are internationalized via the loginfgc.json file, since initially, there are no credentials available to access the platform's config database.

The following keys are defines:

"i18n": {
    "en": {
        "legal": "...",
        "legalButtonText": "I understand",
        "newUser": "New User",
        "enterEmailAndPwd": "Enter your E-Mail and initial password",
        "receiveActivation": "You will receive an activation link",
        "email": "E-Mail",
        "createAccount": "Create Account",
        "resetPassword": "Reset Password",
        "enterEmail": "Enter your E-Mail",
        "receiveReset": "Password reset instructions will be sent",
        "guest": "Login as Guest"
    }

To change a key, e.g. the legal disclaimer, add these lines to your logincfg.json:

"i18n": {
    "en": {
        "legal": "My legal disclaimer",
    }

To add a new language, use:

"i18n": {
    "cn": {
        provide all keys with translations
    }

Supported Languages

The language support of the platform is comprised of Dashjoin texts as well as the texts of the underlying react admin framework. Dashjoin provides English and German, and bundles react admin languages en, de, fr, it, and es.

I18N in Expressions

The current locale is exposed via the "locale" field in the expression context. In addition, you can access the language bundles via the translate function:

$translate('ra.action.search')

This command returns Search for the English locale, Suche for German and so on.