Add demo HTML file for Chinese language support
This commit is contained in:
parent
91bde8cc82
commit
2c874866a5
36
public/demo-cn.html
Normal file
36
public/demo-cn.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<script type="module">
|
||||||
|
function saveTextAsFile(text, filename) {
|
||||||
|
const elem = document.createElement('a');
|
||||||
|
elem.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(text);
|
||||||
|
elem.download = filename;
|
||||||
|
elem.click();
|
||||||
|
}
|
||||||
|
const data = await fetch('example.json').then((res) => res.json());
|
||||||
|
data.settings.lang = 'zh-CN';
|
||||||
|
window.addEventListener('message', (event) => {
|
||||||
|
saveTextAsFile(JSON.stringify(event.data), 'response.json');
|
||||||
|
});
|
||||||
|
window.onload = () => {
|
||||||
|
const iframe = document.getElementById('iframe');
|
||||||
|
iframe.contentWindow.postMessage(data, window.origin);
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Inter, 'Helvetica Neue', Helvetica, 'PingFang SC',
|
||||||
|
'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<iframe
|
||||||
|
src="index.html"
|
||||||
|
style="width: 100%; height: 100%; border: none; position: absolute; top: 0; left: 0;"
|
||||||
|
id="iframe"></iframe>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user