Skip to content

basalt / i18n/src / Translator

Interface: Translator<C> ​

Defined in: i18n/src/i18n.ts:5

A translator/formatter bound to a specific locale.

Type Parameters ​

C ​

C extends Catalog

Properties ​

locale ​

> readonly locale: string

Defined in: i18n/src/i18n.ts:6

Methods ​

currency() ​

> currency(value, currency, options?): string

Defined in: i18n/src/i18n.ts:10

Parameters ​

value ​

number

currency ​

string

options? ​

NumberFormatOptions

Returns ​

string


date() ​

> date(value, options?): string

Defined in: i18n/src/i18n.ts:11

Parameters ​

value ​

number | Date

options? ​

DateTimeFormatOptions

Returns ​

string


list() ​

> list(items, options?): string

Defined in: i18n/src/i18n.ts:13

Parameters ​

items ​

string[]

options? ​

ListFormatOptions

Returns ​

string


n() ​

> n(value, options?): string

Defined in: i18n/src/i18n.ts:9

Format a number.

Parameters ​

value ​

number

options? ​

NumberFormatOptions

Returns ​

string


relativeTime() ​

> relativeTime(value, unit, options?): string

Defined in: i18n/src/i18n.ts:12

Parameters ​

value ​

number

unit ​

RelativeTimeFormatUnit

options? ​

RelativeTimeFormatOptions

Returns ​

string


t() ​

> t(key, params?): string

Defined in: i18n/src/i18n.ts:7

Parameters ​

key ​

keyof C & string

params? ​

Record<string, unknown>

Returns ​

string

Released under the MIT License.