import React from 'react';
import Instance from './instance';
import getLocaleValue from './../locale';

function Context(_ref) {
  var _ref$locale = _ref.locale,
      locale = _ref$locale === void 0 ? {} : _ref$locale,
      portal = _ref.portal,
      children = _ref.children;
  var data = null;
  data = locale;

  if (!data || Object.keys(data).length === 0) {
    console.log('国际化数据为空');
  }

  if (data && Object.keys(data).length) {
    window.localeData = data;
  }

  return /*#__PURE__*/React.createElement(Instance.Provider, {
    value: {
      locale: function locale() {
        return getLocaleValue.apply(void 0, arguments);
      },
      portal: portal
    }
  }, children);
}

export default Context;