You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.9 KiB
75 lines
2.9 KiB
<!DOCTYPE html><html><head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<meta name="theme-color" content="#1677ff">
|
|
<link rel="shortcut icon" href="https://gw.alipayobjects.com/zos/rmsportal/rlpTLlbMzTNYuZGGCVYM.png">
|
|
<link rel="stylesheet" href="/ssr-1689742446534.css">
|
|
<link rel="stylesheet" href="/umi.c34b5f34.css">
|
|
<script>
|
|
(function () {
|
|
function isLocalStorageNameSupported() {
|
|
const testKey = 'test';
|
|
const storage = window.localStorage;
|
|
try {
|
|
storage.setItem(testKey, '1');
|
|
storage.removeItem(testKey);
|
|
return true;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
}
|
|
// 优先级提高到所有静态资源的前面,语言不对,加载其他静态资源没意义
|
|
const pathname = location.pathname;
|
|
|
|
function isZhCN(pathname) {
|
|
return /-cn\/?$/.test(pathname);
|
|
}
|
|
function getLocalizedPathname(path, zhCN) {
|
|
const pathname = path.indexOf('/') === 0 ? path : '/' + path;
|
|
if (!zhCN) {
|
|
// to enUS
|
|
return /\/?index(-cn)?/.test(pathname) ? '/' : pathname.replace('-cn', '');
|
|
} else if (pathname === '/') {
|
|
return '/index-cn';
|
|
} else if (pathname.indexOf('/') === pathname.length - 1) {
|
|
return pathname.replace(/\/$/, '-cn/');
|
|
}
|
|
return pathname + '-cn';
|
|
}
|
|
|
|
// 兼容旧的 URL, `?locale=...`
|
|
const queryString = location.search;
|
|
if (queryString) {
|
|
const isZhCNConfig = queryString.indexOf('zh-CN') > -1;
|
|
if (isZhCNConfig && !isZhCN(pathname)) {
|
|
location.pathname = getLocalizedPathname(pathname, isZhCNConfig);
|
|
}
|
|
}
|
|
|
|
// 首页无视链接里面的语言设置 https://github.com/ant-design/ant-design/issues/4552
|
|
if (isLocalStorageNameSupported() && (pathname === '/' || pathname === '/index-cn')) {
|
|
const 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');
|
|
}
|
|
}
|
|
document.documentElement.className += isZhCN(pathname) ? 'zh-cn' : 'en-us';
|
|
})();
|
|
</script>
|
|
<script async="" src="//www.googletagmanager.com/gtag/js?id=UA-72788897-1"></script>
|
|
<script>window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
gtag('config', 'UA-72788897-1');</script>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
<script src="/umi.61c7c9c4.js" crossorigin="anonymous"></script>
|
|
|
|
</body></html>
|