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

Translator

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

The underlying ICU MessageFormatter util.

public

translations: Translations

A map of translation keys to their translated values.

Method Summary

Public Methods
public

addTranslations(translations: Translations)

public

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

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

public

preprocessParameters(parameters: TranslatorParameters): *

A temporary system to preprocess parameters.

public

setLocale(locale: string)

public

trans(id: string, parameters: TranslatorParameters): *

Public Constructors

public constructor() source

Public Members

public formatter: * source

The underlying ICU MessageFormatter util.

public translations: Translations source

A map of translation keys to their translated values.

Public Methods

public addTranslations(translations: Translations) source

Params:

NameTypeAttributeDescription
translations Translations

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

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

Return:

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

public preprocessParameters(parameters: TranslatorParameters): * 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 TranslatorParameters

Return:

*

public setLocale(locale: string) source

Params:

NameTypeAttributeDescription
locale string

public trans(id: string, parameters: TranslatorParameters): * source

Params:

NameTypeAttributeDescription
id string
parameters TranslatorParameters

Return:

*