From 336c3613e828b468ae89b43910df33366faef81f Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 13 Dec 2017 20:01:11 +0800 Subject: [PATCH] site: fix navigator.language undefined --- site/theme/static/template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/theme/static/template.html b/site/theme/static/template.html index 694ad5ab43..e5b2ad5d31 100644 --- a/site/theme/static/template.html +++ b/site/theme/static/template.html @@ -48,7 +48,7 @@ // 首页无视链接里面的语言设置 https://github.com/ant-design/ant-design/issues/4552 if (isLocalStorageNameSupported() && (pathname === '/' || pathname === '/index-cn')) { - var lang = (window.localStorage && localStorage.getItem('locale')) || (navigator.language.toLowerCase() === 'zh-cn' ? 'zh-CN' : 'en-US'); + var lang = (window.localStorage && localStorage.getItem('locale')) || ((navigator.language || navigator.browserLanguage).toLowerCase() === 'zh-cn' ? 'zh-CN' : 'en-US'); // safari is 'zh-cn', while other browser is 'zh-CN'; if ((lang === 'zh-CN') !== isZhCN(pathname)) { location.pathname = getLocalizedPathname(pathname, lang === 'zh-CN');