Some browsers, such as Safari < 10 & IE < 11, do not support the JavaScript Internationalization API, which react-intl depends on. In order to support these browsers, we’ll conditionally include an Intl polyfill using webpack require.ensure. This ensures only browsers that need the polyfill incur the extra load.

if (!window.Intl) {
require.ensure([
'intl',
'intl/locale-data/jsonp/en.js',
'intl/locale-data/jsonp/fr.js',
'intl/locale-data/jsonp/es.js'
], (require) => {
require('intl');
require('intl/locale-data/jsonp/en.js');
require('intl/locale-data/jsonp/fr.js');
require('intl/locale-data/jsonp/es.js'); runApp();
})
} else {
runApp();
} function runApp() {
addLocaleData([...en, ...fr, ...es]); let locale = (navigator.languages && navigator.languages[0])
|| navigator.language
|| navigator.userLanguage
|| 'en-US'; ReactDOM.render(
<IntlProvider locale={locale} messages={flattenMessages(messages[locale])}>
<App />
</IntlProvider>,
document.getElementById('root')
);
}

最新文章

  1. ORACLE添加表约束的语法示例
  2. JAVA中ArrayList用法
  3. ren
  4. hbase meta表修复
  5. SpingMVC ModelAttribute的用法
  6. 【Away3D代码解读】(五):动画模块及骨骼动画
  7. Java笔记(二十八)&hellip;&hellip;IO流下 IO包中其他常用类以及编码表问题
  8. hdu 1015 dfs
  9. Scrum 学习笔记
  10. 使用SQL Server 2008远程链接时SQL数据库不成功的解决方法
  11. Linux企业级项目实践之网络爬虫(14)——使用正则表达式抽取HTML正文和URL
  12. Grub启动配置文件
  13. Spring Boot学习总结一
  14. canvas(三) star- demo
  15. Javascript高级编程学习笔记(12)—— 引用类型(1)Object类型
  16. centos 7 防火墙的使用 firewalld
  17. 域名、ip、以及通过域名访问网站、虚拟主机
  18. https://www.cnblogs.com/zy-jiayou/p/7661415.html
  19. Chrome nacl开启
  20. iOS 开发中,关于xxx.xcodeproj 文件冲突的解决方案 (以后谁不会了,直接将连接给他)

热门文章

  1. iOS项目开发实战——学会使用TableView列表控件(二)
  2. C#实现窗口拖动时各个控件同比自己主动放缩大小
  3. windows下搭建hadoop-2.6.0本地idea开发环境
  4. vim 基础学习之可视模式
  5. 下载安装与配置Excel 2013数据挖掘加载项(SQL Server 2012 SP1 + SQLServer2012_DMAddin.msi)
  6. 阅读笔记—JSP
  7. CSDN的个人主页如何添加微信二维码
  8. C++里面virtual函数及虚表大小
  9. Java 批量修改文件后缀
  10. Direct2D开发:Direct2D 和 GDI 互操作性概述