Bridge Training
Bridge React

i18n Config

Internationalization namespaces, resources, and supported languages for bridge-react primitives.

Import from @workspace/bridge-react/i18n.

Overview

This module provides default translations for all bridge-react primitives components including the rich editor. It exports multi-namespace i18next resources covering 10 languages.

Setup

import { primitivesResources } from '@workspace/bridge-react/i18n';

i18n.init({
  resources: {
    en: { ...primitivesResources.en },
    fr: { ...primitivesResources.fr },
  },
});

Namespaces

The module uses two i18n namespaces:

ConstantValueDescription
PRIMITIVES_NAMESPACE"primitives"Namespace for primitives component translations
RICH_EDITOR_NAMESPACE"rich-editor"Namespace for rich editor translations (re-exported from rich-editor/i18n)
PRIMITIVES_NAMESPACES["primitives", "rich-editor"]Array of both namespaces
import {
  PRIMITIVES_NAMESPACE,
  RICH_EDITOR_NAMESPACE,
  PRIMITIVES_NAMESPACES,
} from '@workspace/bridge-react/i18n';

Supported Languages

import { SUPPORTED_LANGUAGES } from '@workspace/bridge-react/i18n';
import type { SupportedLanguage } from '@workspace/bridge-react/i18n';

// SupportedLanguage = "en" | "fr" | "de" | "es" | "nl" | "pl" | "pt" | "ca" | "gr" | "sv"
// SUPPORTED_LANGUAGES = ["en", "fr", "de", "es", "nl", "pl", "pt", "ca", "gr", "sv"]

primitivesResources

Multi-namespace resources for all supported languages. Each language entry contains both the primitives and rich-editor namespace translations.

import { primitivesResources } from '@workspace/bridge-react/i18n';

// Shape:
// primitivesResources.en = {
//   primitives: { ... },
//   "rich-editor": { ... },
// }

Individual Locale Exports

For direct access to raw translation objects (single namespace, primitives only):

import { en, fr, de, es, nl, pl, pt, ca, gr, sv } from '@workspace/bridge-react/i18n';

Types

PrimitivesTranslations

The shape of the primitives translations object (derived from the English locale file).

import type { PrimitivesTranslations } from '@workspace/bridge-react/i18n';

Rich Editor i18n

The rich editor has its own i18n sub-module with override support. Import from @workspace/bridge-react/rich-editor/i18n:

import {
  richEditorResources,
  getRichEditorResources,
  getRichEditorTranslations,
  RICH_EDITOR_NAMESPACE,
} from '@workspace/bridge-react/rich-editor/i18n';

// With overrides
const resources = getRichEditorResources({
  en: { popover: { submit: 'Confirm' } },
  fr: { popover: { submit: 'Confirmer' } },
});

// Single language with overrides
const translations = getRichEditorTranslations('en', {
  popover: { submit: 'Confirm' },
});

On this page