How to use the terra-i18n.I18nProvider function in terra-i18n

To help you get started, we’ve selected a few terra-i18n examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cerner / terra-core / packages / terra-base / lib / Base.js View on Github external
locale = _props.locale,
          customMessages = _props.customMessages,
          customProps = _objectWithoutProperties(_props, ['children', 'locale', 'customMessages']);

      var childComponent = _react2.default.createElement(
        'div',
        customProps,
        children
      );

      var messages = _extends({}, this.state.messages, customMessages);

      if (locale === undefined) return childComponent;
      if (!this.state.areTranslationsLoaded) return null;
      return _react2.default.createElement(
        _terraI18n.I18nProvider,
        { locale: this.state.locale, messages: messages },
        childComponent
      );
    }
  }]);

terra-i18n

The terra-i18n package provides on-demand internationalization of React components.

Apache-2.0
Latest version published 7 months ago

Package Health Score

57 / 100
Full package analysis