🛠️
Developer docs
Start BuildingGuides
  • ✨Getting Started
  • 🎛️Self Hosted Config
  • ✍️SSO Login
    • Saml Identity Provider (Idp)
    • Oidc Identity Provider (Idp)
  • 🎞️Framework Specific Guide
    • ⚛️Reactjs
    • ⚛️Nextjs
    • ⚛️Vuejs
    • ⚛️Angular
    • ⚛️Svelte
    • ⚛️Solid
    • ⚛️Vanilla JS
  • ℹ️Token
  • ℹ️How to embed?
  • 🏛️Multi-Tenant Access Control
  • Embed using iFrame (Not Recommended approach)
  • 🔑License Key Validation for Self-Hosted App
  • Test
  • 👩‍💻Helpers
    • ✳️Token Body
    • ✅Options
      • Custom Fiscal Year filter setup in DataBrain
    • 🈂️Server Event
    • Embed Functions
    • Override Language
    • ✈️Embedding Architecture
    • ✈️LLM Architecture
    • ✨LLM Connectors
      • Open AI
      • Claude AI
      • Azure Open AI
      • Llama
      • Mixtral
    • 🆔Workspace Name
    • 🆔Dashboard ID
    • 🆔Metric ID
    • 🆔API Token
    • 🆔End User Metric Creation
    • Embedding APIs
      • Sync Datasource
  • Metric App Filter
  • Dashboard App Filter
  • Chat Mode
    • Step 1: Create Datamart and Workspace
    • Step 2: Create Data App and Embed ID
  • ✨Solutions Alchemy
    • Dashboards for Client Groups
    • Dashboard for Multiple Clients
    • Embedding: Role based Dashboard Filtering
    • Localized Currency Symbols
    • Manage Metrics
Powered by GitBook
On this page
  • Overview
  • Usage Example
  • Fallback Mechanism
  1. Helpers

Override Language

The @databrainhq/plugin package allows you to customize the language of your embedded components by passing a translation dictionary and specifying the desired language.

Overview

Parameters:

  • translation-dictionary: A JSON object that maps keys (e.g., metric names, description, table columns, chart legends & label...etc) to their translations in multiple languages.

  • language: A string representing the language code (e.g., "en", "fr", "es") you want to use for the component's content.

When both parameters are used, the component will display the content in the specified language, falling back to the key if a translation for the selected language is unavailable.

Usage Example

<dbn-metric
  token={guest-token}
  metric-id={metricId}
  translation-dictionary={JSON.stringify({
    'total sales': {
      en: 'total sales',
      fr: 'ventes totales',
      es: 'ventas totales',
      de: 'Gesamtumsatz',
      it: 'vendite totali',
      pt: 'vendas totais',
      zh: '总销售额',
      ja: '総売上',
      ko: '총 매출',
      hi: 'कुल बिक्री',
      ar: 'إجمالي المبيعات',
      ru: 'общие продажи',
    },
  })}
  language="fr"
/>
<dbn-dashboard
  token="guest-token"
  dashboard-id="dashboardId"
  translation-dictionary={JSON.stringify({
    'total sales': {
      en: 'total sales',
      fr: 'ventes totales',
      es: 'ventas totales',
      de: 'Gesamtumsatz',
      it: 'vendite totali',
      pt: 'vendas totais',
      zh: '总销售额',
      ja: '総売上',
      ko: '총 매출',
      hi: 'कुल बिक्री',
      ar: 'إجمالي المبيعات',
      ru: 'общие продажи',
    },
  })}
  language="fr"
/>

In this example, the label "total sales" will be displayed in French as "ventes totales."

Fallback Mechanism

  • If the language prop is set to a language code not available in the dictionary, the component will display the default key value (e.g., "total sales").

  • Ensure all required keys and translations are included in your dictionary to provide a seamless user experience.

PreviousEmbed FunctionsNextEmbedding Architecture

Last updated 3 months ago

👩‍💻