Skip to Content

Customization

Translate embed content

Show metric names, chart labels and data values in your viewer's language.

Do this with your agent

embed-appearance

Help me with this Databrain task: Translate embed content. Review my current appearance first. Show the smallest change and keep the other settings in place. Ask before applying changes.

Set two props on <dbn-dashboard> or <dbn-metric>:

PropTypeWhat it does
languagestringThe language key to use, for example fr
translation-dictionaryJSONYour translations, by source text and language key

Steps

  1. Write the dictionary. Each key is text as the embed shows it. Each value maps a language key to the translation.

    {
      "Total Sales": { "en": "Total Sales", "fr": "Ventes totales" },
      "Category": { "en": "Category", "fr": "Catégorie" },
      "No data to show.": { "fr": "Aucune donnée à afficher." }
    }
  2. Add both props to the element.

    <dbn-dashboard
      token="GUEST_TOKEN"
      dashboard-id="DASHBOARD_ID"
      language="fr"
      translation-dictionary='{"Total Sales":{"fr":"Ventes totales"},"Category":{"fr":"Catégorie"}}'
    ></dbn-dashboard>

    In JS, set the dictionary as an object: el.translationDictionary = dictionary.

The embed shows the translated text. To switch language, change language and keep the same dictionary.

Embedded dashboard with the card title Chiffre d affaires par région and the regions Europe, Asie-Pacifique, Amérique latine and Amérique du Nord on the axis
Card titles and the region names come from the dictionary.

What the embed translates

The dictionary applies to the content of each metric:

  • Metric name, description, long description and footnote.
  • Column names and data values in charts, tables and single values.
  • Axis names, series names and legends.
  • Card messages, such as the empty card text and custom-messages.

The dictionary does not change filter labels or the embed’s own buttons and menus.

With the v2 chart engine (ui-version="v2"), only card titles are translated today. Data values on the axes stay as they are in your data.

language is any key you use in the dictionary. Databrain has no fixed list. fr and fr-FR are different keys.

The dictionary changes text only. It does not change number or date formats, or currency. For time zones, use the guest token’s params.timezone.

If something goes wrong

  • Nothing is translated. Set both language and translation-dictionary. The embed ignores the dictionary when either one is missing.
  • Part of a word changes. A key also matches inside longer text. See how translation matching works.

Use a fiscal calendar

calendar-type="ind" makes date presets use a fiscal year from 1 April to 31 March. The default is default, a calendar year.

Next, learn how translation matching works.