'use strict';

import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import PropTypes from 'prop-types';
import { translate } from '../../utils';
import { deprecation } from '../utils/functions'; // @deprecated. use DangerousHTML instead

var Translate =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(Translate, _React$Component);

  function Translate() {
    return _React$Component.apply(this, arguments) || this;
  }

  var _proto = Translate.prototype;

  _proto.render = function render() {
    var _this$props = this.props,
        children = _this$props.children,
        className = _this$props.className,
        testAutomationId = _this$props.testAutomationId,
        dataTestAutomationId = _this$props['data-test-automation-id']; //FIXME .toString() of children?

    return React.createElement("span", {
      className: className,
      "data-test-automation-id": testAutomationId || dataTestAutomationId,
      dangerouslySetInnerHTML: {
        __html: translate(children, this.props)
      }
    });
  };

  return Translate;
}(React.Component);

_defineProperty(Translate, "propTypes", {
  children: PropTypes.node.isRequired,
  className: PropTypes.string,
  testAutomationId: PropTypes.string
});

_defineProperty(Translate, "defaultProps", {
  className: null,
  testAutomationId: null
});

var DeprecatedTranslate = deprecation(Translate, 'Use `DangerousHTML` component for inserting html or function `translate` for templates/pluralization.');
export { DeprecatedTranslate as Translate };