Skip to content

i18n

GolemUI is i18n-aware out of the box. Every visible string in a form definition can be either a plain string or a Localizable:

type Localizable =
| string
| { key: string; default?: string; params?: Record<string, unknown> };

The active translator resolves { key, default } shapes at render time. Plain strings render as-is.

GolemUI ships an i18next adapter; you can also build your own.

import * as AppsShared from '@golemui/apps-shared';
const localization = AppsShared.initializeI18n({
// i18next resource bundles
});

Pass localization to <gui-form>:

<gui-form .formDef=${formDef} .localization=${localization}></gui-form>

Anything that implements the I18nTranslator interface from @golemui/core works. Examples include intlayer, FormatJS, or your own translation function.

  • Widget labels, placeholders, hints (where the prop accepts Localizable).
  • Validator error messages (messages: { required: { key, default } }).
  • Repeater labels, accordion section labels, tab labels.
  • Date and currency formatting honor the active locale.