Developers
Start building
Themes/Theme SDK/Modules/i18n/Types

Types

The types of @poltura/theme-sdk/i18n.

On this page
import { … } from '@poltura/theme-sdk/i18n';

Locale

A language the store's storefront is available in.

tagrequiredstring

The BCP 47 tag, such as `hu-HU`.

languagerequiredstring

The language subtag, such as `hu`.

countryrequiredCountryCode | null

The country subtag in upper case, or null for a language without one.

labelrequiredstring

The language's own name for itself, such as `Magyar`.

nameOrderrequiredNameOrder

The order names are written in this language.

NameOrder

The order a person's given and family names are written in.

type NameOrder = 'givenFirst' | 'familyFirst'

TextValues

Values filled into the placeholders of a text.

type TextValues = Readonly<Record<string, string | number>>

Translator

One platform text by key, with its placeholders filled.

type Translator = (key: string, values?: TextValues) => string

RichTextValues

Values for a text with marked passages: plain values fill placeholders, functions wrap the passage between <name> and </name>.

type RichTextValues = Readonly<Record<string, string | number | ((chunks: ReactNode) => ReactNode)>>

RichTranslator

One platform text by key, its placeholders filled and its marked passages drawn by the given functions.

type RichTranslator = (key: string, values?: RichTextValues) => ReactNode

ThemeText

One of the theme's own texts by dotted key, with placeholders and ICU plurals resolved.

type ThemeText = (key: string, values?: TextValues) => string

MoneyFormatOptions

How Formatter writes an amount of money.

display'symbol' | 'code'

`symbol` writes `Ft` or `€`, `code` writes `HUF` or `EUR`; screens use the symbol.

zeroLabelstring

The text shown instead of a zero amount, such as `Free`.

Formatter

Formats numbers, money, dates and lists in the page language and the store's time zone.

moneyrequired(value: Money, options?: MoneyFormatOptions) => string

An amount of money, such as `12 990 Ft`; empty while prices are hidden from the visitor.

numberrequired(value: number, options?: Intl.NumberFormatOptions) => string

A number with the language's separators.

percentrequired(value: number) => string

A percentage from its number, so `27` writes `27%`.

daterequired(value: Date | string, options?: Intl.DateTimeFormatOptions) => string

A calendar date in the store's time zone.

dateTimerequired(value: Date | string, options?: Intl.DateTimeFormatOptions) => string

A date with its time of day in the store's time zone.

relativeTimerequired(value: Date | string, now?: Date) => string

How long ago or from now an instant is, such as `3 minutes ago`.

listrequired(values: readonly string[], options?: Intl.ListFormatOptions) => string

A list joined the language's way, such as `a, b and c`.

calendarYearrequired() => number

The current year in the store's time zone.

Locales

The page language and every language the storefront offers.

currentrequiredLocale

The language the page renders in.

availablerequiredreadonly Locale[]

Every language the storefront offers, the current one included.

Last updated