Skip to main content

Language-Service

📘 Developer Guide

With the Flyze Language Service, you are able to easily provide translation to your dashboards/bricks, based on the current language of the App.


🫥 Runtime Properties

Key Label Description
activeLanguage$ Get the current language code via subscription on the RXJS-Observable Describes the current active language code
e.g. de

⌨️ Programmatical Data

How to react to language changes

For this example, we are changing the content of an HTML-Brick, based on the current active language. We are setting up a init script on the HTML-Brick like the following:

// 🌐 Define a translation map
const I18N = {
    de: {
        "NO_CONTENT": "Kein Inhalt"
    },
    en: {
        "NO_CONTENT": "No content"
    }
}

// 💱 Subscribe to the activeLanguage$-Observable and update the HTML-Brick code config
fyzPlatform.language.activeLanguage$.pipe(fyzDashboard.takeUntil()).subscribe((code) => fyzBrick.cRef.mergeConfig({ code: `${I18N[code].NO_CONTENT}` }));