* {'Hello, { $username }!'}
*
*
* It's recommended that the contents of the wrapped component be a string
* expression. The string will be used as the ultimate fallback if no
* translation is available. It also makes it easy to grep for strings in the
* source code.
*/
class localized_Localized extends external_React_["Component"] {
componentDidMount() {
const {
l10n
} = this.context;
if (l10n) {
l10n.subscribe(this);
}
}
componentWillUnmount() {
const {
l10n
} = this.context;
if (l10n) {
l10n.unsubscribe(this);
}
}
/*
* Rerender this component in a new language.
*/
relocalize() {
// When the `ReactLocalization`'s fallback chain changes, update the
// component.
this.forceUpdate();
}
render() {
const {
l10n,
parseMarkup
} = this.context;
const {
id,
attrs,
children: elem = null
} = this.props; // Validate that the child element isn't an array
if (Array.isArray(elem)) {
throw new Error("