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

Translator

The Translator class translates strings using the loaded localization.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

A map of translation keys to their translated values.

Method Summary

Public Methods
public

plural(count: Integer): String

Determine the key of a translation that should be used for the given count.

public

trans(key: String, input: Object, fallback: VirtualElement): VirtualElement

Translate a string.

Public Constructors

public constructor() source

Public Members

public translations: Object source

A map of translation keys to their translated values.

Public Methods

public plural(count: Integer): String source

Determine the key of a translation that should be used for the given count. The default implementation is for English plurals. It should be overridden by a locale's JavaScript file if necessary.

Params:

NameTypeAttributeDescription
count Integer

Return:

String

public trans(key: String, input: Object, fallback: VirtualElement): VirtualElement source

Translate a string.

Params:

NameTypeAttributeDescription
key String
input Object
fallback VirtualElement

Return:

VirtualElement