Localization
Every user-facing string — empty states, aria labels, validation errors, tooltips — lives in a typed message catalog. Nothing is hardcoded: provide a catalog once for the whole application, or override single strings per component instance.
How it works
Each package exports a messages interface (for example OgeGridMessages, OgeInputsMessages). Catalogs are partial — you only supply the strings you change, the rest keep their English defaults. Patterns support {placeholder} interpolation for dynamic values.
The catalogs themselves are shared. Message names, defaults and placeholder syntax live in the framework-free packages, so a translation written once is correct in both render layers. Only the delivery differs: Angular takes a provideOge…Config() provider, React an <Oge…ConfigProvider> — the same object, handed over the way each framework expects.
Ready-made translations
@oge-ui/locales (MIT) translates every catalog of the suite — MIT and commercial families alike — into German, French, Spanish, Italian, Brazilian Portuguese, Turkish, Japanese, Simplified Chinese, Arabic and Hebrew, with each language's plural forms in the count-bearing keys. Each language is its own entry point (@oge-ui/locales/tr), so an app bundles only the pack it imports. A pack is plain data — a typed OgeLocalePack with the locale for Intl formats, the writing dir and one slice per catalog — and every key it does not carry yet stays English. A CI check keeps each pack's keys, placeholders and plurals in step with the English source.
npm install @oge-ui/localesprovideOgeLocale(pack) from oge-ui provides every MIT family's config — grid and tree list, inputs, buttons, overlay, tabs, forms, upload, layout and navigation — with the pack's slice and, where a family formats data, its locale. LOCALE_ID (Angular's own pipes) and the page's dir remain the app's job.
// app.config.ts
import { provideOgeLocale } from 'oge-ui';
import { tr } from '@oge-ui/locales/tr'; // only this language is bundled
export const appConfig: ApplicationConfig = {
providers: [
{ provide: LOCALE_ID, useValue: 'tr' }, // Angular's own pipes — the app's job
provideOgeLocale(tr), // grid + tree list, inputs, buttons, overlay, tabs,
// forms, upload, layout and navigation — strings and locale
],
};
// right-to-left packs (ar, he) carry dir: 'rtl' — set <html dir> from pack.dir An app that ships only some families can apply just their slices — provideOgeGridLocale(), provideOgeInputsLocale() and so on, one per family — so the other families’ catalogs and config never reach its bundle (the one-call form pulls in every family’s English catalog, about 16 kB gzip; a single slice is a fraction of that).
// app.config.ts — an app that uses the grid and the inputs only
import { provideOgeGridLocale, provideOgeInputsLocale } from 'oge-ui';
import { tr } from '@oge-ui/locales/tr';
export const appConfig: ApplicationConfig = {
providers: [provideOgeGridLocale(tr), provideOgeInputsLocale(tr)],
};
// provideOgeLocale(tr) is these slices for every MIT family at oncePick a language: the date box (open its calendar), the select box (search it, clear it) and the grid's filter row, pager and empty texts switch at once; Arabic and Hebrew mirror the layout. Each pack is downloaded the first time it is picked.
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeGrid, OgeColumn } from '@oge-ui/grid';
import { OgeDateBox, OgeSelectBox } from '@oge-ui/inputs';
import { OGE_LOCALE_NAMES, en, ogeLocalePacks } from '@oge-ui/locales';
import { provideOgeLocale } from 'oge-ui';
import type { ApplicationConfig } from '@angular/core';
import type { OgeLocaleCode, OgeLocalePack } from '@oge-ui/locales';
// the app's language state — provideOgeLocale (below) reads it live
const uiPack = signal<OgeLocalePack>(en);
const ORDERS = [
{ id: 1, customer: 'Anadolu Ltd.', placed: new Date(2026, 0, 5), amount: 1234.5 },
{ id: 2, customer: 'Berlin GmbH', placed: new Date(2026, 2, 17), amount: 89.9 },
{ id: 3, customer: 'Paris SARL', placed: new Date(2026, 5, 30), amount: 15600 },
{ id: 4, customer: 'Tokyo KK', placed: new Date(2026, 8, 2), amount: 420 },
];
@Component({
selector: 'demo-root',
imports: [OgeGrid, OgeColumn, OgeDateBox, OgeSelectBox],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div role="group" aria-label="Language">
@for (code of codes; track code) {
<button type="button" [attr.aria-pressed]="pack().locale === code" (click)="pick(code)">
{{ names[code] }}
</button>
}
</div>
<!-- ar and he are right-to-left: components follow the nearest dir -->
<div [attr.dir]="pack().dir" [attr.lang]="pack().locale">
<oge-date-box label="Delivery" [(value)]="day" />
<oge-select-box label="City" [items]="cities" [(value)]="city" [searchEnabled]="true" [showClearButton]="true" />
<oge-grid [data]="orders" keyField="id" [filterRow]="true" [paging]="{ pageSize: 3 }">
<oge-column field="customer" caption="Customer" />
<oge-column field="placed" caption="Placed" dataType="date" />
<oge-column field="amount" caption="Amount" dataType="number" [format]="{ type: 'currency', currency: 'EUR' }" />
</oge-grid>
</div>
`,
})
export class Demo {
readonly codes = Object.keys(OGE_LOCALE_NAMES) as OgeLocaleCode[];
readonly names = OGE_LOCALE_NAMES;
readonly pack = uiPack;
readonly orders = ORDERS;
readonly cities = ['İstanbul', 'Berlin', 'Paris', 'Tokyo', 'Cairo', 'Tel Aviv'];
readonly city = signal<unknown>(null);
readonly day = signal<Date | null>(new Date(2026, 9, 5));
async pick(code: OgeLocaleCode): Promise<void> {
// every language is its own chunk, downloaded on first use
uiPack.set(await ogeLocalePacks[code]());
}
}
// app.config.ts — the live form: the strings follow uiPack
export const appConfig: ApplicationConfig = {
providers: [provideOgeLocale(() => uiPack())],
}; Switch at runtime with the lazy ogeLocalePacks map and the live form (provideOgeLocale(() => pack()); in React, pass a new pack). provideOgeLocale owns the family config tokens it sets, so a family whose other options you also tune is provided after it, with the slice merged in through ogeMergeMessages:
import { signal } from '@angular/core';
import { provideOgeLocale } from 'oge-ui';
import { en, ogeLocalePacks, type OgeLocaleCode, type OgeLocalePack } from '@oge-ui/locales';
export const uiPack = signal<OgeLocalePack>(en);
// each language is its own chunk — only the packs a user picks are downloaded
export async function useLanguage(code: OgeLocaleCode): Promise<void> {
const pack = await ogeLocalePacks[code]();
uiPack.set(pack);
document.documentElement.lang = pack.locale;
document.documentElement.dir = pack.dir;
}
providers: [
// a function: every OGE component re-renders when uiPack changes
provideOgeLocale(() => uiPack()),
// a family whose other options you also set: provide it after, merge yourself
provideOgeGridConfig(() => ({
rowHeight: 32,
locale: uiPack().locale,
messages: ogeMergeMessages(OGE_DEFAULT_GRID_MESSAGES, uiPack().grid),
})),
]The commercial families (pivot, scheduler, Gantt, Kanban, BPMN, charts) are translated in the same packs, but the MIT umbrellas never depend on them — hand their slice to their own provider. The full key-by-key reference is the Localization API.
// The MIT umbrella never depends on the commercial packages, so their slices
// are passed to their own providers — merged over the English catalog, so a
// key a newer release adds stays English instead of going blank:
import { ogeMergeMessages } from '@oge-ui/locales';
import { tr } from '@oge-ui/locales/tr';
import { OGE_DEFAULT_SCHEDULER_MESSAGES, provideOgeSchedulerConfig } from '@oge-ui/scheduler';
import { OGE_DEFAULT_GANTT_MESSAGES, provideOgeGanttConfig } from '@oge-ui/gantt';
providers: [
provideOgeLocale(tr),
provideOgeSchedulerConfig({
locale: tr.locale,
messages: ogeMergeMessages(OGE_DEFAULT_SCHEDULER_MESSAGES, tr.scheduler),
}),
provideOgeGanttConfig({
locale: tr.locale,
messages: ogeMergeMessages(OGE_DEFAULT_GANTT_MESSAGES, tr.gantt),
}),
// pivot: provideOgePivotMessages(ogeMergeMessages(OGE_DEFAULT_PIVOT_MESSAGES, tr.pivot))
// kanban / bpmn / charts / spreadsheet: the same shape with tr.kanban /
// tr.bpmn / tr.charts / tr.spreadsheet
]
// React: <OgeSchedulerConfigProvider config={{ locale: tr.locale,
// messages: ogeMergeMessages(OGE_DEFAULT_SCHEDULER_MESSAGES, tr.scheduler) }}>Global configuration
import { provideOgeGridConfig } from '@oge-ui/grid';
import { provideOgeInputsConfig } from '@oge-ui/inputs';
import { provideOgeButtonsConfig } from '@oge-ui/buttons';
// app.config.ts — a Turkish application
providers: [
provideOgeGridConfig({
messages: {
noData: 'Kayıt bulunamadı',
search: 'Ara…',
pagerInfo: '{count} satır',
summaryLabels: { sum: 'Toplam', avg: 'Ort', min: 'Min', max: 'Maks', count: 'Adet' },
},
}),
provideOgeInputsConfig({
messages: {
requiredError: 'Bu alan zorunludur',
clearButton: 'Temizle',
counterAria: '{max} karakterden {count} tanesi kullanıldı',
},
}),
provideOgeButtonsConfig({
messages: { loading: 'Yükleniyor', holdToConfirm: 'Onaylamak için basılı tutun' },
}),
]Switching language at runtime
Every provideOge…Config() also accepts a function. The config then follows the signals that function reads: flip your language signal and every OGE component re-renders its strings — and, with locale, its number and date formats — without reloading the page or fetching the catalog before bootstrap. A component-level [messages] input still wins over it. In React, pass a new config to the <Oge…ConfigProvider>; context already re-renders.
import { signal } from '@angular/core';
import { provideOgeGridConfig } from '@oge-ui/grid';
import { provideOgeInputsConfig } from '@oge-ui/inputs';
import { GRID_TR, INPUTS_TR } from './i18n/tr';
/** The app's own language state — a cookie, a store, a user setting… */
export const uiLanguage = signal<'en' | 'tr'>('en');
// Pass a function instead of an object: the config becomes live. Every OGE
// component re-renders its strings when a signal the function reads changes —
// no reload, no re-bootstrap. English is the built-in default, so '{}' is enough.
export const appConfig = {
providers: [
provideOgeGridConfig(() => ({
messages: uiLanguage() === 'tr' ? GRID_TR : {},
})),
provideOgeInputsConfig(() => ({
messages: uiLanguage() === 'tr' ? INPUTS_TR : {},
locale: uiLanguage() === 'tr' ? 'tr-TR' : 'en-US', // Intl formats follow too
})),
],
};
// anywhere: uiLanguage.set('tr');Per-component overrides
Components accept the same catalog through a [messages] input. Instance values win over the global provider, which wins over the built-in defaults:
<!-- the [messages] input overrides the global catalog for one instance -->
<oge-grid [data]="rows" [messages]="{ noData: 'No matching orders' }" />
<oge-text-box
label="Coupon code"
[messages]="{ requiredError: 'Enter a coupon to continue' }"
/>Validation messages
Input editors resolve validation errors from the catalog — the same strings serve standalone validation, reactive forms and Signal Forms, so translating them once covers all three binding modes:
// Message patterns interpolate the constraint that failed:
provideOgeInputsConfig({
messages: {
minError: 'Value must be at least {min}',
maxLengthError: 'Enter no more than {requiredLength} characters',
},
})
// Priority when an editor resolves its error text:
// 1. errorText input (always wins when set)
// 2. parse errors (e.g. invalid number)
// 3. form errors (Signal Forms / reactive), mapped through the catalogNumber & date locales
Formatting is separate from message catalogs. Every formatter comes from one shared Intl cache in @oge-ui/core, in the component's locale: the grid, tree list and pivot take a locale input (React: prop) and a global one through their config — provideOgeGridConfig({ locale }), provideOgePivotConfig({ locale }) or the React providers. Unset, Angular uses LOCALE_ID and React navigator.language. Default date cells, declarative column formats, summaries, group captions, header-filter values, the filter row's number parsing, the pager and exported text all follow it. Unformatted number columns stay raw — give them a format for the locale's separators.
Switch the locale: dates, currency, percentages, grouped numbers, the total summary and the plural sentence below re-render. Type 1234,5 into the Amount filter under de-DE or tr-TR — it parses as one thousand two hundred thirty-four and a half.
3 orders
import { ChangeDetectionStrategy, Component, computed, signal } from '@angular/core';
import { OgeGrid, OgeColumn } from '@oge-ui/grid';
import { ogeFormatMessage } from '@oge-ui/core';
import type { OgeValueFormat } from '@oge-ui/core';
interface Order {
id: number;
placed: Date;
amount: number;
share: number;
quantity: number;
}
const ORDERS: Order[] = [
{ id: 1, placed: new Date(2026, 0, 5), amount: 1234.5, share: 0.125, quantity: 12500 },
{ id: 2, placed: new Date(2026, 2, 17), amount: 89.9, share: 0.5, quantity: 3 },
{ id: 3, placed: new Date(2026, 10, 30), amount: 15600, share: 0.375, quantity: 1 },
];
// ICU plural: every language's forms in one key; # is the count in the locale's digits
const ORDERS_TEXT = '{count, plural, =0 {No orders} one {# order} other {# orders}}';
@Component({
selector: 'demo-root',
imports: [OgeGrid, OgeColumn],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<div role="group" aria-label="Locale">
@for (tag of locales; track tag) {
<button type="button" [attr.aria-pressed]="locale() === tag" (click)="locale.set(tag)">
{{ tag }}
</button>
}
</div>
<!-- typed filters parse in the locale too: try 1234,5 in de-DE -->
<oge-grid [data]="orders" keyField="id" [locale]="locale()" [filterRow]="true">
<oge-column field="id" dataType="number" [width]="70" />
<oge-column field="placed" caption="Placed" dataType="date" />
<oge-column field="placed" caption="Placed (medium)" dataType="date" [format]="longDate" [filterable]="false" />
<oge-column field="amount" dataType="number" [format]="money" totalSummary="sum" />
<oge-column field="share" dataType="number" [format]="percent" />
<oge-column field="quantity" dataType="number" [format]="count" />
</oge-grid>
<p>{{ summary() }}</p>
`,
})
export class Demo {
readonly locales = ['en-US', 'de-DE', 'tr-TR', 'ar-EG'];
readonly locale = signal('de-DE');
readonly orders = ORDERS;
// declarative formats render through the shared Intl cache, in the grid's locale
readonly money: OgeValueFormat = { type: 'currency', currency: 'EUR' };
readonly percent: OgeValueFormat = { type: 'percent', minimumFractionDigits: 1 };
readonly count: OgeValueFormat = { type: 'number' };
readonly longDate: OgeValueFormat = { type: 'date', dateStyle: 'medium' };
readonly summary = computed(() =>
ogeFormatMessage(ORDERS_TEXT, { count: this.orders.length }, this.locale()),
);
}Set the locale once for the whole application — live, like messages:
import { signal } from '@angular/core';
import { provideOgeGridConfig } from '@oge-ui/grid';
import { provideOgePivotConfig } from '@oge-ui/pivot';
export const uiLocale = signal('de-DE');
providers: [
// grids and tree lists; a [locale] input on one instance still wins
provideOgeGridConfig(() => ({ locale: uiLocale() })),
provideOgePivotConfig(() => ({ locale: uiLocale() })),
]
// unset everywhere: Angular's LOCALE_ID (React: navigator.language) Editors format and parse through the same cache, honoring an explicit locale input or Angular's LOCALE_ID. Grouped input like 1.234,56 parses correctly in every locale:
<!-- Intl-powered: grouping, decimal separator and currency follow the locale -->
<oge-number-box
label="Price"
locale="de-DE"
[format]="{ style: 'currency', currency: 'EUR' }"
/>
<!-- without an explicit locale, editors use Angular's LOCALE_ID -->Plural messages
Count-bearing catalog keys — the grid's row count, selection and paste announcements and pager text, the validation summary heading, the uploader's file counts, the tag box's overflow chip — are ICU plurals rendered by ogeFormatMessage with Intl.PluralRules. One key holds every plural form of a language (zero one two few many other, plus exact =0 matches); # is the count in the locale's digits. A plain {count} pattern keeps working. The old singular keys (rowCountOneAnnouncement, validationSummaryTitleOne, rowsSuffix) are deprecated: still honoured for one minor, with a dev-mode warning.
provideOgeGridConfig({
messages: {
// Polish has one / few / many — all in one key; # is the count
rowCountAnnouncement:
'{count, plural, one {# wiersz} few {# wiersze} many {# wierszy} other {# wiersza}}',
pagerInfo: '{count, plural, one {# wiersz} few {# wiersze} many {# wierszy} other {# wiersza}}',
},
}),
provideOgeFormsConfig({
messages: {
validationSummaryTitle:
'{count, plural, =1 {Bir alan düzeltilmeli} other {# alan düzeltilmeli}}',
},
}),
// the same formatter is public — use it for your own strings
ogeFormatMessage('{n, plural, one {# plik} few {# pliki} many {# plików} other {# pliku}}', { n: 5 }, 'pl');
// → '5 plików'Behavior defaults
The config providers also centralize timing and interaction defaults, so product-wide tuning does not require touching templates:
// The same providers also carry non-text defaults:
provideOgeButtonsConfig({
clickGuardMs: 300, // default clickGuard window
holdToConfirmMs: 1000, // default hold duration
}),
provideOgeInputsConfig({
spinRepeatDelayMs: 300, // number-box spin: delay before repeating
spinRepeatIntervalMs: 60,
copiedResetMs: 1500, // "copied" indicator duration
})Right-to-left
Direction is not a setting: every component follows the page's dir. Layout mirrors through CSS logical properties, and everything decided in script — mirrored Left/Right arrow keys, drag deltas, timeline and chart axes, which side a popup opens on — resolves the direction through one shared helper, ogeResolveDirection from @oge-ui/behavior, so both render layers agree. The BPMN canvas is the deliberate exception: diagram coordinates are absolute, so only its chrome (palette, properties panel, context pad) mirrors.
<!-- 1. Most components need nothing: layout uses CSS logical properties,
so setting dir on <html> (or any ancestor) mirrors them. -->
<html lang="ar" dir="rtl">
<!-- 2. Components that compute geometry in script (grid, tree list, charts,
scheduler, Gantt, kanban, pivot) follow the page too, and re-mirror
when dir changes at runtime. rtlEnabled forces a direction for one
instance and also sets dir on its host: -->
<oge-scheduler [dataSource]="appointments" [rtlEnabled]="true" />
// 3. Your own widgets can share the same rule (SSR-safe):
import { ogeIsRtl, observeDirection } from '@oge-ui/behavior';
const rtl = ogeIsRtl(hostElement); // computed direction, then the nearest dir
const stop = observeDirection(hostElement, (direction) => {
// 'ltr' | 'rtl' — mirror your arrow keys / drag maths here
});