'use strict';

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports.Translate = void 0;

var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _utils = require("../../utils");

var _functions = require("../utils/functions");

// @deprecated. use DangerousHTML instead
var Translate =
/*#__PURE__*/
function (_React$Component) {
  (0, _inheritsLoose2.default)(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.default.createElement("span", {
      className: className,
      "data-test-automation-id": testAutomationId || dataTestAutomationId,
      dangerouslySetInnerHTML: {
        __html: (0, _utils.translate)(children, this.props)
      }
    });
  };

  return Translate;
}(_react.default.Component);

(0, _defineProperty2.default)(Translate, "propTypes", {
  children: _propTypes.default.node.isRequired,
  className: _propTypes.default.string,
  testAutomationId: _propTypes.default.string
});
(0, _defineProperty2.default)(Translate, "defaultProps", {
  className: null,
  testAutomationId: null
});
var DeprecatedTranslate = (0, _functions.deprecation)(Translate, 'Use `DangerousHTML` component for inserting html or function `translate` for templates/pluralization.');
exports.Translate = DeprecatedTranslate;