Internationalization
Numbers, currencies, dates and calendars follow one global Atlas configuration, formatted with the browser's Intl API.
Global settings
Pass the settings to provideAtlas(); anything you leave out keeps its default:
| Setting | Default | What it controls |
|---|---|---|
| locale | 'en-US' | BCP 47 tag for number and date formatting and calendar labels. |
| dateFormat | 'medium' | Date preset: 'short', 'medium', 'long', 'full', 'shortDate', 'mediumDate', 'longDate', 'fullDate', 'shortTime', 'mediumTime', 'longTime', or 'fullTime'. Dates show in the user's local time zone. |
| showTimeZone | false | Append the time zone (e.g. 'GMT+2') in the 'long', 'full', 'longTime' and 'fullTime' presets. Off by default so users see plain local time. |
| numberFormat | 'decimal' | Number preset: 'decimal', 'integer', 'percent' or 'currency'. |
| currency | 'USD' | ISO 4217 code used by the 'currency' format. |
| decimals | 2 | Fraction digits of the decimal format. |
| weekStart | 1 | First day of the calendar week (0 = Sunday, 1 = Monday). |
src/app/app.config.ts
provideAtlas({
locale: 'en-GB',
currency: 'GBP',
dateFormat: 'long',
weekStart: 1,
});Formatting numbers and dates
AtlasFormatService and the atlasNumber, atlasCurrency and atlasDate pipes format with the same engine the data grid uses for its number, currency and date columns, so your own text matches the grid. Every argument is optional and falls back to the global settings.
report.component.ts
import { AtlasFormatService } from '@atlas/components/core';
private readonly format = inject(AtlasFormatService);
total = this.format.formatCurrency(1234.5); // configured currency and decimals
share = this.format.formatPercent(0.185, 1); // ratio in, "18.5%" out (en-US)
due = this.format.formatDate(new Date(), { format: 'short' });
price = this.format.formatNumber(99.9, { locale: 'de-DE', format: 'currency', currency: 'EUR' });template
{{ amount | atlasNumber }} <!-- configured format -->
{{ amount | atlasNumber : 'currency' : 'EUR' }}
{{ ratio | atlasNumber : 'percent' : undefined : 1 }} <!-- format : currency : decimals -->
{{ amount | atlasCurrency : 'GBP' : 0 }} <!-- currency : decimals -->
{{ placedAt | atlasDate : 'mediumDate' }} <!-- format : showTimeZone -->Per-component overrides
localeandweekStartare global only.atlas-datepickertakes adateFormatinput that overrides the global date format.- Data grid columns set their own
currencyanddecimals. AtlasFormatServicecalls acceptlocale,format,currencyanddecimalsper call.
Switching at runtime
The configuration is a signal held by AtlasConfigService. update() deep-merges a partial configuration and every component that reads it re-renders; reset() restores the defaults. The formatting pipes are pure, so their bindings show the new locale the next time their input changes.
locale-switcher.ts
import { AtlasConfigService } from '@atlas/components/core';
import { ATLAS_LOCALE_FR } from '@atlas/components/locales';
private readonly config = inject(AtlasConfigService);
useFrench(): void {
this.config.update(ATLAS_LOCALE_FR); // locale, currency and all texts
}
useSwissFrancs(): void {
this.config.update({ currency: 'CHF' }); // one setting, the rest stays
}