How to use terra-i18n - 7 common examples

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 / src / Base.jsx View on Github external
componentDidUpdate(prevProps) {
    if (this.props.locale !== undefined && this.props.locale !== prevProps.locale) {
      try {
        i18nLoader(this.props.locale, this.setState, this);
      } catch (e) {
        // eslint-disable-next-line no-console
        console.error(e);
      }
    }
  }
github cerner / terra-core / packages / terra-base / src / Base.jsx View on Github external
componentDidMount() {
    if (this.props.locale !== undefined) {
      try {
        i18nLoader(this.props.locale, this.setState, this);
      } catch (e) {
        // eslint-disable-next-line no-console
        console.error(e);
      }
    }
  }
github cerner / terra-core / packages / terra-site / src / examples / i18n / I18nDemo.jsx View on Github external
componentDidMount() {
    i18nLoader(this.state.locale, this.setState, this);
  }
github cerner / terra-core / packages / terra-site / src / examples / i18n / I18nDemo.jsx View on Github external
handleLocaleChange(e) {
    i18nLoader(e.target.value, this.setState, this);
  }
github cerner / terra-core / packages / terra-i18n / src / terra-dev-site / doc / example / I18nDemo.jsx View on Github external
componentDidMount() {
    i18nLoader(this.state.locale, this.setState, this);
  }
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 2 months ago

Package Health Score

90 / 100
Full package analysis