i18n/Text
An unstyled text translation component.
Members
Section titled “Members ”Text Component
Section titled “Text   Component ”Translates its child string value in the current locale.
If translations are not available yet, Text will render nothing. Once translations are
available, the component will update with the translated string.
<Text>Go</Text> Wrapped with:
i18n/Texti18n/Text.TextDecorator
Properties
children
Section titled “children”The string to be translated.
TextDecorator Higher-Order Component
Section titled “TextDecorator   Higher-Order Component ”A higher-order component that is used to translate text and provide the translations via props.
TextDecorator accepts an optional mapPropsToText config prop which defines the props it will
populate and the text to translate and provide in that prop. defaultText can also be provided
when appropriate.
If translations are not available yet and all props do not include a default value,
TextDecorator will render nothing. Once translations are available, the component will update
with the translated strings.
TextDecorator({
mapPropsToText: {
// Always translate "Go" and pass it in the `children` prop
children: 'Go',
// Translate "Go to next page" but pass "" (value always untranslated) while
// waiting for the translated strings to be fetched.
'aria-label': {
text: 'Go to next page',
defaultText: ''
}
}
})
Configuration
Configures the translated text passed to the wrapped component.
Default: nullProperties added to wrapped component
children
Section titled “children”Passed to the wrapped component.
If mapPropsToText is null and children is a string, the string will be
translated before being passed to the wrapped component.
locale
Section titled “locale”The locale for translation.
If not supplied, the current locale is used.