Open-Source Wikis

/

Grafana

/

Packages

/

@grafana/i18n

grafana/grafana

@grafana/i18n

i18n wrapper around i18next plus Grafana-specific helpers. Source under packages/grafana-i18n/.

Public API

import { t, Trans, useTranslate } from '@grafana/i18n';

<Trans i18nKey='dashboards.empty'>No dashboards yet</Trans>;
const label = t('common.save', 'Save');

<Trans> is for content rendered inside the React tree; t() is for programmatic strings (titles, error messages, menu items).

Catalog flow

  • Strings live wrapped in <Trans> / t() throughout public/app and packages/.
  • make i18n-extract walks every TS/TSX file with the i18next babel plugin and produces public/locales/<locale>/grafana.json for English (the canonical catalog).
  • Localized catalogs live next to the English one (fr-FR/grafana.json, etc.).
  • The catalog is loaded at runtime via fetch and merged into i18next.

Why a thin wrapper?

  • Provides a single import path for plugins (@grafana/i18n) decoupled from the underlying i18next version.
  • Adds Grafana-specific helpers like formatNumber localizations and pluralization shortcuts.
  • Centralizes the babel plugin config so external plugins can adopt the same extraction story.

See also

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

@grafana/i18n – Grafana wiki | Factory