'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getMessage = exports.intl = undefined;

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactIntl = require('react-intl');

var _AppState = require('../stores/AppState');

var _AppState2 = _interopRequireDefault(_AppState);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

/**
 * 多语言
 */
function intl(id, otherProps) {
  return _react2['default'].createElement(_reactIntl.FormattedMessage, (0, _extends3['default'])({ id: id }, otherProps));
}

/**
 * @deprecated
 * 返回多语言字符串
 */
function getMessage(zh, en) {
  var language = _AppState2['default'].currentLanguage.split('_')[0];
  if (language === 'zh') {
    return zh;
  } else if (language === 'en') {
    return en;
  }
  return false;
}

exports.intl = intl;
exports.getMessage = getMessage;