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()throughoutpublic/appandpackages/. make i18n-extractwalks every TS/TSX file with the i18next babel plugin and producespublic/locales/<locale>/grafana.jsonfor 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 underlyingi18nextversion. - Adds Grafana-specific helpers like
formatNumberlocalizations and pluralization shortcuts. - Centralizes the babel plugin config so external plugins can adopt the same extraction story.
See also
- How to contribute / patterns — i18n conventions.
- The repo does not accept community-submitted catalog translations directly — see
CONTRIBUTING.mdfor the policy.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.