t

Type: Function

How to get t?

JavaScript

import t from 'fontoxml-localization/src/t.js'

Get the appropriate localization of the given string for the configured preferred locales, optionally inserting the given arguments as defined by the MessageFormat-encoded template.

The messageInEnglish argument should always be a string literal or concatenation expression (using +) of string literals. This enables the localization tools to correctly extract the message for inclusion in the message bundle.

By convention, placeholders referring to values in the args object use ALL_CAPS names to clearly distinguish them from actual content in the message to be translated.

Besides the default formatters provided by messageformat.js, a number of additional formatters are provided by the Fonto platform:

"fonto_date": Format a date in the format preferred by fonto, but still adhering to the locale settings. Optionally accepts a 'short' variation which only shows the day and month. Example use: t('{DATE, fonto_date, short}', { DATE: new Date(0) }) outputs January 1

"fonto_upper_case_first_letter": Upper-case the first letter of a string.

Arguments

  1. messageInEnglish

    (Required)

    Type: String

  2. args

    (Optional)

    Type: Object

Returns

Type: String