Localization (i18n)

The locale setting is located in Web Settings on the admin section. Currently English and Portuguese languages are supported.

Text localization can be done using the Live own i18n service.

Import

import i18n from 'live/services/i18n'

Registering translations

import locale from 'live/init/global-locale'
import i18n from 'live/services/i18n'
import pt_br from './i18n/pt_br'
import en_us from './i18n/en_us'

var localeFiles = {
    pt_br: pt_br,
    en_us: en_us
}

// register current locale file
i18n.add(localeFiles[locale])

Locale files

Parameters, pluralization, functions

Translations can received simple parameters that will be expanded for each locale string

The parameters can also be used for a very simple pluralization logic

Translation values can be functions that will be rendered as React components

API

Usage

Last updated

Was this helpful?