import { isBrowser } from '@ant-design/pro-utils';
import zhLocal from './zh-CN';
const locales = {
  'zh-CN': zhLocal
};

const getLanguage = () => {
  if (!isBrowser()) return 'zh-CN';
  const lang = window.localStorage.getItem('umi_locale');
  return lang || (window).g_locale || navigator.language;
};

export { getLanguage };

export default ()=> {
  const gLocale = getLanguage();
  if (locales[gLocale]) {
    return locales[gLocale];
  }
  return locales['zh-CN'];
};