Reference Source
import Translator from 'flarum/common/Translator'
public class | source

Translator

Member Summary

Public Members
public

The underlying ICU MessageFormatter util.

public

A map of translation keys to their translated values.

Method Summary

Public Methods
public

addTranslations(translations: *)

public

formatterTypeHandlers(): {"plural": *, "select": *}

An extensible entrypoint for extenders to register type handlers for translations.

public

preprocessParameters(parameters: *): *

A temporary system to preprocess parameters.

public

setLocale(locale: *)

public

trans(id: *, parameters: {}): *

Public Members

public formatter: * source

The underlying ICU MessageFormatter util.

public translations: * source

A map of translation keys to their translated values.

Public Methods

public addTranslations(translations: *) source

Params:

NameTypeAttributeDescription
translations *

public formatterTypeHandlers(): {"plural": *, "select": *} source

An extensible entrypoint for extenders to register type handlers for translations.

Return:

{"plural": *, "select": *}

public preprocessParameters(parameters: *): * source

A temporary system to preprocess parameters. Should not be used by extensions. TODO: An extender will be added in v1.x.

Params:

NameTypeAttributeDescription
parameters *

Return:

*

public setLocale(locale: *) source

Params:

NameTypeAttributeDescription
locale *

public trans(id: *, parameters: {}): * source

Params:

NameTypeAttributeDescription
id *
parameters {}
  • optional
  • default: {}

Return:

*