Fastkit

i18n API

I18nComponentStatic
class

Component Definition of Internationalization Services

  • Internationalization services are designed to have multiple components available
  • Build your application robustly by designing components for features, screens, and domains
  • Components created from the same space definition can reference each other's instances

locales
readonly

I18nComponentLocales<LocaleName, BaseLocale, LocaleMeta, Translations, DateTimeFormats, RelativeTimeFormats, NumberFormats, ListFormats, Dependencies>

Map settings for component locales or their asynchronous loaders

dependencies
readonly

Dependencies

Map of dependent components that can be registered in the spaces and components of the internationalization service

createInstance
function

# Signature
(space: I18nSpace<LocaleName, BaseLocale, LocaleMeta>): I18nComponent<LocaleName, BaseLocale, LocaleMeta, Translations, DateTimeFormats, RelativeTimeFormats, NumberFormats, ListFormats, Dependencies>

Create a component instance

  • This method is usually executed from a space instance inside the internationalization service
# Parameters
NameTypeDefault
space*I18nSpace<LocaleName, BaseLocale, LocaleMeta>
Internationalization Space
# Return Type
I18nComponent<LocaleName, BaseLocale, LocaleMeta, Translations, DateTimeFormats, RelativeTimeFormats, NumberFormats, ListFormats, Dependencies>

Create a component instance

  • This method is usually executed from a space instance inside the internationalization service

load
function

# Signature
(...locales: LocaleName[]): Promise<void>

Load the specified locale

# Parameters
NameTypeDefault
localesLocaleName[]
List of locale names
# Return Type
Promise<void>

Load the specified locale

I18nComponent
class

Internationalization Service Components

  • Internationalization services are designed to have multiple components available
  • Build your application robustly by designing components for features, screens, and domains
  • Components created from the same space definition can reference each other's instances

Ctor
readonly

I18nComponentStatic<LocaleName, BaseLocale, LocaleMeta, Translations, DateTimeFormats, RelativeTimeFormats, NumberFormats, ListFormats, Dependencies>

component definition

space
readonly

I18nSpace<LocaleName, BaseLocale, LocaleMeta>

Internationalization Space

deps
readonly

Readonly<{ [Name in keyof Dependencies]: ReturnType<Dependencies[Name]["createInstance"]>; }>

Instantiated component map

trans
readonly

Translations

Translation object corresponding to the currently selected locale

t
readonly

Translations

Translation object corresponding to the currently selected locale

  • Alias to this.trans.

getTranslations
function

# Signature
(localeName: LocaleName): Translations

Obtains the translation object corresponding to the specified locale name

# Parameters
NameTypeDefault
localeName*LocaleName
locale name
# Return Type
Translations

Obtains the translation object corresponding to the specified locale name