valaxy 0.15.11-alpha.0 → 0.15.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/valaxy.cjs +0 -0
- package/bin/valaxy.mjs +0 -0
- package/dist/{chunk-3EJGKTUH.mjs → chunk-HAVGXIHI.mjs} +1 -1
- package/dist/{chunk-RDNVTVQ5.cjs → chunk-HZFTOKBG.cjs} +1 -1
- package/dist/{config-e5704a2c.d.ts → config-0d4945ff.d.ts} +12 -2
- package/dist/node/cli/index.cjs +1 -1
- package/dist/node/cli/index.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +1 -2
- package/dist/node/index.d.ts +1 -2
- package/dist/node/index.mjs +1 -1
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +2 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/index.mjs +1 -1
- package/package.json +8 -9
- package/types/config.ts +3 -1
- package/types/{default-theme.d.ts → default-theme.ts} +2 -1
- package/types/index.ts +2 -1
- package/client/.vite-ssg-temp/tbbjcbuyn2/CNAME +0 -1
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/PressAlgoliaSearch-2943719f.js +0 -227
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/ValaxyMain-26e77dc6.js +0 -752
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/_...all_-080f97f3.js +0 -31
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/_...all_-5084a1b0.js +0 -42
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/addon-f5fa83e1.js +0 -172
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/best-pratice-0231a551.js +0 -1105
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/client-496183a0.js +0 -286
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/community-1b33ec3b.js +0 -627
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/components-7000ddd3.js +0 -2460
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/deploy-59948619.js +0 -1071
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/docs-26abd7f8.js +0 -490
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/extend-975f8f72.js +0 -1851
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/extend-acd7107b.js +0 -1444
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/faq-62ed7bfd.js +0 -321
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/features-8acbd53d.js +0 -2625
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/gallery-832227a9.js +0 -244
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/gallery-9077df38.js +0 -370
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/getting-started-52c30f03.js +0 -3684
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/hexo-7311896e.js +0 -969
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/hooks-67450cb3.js +0 -517
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/i18n-4cd1bb86.js +0 -4159
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/i18n-e1165bc4.js +0 -676
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-002f83fb.js +0 -768
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-3dec2b83.js +0 -527
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-43565e48.js +0 -424
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-5f07432e.js +0 -563
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-6024f010.js +0 -3294
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-6f0d6ec7.js +0 -202
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-78c510e0.js +0 -549
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-839c338e.js +0 -4161
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-d39a48fd.js +0 -1170
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/index-e633613c.js +0 -1564
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/katex-32f21e80.js +0 -6119
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/logo-bd69f816.js +0 -180
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/markdown-050f3269.js +0 -5895
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/news-ecba2d88.js +0 -278
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/page-d48f3caa.js +0 -752
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/post-ac89eaf5.js +0 -1605
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/route-block-c0a8bdd8.js +0 -4
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/schema-org-f60b7dac.js +0 -477
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/site-6caa6511.js +0 -286
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/style-f415f7fa.css +0 -3742
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/styles-cdaadad2.js +0 -548
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/templates-c97584f2.js +0 -574
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/theme-192f77ef.js +0 -172
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/use-3c036a47.js +0 -669
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/use-851c0307.js +0 -619
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/vite-vue-f91b9792.js +0 -830
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/vscode-bc411e64.js +0 -350
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/why-c98bbe8e.js +0 -1131
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/write-6a43d4d0.js +0 -4963
- package/client/.vite-ssg-temp/tbbjcbuyn2/assets/write-6bc2b77c.js +0 -675
- package/client/.vite-ssg-temp/tbbjcbuyn2/favicon.svg +0 -33
- package/client/.vite-ssg-temp/tbbjcbuyn2/main.mjs +0 -6239
- package/client/.vite-ssg-temp/tbbjcbuyn2/valaxy-logo.png +0 -0
- package/client/.vite-ssg-temp/vp12eb5cgm/CNAME +0 -1
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/PressAlgoliaSearch-2943719f.js +0 -227
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/ValaxyMain-26e77dc6.js +0 -752
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/_...all_-080f97f3.js +0 -31
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/_...all_-5084a1b0.js +0 -42
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/addon-f5fa83e1.js +0 -172
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/best-pratice-0231a551.js +0 -1105
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/client-496183a0.js +0 -286
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/community-1b33ec3b.js +0 -627
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/components-7000ddd3.js +0 -2460
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/deploy-59948619.js +0 -1071
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/docs-26abd7f8.js +0 -490
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/extend-975f8f72.js +0 -1851
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/extend-acd7107b.js +0 -1444
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/faq-62ed7bfd.js +0 -321
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/features-8acbd53d.js +0 -2625
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/gallery-832227a9.js +0 -244
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/gallery-9077df38.js +0 -370
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/getting-started-bb7fc0a8.js +0 -3684
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/hexo-7311896e.js +0 -969
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/hooks-67450cb3.js +0 -517
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/i18n-4cd1bb86.js +0 -4159
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/i18n-e1165bc4.js +0 -676
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-002f83fb.js +0 -768
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-3dec2b83.js +0 -527
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-43565e48.js +0 -424
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-5f07432e.js +0 -563
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-6024f010.js +0 -3294
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-6f0d6ec7.js +0 -202
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-78c510e0.js +0 -549
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-839c338e.js +0 -4161
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-d39a48fd.js +0 -1170
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/index-e633613c.js +0 -1564
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/katex-32f21e80.js +0 -6119
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/logo-bd69f816.js +0 -180
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/markdown-abdb17ca.js +0 -5895
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/news-ecba2d88.js +0 -278
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/page-d48f3caa.js +0 -752
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/post-0ed0dfec.js +0 -1605
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/route-block-c0a8bdd8.js +0 -4
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/schema-org-f60b7dac.js +0 -477
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/site-6caa6511.js +0 -286
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/style-f415f7fa.css +0 -3742
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/styles-cdaadad2.js +0 -548
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/templates-c97584f2.js +0 -574
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/theme-192f77ef.js +0 -172
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/use-3c036a47.js +0 -669
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/use-851c0307.js +0 -619
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/vite-vue-f91b9792.js +0 -830
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/vscode-bc411e64.js +0 -350
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/why-c98bbe8e.js +0 -1131
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/write-6a43d4d0.js +0 -4963
- package/client/.vite-ssg-temp/vp12eb5cgm/assets/write-6bc2b77c.js +0 -675
- package/client/.vite-ssg-temp/vp12eb5cgm/favicon.svg +0 -33
- package/client/.vite-ssg-temp/vp12eb5cgm/main.mjs +0 -6239
- package/client/.vite-ssg-temp/vp12eb5cgm/valaxy-logo.png +0 -0
|
@@ -1,4159 +0,0 @@
|
|
|
1
|
-
import { _ as _export_sfc, c as _sfc_main$1, a as _sfc_main$2 } from "../main.mjs";
|
|
2
|
-
import { _ as __unplugin_components_0 } from "./ValaxyMain-26e77dc6.js";
|
|
3
|
-
import { provide, mergeProps, withCtx, createTextVNode, createVNode, createCommentVNode, renderSlot, useSSRContext } from "vue";
|
|
4
|
-
import { useRoute } from "vue-router";
|
|
5
|
-
import { ssrRenderComponent, ssrRenderStyle, ssrRenderSlot } from "vue/server-renderer";
|
|
6
|
-
import "vite-ssg";
|
|
7
|
-
import "pinia";
|
|
8
|
-
import "@vueuse/core";
|
|
9
|
-
import "dayjs";
|
|
10
|
-
import "dayjs/plugin/utc.js";
|
|
11
|
-
import "dayjs/plugin/timezone.js";
|
|
12
|
-
import "dayjs/locale/zh-cn.js";
|
|
13
|
-
import "body-scroll-lock";
|
|
14
|
-
import "@intlify/shared";
|
|
15
|
-
import "@intlify/core-base";
|
|
16
|
-
import "@vue/devtools-api";
|
|
17
|
-
import "@unhead/schema-org";
|
|
18
|
-
import "@unhead/vue";
|
|
19
|
-
import "dayjs/plugin/relativeTime.js";
|
|
20
|
-
import "defu";
|
|
21
|
-
import "nprogress";
|
|
22
|
-
import "medium-zoom";
|
|
23
|
-
import "vanilla-lazyload";
|
|
24
|
-
const __pageData = JSON.parse('{"title":"How to realize CSS i18n?","description":"","frontmatter":{"title":"How to realize CSS i18n?","title_zh-CN":"如何实现 CSS i18n?","date":"2022-04-09T00:00:00.000Z","categories":"Valaxy 开发笔记","tags":["valaxy","i18n","笔记"],"end":true},"headers":[{"level":2,"title":"Vue-i18n","slug":"vue-i18n","link":"#vue-i18n","children":[{"level":3,"title":"Messages when SSG","slug":"messages-when-ssg","link":"#messages-when-ssg","children":[]}]},{"level":2,"title":"CSS i18n - Another solution","slug":"css-i18n-another-solution","link":"#css-i18n-another-solution","children":[{"level":3,"title":"Result","slug":"result","link":"#result","children":[]},{"level":3,"title":"Steps","slug":"steps","link":"#steps","children":[]}]}],"relativePath":"pages/posts/i18n.md","path":"C:\\\\Users\\\\me\\\\repos\\\\yyj\\\\valaxy\\\\docs\\\\pages\\\\posts\\\\i18n.md","lastUpdated":1696263339000}');
|
|
25
|
-
const data = JSON.parse('{"title":"How to realize CSS i18n?","description":"","frontmatter":{"title":"How to realize CSS i18n?","title_zh-CN":"如何实现 CSS i18n?","date":"2022-04-09T00:00:00.000Z","categories":"Valaxy 开发笔记","tags":["valaxy","i18n","笔记"],"end":true},"headers":[{"level":2,"title":"Vue-i18n","slug":"vue-i18n","link":"#vue-i18n","children":[{"level":3,"title":"Messages when SSG","slug":"messages-when-ssg","link":"#messages-when-ssg","children":[]}]},{"level":2,"title":"CSS i18n - Another solution","slug":"css-i18n-another-solution","link":"#css-i18n-another-solution","children":[{"level":3,"title":"Result","slug":"result","link":"#result","children":[]},{"level":3,"title":"Steps","slug":"steps","link":"#steps","children":[]}]}],"relativePath":"pages/posts/i18n.md","path":"C:\\\\Users\\\\me\\\\repos\\\\yyj\\\\valaxy\\\\docs\\\\pages\\\\posts\\\\i18n.md","lastUpdated":1696263339000}');
|
|
26
|
-
const _sfc_main = {
|
|
27
|
-
name: "pages/posts/i18n.md",
|
|
28
|
-
data() {
|
|
29
|
-
return { data, frontmatter: data.frontmatter, $frontmatter: data.frontmatter };
|
|
30
|
-
},
|
|
31
|
-
setup() {
|
|
32
|
-
const route = useRoute();
|
|
33
|
-
route.meta.frontmatter = Object.assign(route.meta.frontmatter, data.frontmatter);
|
|
34
|
-
provide("pageData", data);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
|
|
38
|
-
const _component_ValaxyMain = __unplugin_components_0;
|
|
39
|
-
const _component_PressToggleLocale = _sfc_main$1;
|
|
40
|
-
const _component_AppLink = _sfc_main$2;
|
|
41
|
-
_push(ssrRenderComponent(_component_ValaxyMain, mergeProps({
|
|
42
|
-
frontmatter: $data.frontmatter,
|
|
43
|
-
data: $data.data
|
|
44
|
-
}, _attrs), {
|
|
45
|
-
"main-content-md": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
46
|
-
if (_push2) {
|
|
47
|
-
_push2(`<div class="tip custom-block"${_scopeId}><p class="custom-block-title"${_scopeId}><i class="icon i-carbon-thumbs-up"${_scopeId}></i><span lang="en"${_scopeId}>TIP</span><span lang="zh-CN"${_scopeId}>提示</span></p><p${_scopeId}>You can click this button to toggle locales.</p></div><div class="text-center"${_scopeId}>`);
|
|
48
|
-
_push2(ssrRenderComponent(_component_PressToggleLocale, { class: "btn shadow" }, null, _parent2, _scopeId));
|
|
49
|
-
_push2(`</div><div lang="zh-CN"${_scopeId}><blockquote${_scopeId}><p${_scopeId}>在一个页面中实现 i18n</p></blockquote><p${_scopeId}>为了使 `);
|
|
50
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
51
|
-
href: "https://github.com/YunYouJun/valaxy",
|
|
52
|
-
target: "_blank",
|
|
53
|
-
rel: "noreferrer"
|
|
54
|
-
}, {
|
|
55
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
56
|
-
if (_push3) {
|
|
57
|
-
_push3(`Valaxy`);
|
|
58
|
-
} else {
|
|
59
|
-
return [
|
|
60
|
-
createTextVNode("Valaxy")
|
|
61
|
-
];
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
_: 1
|
|
65
|
-
/* STABLE */
|
|
66
|
-
}, _parent2, _scopeId));
|
|
67
|
-
_push2(` 成为一个国际化的项目,i18n 是必不可少的。</p><p${_scopeId}>常见的 i18n 方案为采用不同的路径(如 <code${_scopeId}>/zh-CN/</code>)或解析不同的域名(<code${_scopeId}>cn.xxx.xxx</code>)来分别维护。</p><blockquote${_scopeId}><p${_scopeId}>此外还可使用 `);
|
|
68
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
69
|
-
href: "https://crowdin.com/",
|
|
70
|
-
target: "_blank",
|
|
71
|
-
rel: "noreferrer"
|
|
72
|
-
}, {
|
|
73
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
74
|
-
if (_push3) {
|
|
75
|
-
_push3(`crowdin`);
|
|
76
|
-
} else {
|
|
77
|
-
return [
|
|
78
|
-
createTextVNode("crowdin")
|
|
79
|
-
];
|
|
80
|
-
}
|
|
81
|
-
}),
|
|
82
|
-
_: 1
|
|
83
|
-
/* STABLE */
|
|
84
|
-
}, _parent2, _scopeId));
|
|
85
|
-
_push2(` 平台辅助用户进行多语言翻译。</p></blockquote><p${_scopeId}>但对于博客来说,这显然都很麻烦。 当你需要 i18n 时,你不得不同时维护多个目录下的文章。<br${_scopeId}> 当文章间存在相同的示例时,你还需要维护相同的内容。非常不优雅。</p><p${_scopeId}>Valaxy 中, 站点的独立字段部分(如文章目录:Table of Contents)基于 `);
|
|
86
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
87
|
-
href: "https://vue-i18n.intlify.dev/",
|
|
88
|
-
target: "_blank",
|
|
89
|
-
rel: "noreferrer"
|
|
90
|
-
}, {
|
|
91
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
92
|
-
if (_push3) {
|
|
93
|
-
_push3(`vue-i18n`);
|
|
94
|
-
} else {
|
|
95
|
-
return [
|
|
96
|
-
createTextVNode("vue-i18n")
|
|
97
|
-
];
|
|
98
|
-
}
|
|
99
|
-
}),
|
|
100
|
-
_: 1
|
|
101
|
-
/* STABLE */
|
|
102
|
-
}, _parent2, _scopeId));
|
|
103
|
-
_push2(` 实现, 而文章内容部分的大段文本则采用另一种 CSS i18n 的方案。</p><p${_scopeId}>`);
|
|
104
|
-
_push2(ssrRenderComponent(_component_AppLink, { href: "#result" }, {
|
|
105
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
106
|
-
if (_push3) {
|
|
107
|
-
_push3(`我想先看看效果`);
|
|
108
|
-
} else {
|
|
109
|
-
return [
|
|
110
|
-
createTextVNode("我想先看看效果")
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
}),
|
|
114
|
-
_: 1
|
|
115
|
-
/* STABLE */
|
|
116
|
-
}, _parent2, _scopeId));
|
|
117
|
-
_push2(`</p></div><!-- more --><div lang="en"${_scopeId}><blockquote${_scopeId}><p${_scopeId}><strong${_scopeId}>i18n in One Page</strong></p></blockquote><p${_scopeId}>In order to make `);
|
|
118
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
119
|
-
href: "https://github.com/YunYouJun/valaxy",
|
|
120
|
-
target: "_blank",
|
|
121
|
-
rel: "noreferrer"
|
|
122
|
-
}, {
|
|
123
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
124
|
-
if (_push3) {
|
|
125
|
-
_push3(`Valaxy`);
|
|
126
|
-
} else {
|
|
127
|
-
return [
|
|
128
|
-
createTextVNode("Valaxy")
|
|
129
|
-
];
|
|
130
|
-
}
|
|
131
|
-
}),
|
|
132
|
-
_: 1
|
|
133
|
-
/* STABLE */
|
|
134
|
-
}, _parent2, _scopeId));
|
|
135
|
-
_push2(` an international project, i18n is essential.</p><p${_scopeId}>Common i18n schemes are maintained separately using different paths (e.g. <code${_scopeId}>/zh-CN/</code>) or resolving different domain names (<code${_scopeId}>cn.xxx.xxx</code>).</p><blockquote${_scopeId}><p${_scopeId}>In addition, the `);
|
|
136
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
137
|
-
href: "https://crowdin.com/",
|
|
138
|
-
target: "_blank",
|
|
139
|
-
rel: "noreferrer"
|
|
140
|
-
}, {
|
|
141
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
142
|
-
if (_push3) {
|
|
143
|
-
_push3(`crowdin`);
|
|
144
|
-
} else {
|
|
145
|
-
return [
|
|
146
|
-
createTextVNode("crowdin")
|
|
147
|
-
];
|
|
148
|
-
}
|
|
149
|
-
}),
|
|
150
|
-
_: 1
|
|
151
|
-
/* STABLE */
|
|
152
|
-
}, _parent2, _scopeId));
|
|
153
|
-
_push2(` platform can be used to assist users with multilingual translations.</p></blockquote><p${_scopeId}>But for blogs, this is obviously all a hassle. When you need i18n, you have to maintain articles in multiple directories at the same time.<br${_scopeId}> You also have to maintain the same content when the same examples exist between articles. Very inelegant.</p><p${_scopeId}>In Valaxy, the The standalone fields of the site (e.g. Table of Contents) are implemented based on `);
|
|
154
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
155
|
-
href: "https://vue-i18n.intlify.dev/",
|
|
156
|
-
target: "_blank",
|
|
157
|
-
rel: "noreferrer"
|
|
158
|
-
}, {
|
|
159
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
160
|
-
if (_push3) {
|
|
161
|
-
_push3(`vue-i18n`);
|
|
162
|
-
} else {
|
|
163
|
-
return [
|
|
164
|
-
createTextVNode("vue-i18n")
|
|
165
|
-
];
|
|
166
|
-
}
|
|
167
|
-
}),
|
|
168
|
-
_: 1
|
|
169
|
-
/* STABLE */
|
|
170
|
-
}, _parent2, _scopeId));
|
|
171
|
-
_push2(`. The large text sections of the article content section use a different CSS i18n scheme.</p><p${_scopeId}>`);
|
|
172
|
-
_push2(ssrRenderComponent(_component_AppLink, { href: "#result" }, {
|
|
173
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
174
|
-
if (_push3) {
|
|
175
|
-
_push3(`I want to see the result first.`);
|
|
176
|
-
} else {
|
|
177
|
-
return [
|
|
178
|
-
createTextVNode("I want to see the result first.")
|
|
179
|
-
];
|
|
180
|
-
}
|
|
181
|
-
}),
|
|
182
|
-
_: 1
|
|
183
|
-
/* STABLE */
|
|
184
|
-
}, _parent2, _scopeId));
|
|
185
|
-
_push2(`</p></div><h2 id="vue-i18n" tabindex="-1"${_scopeId}>Vue-i18n `);
|
|
186
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
187
|
-
class: "header-anchor",
|
|
188
|
-
href: "#vue-i18n",
|
|
189
|
-
"aria-label": 'Permalink to "Vue-i18n"'
|
|
190
|
-
}, {
|
|
191
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
192
|
-
if (_push3) {
|
|
193
|
-
_push3(``);
|
|
194
|
-
} else {
|
|
195
|
-
return [
|
|
196
|
-
createTextVNode("")
|
|
197
|
-
];
|
|
198
|
-
}
|
|
199
|
-
}),
|
|
200
|
-
_: 1
|
|
201
|
-
/* STABLE */
|
|
202
|
-
}, _parent2, _scopeId));
|
|
203
|
-
_push2(`</h2><div lang="zh-CN"${_scopeId}><p${_scopeId}>配置 Vite Vue-i18n 插件 `);
|
|
204
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
205
|
-
href: "https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n",
|
|
206
|
-
target: "_blank",
|
|
207
|
-
rel: "noreferrer"
|
|
208
|
-
}, {
|
|
209
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
210
|
-
if (_push3) {
|
|
211
|
-
_push3(`@intlify/unplugin-vue-i18n`);
|
|
212
|
-
} else {
|
|
213
|
-
return [
|
|
214
|
-
createTextVNode("@intlify/unplugin-vue-i18n")
|
|
215
|
-
];
|
|
216
|
-
}
|
|
217
|
-
}),
|
|
218
|
-
_: 1
|
|
219
|
-
/* STABLE */
|
|
220
|
-
}, _parent2, _scopeId));
|
|
221
|
-
_push2(`:</p></div><div lang="en"${_scopeId}><p${_scopeId}>Config Vite Vue-i18n plugin `);
|
|
222
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
223
|
-
href: "https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n",
|
|
224
|
-
target: "_blank",
|
|
225
|
-
rel: "noreferrer"
|
|
226
|
-
}, {
|
|
227
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
228
|
-
if (_push3) {
|
|
229
|
-
_push3(`@intlify/unplugin-vue-i18n`);
|
|
230
|
-
} else {
|
|
231
|
-
return [
|
|
232
|
-
createTextVNode("@intlify/unplugin-vue-i18n")
|
|
233
|
-
];
|
|
234
|
-
}
|
|
235
|
-
}),
|
|
236
|
-
_: 1
|
|
237
|
-
/* STABLE */
|
|
238
|
-
}, _parent2, _scopeId));
|
|
239
|
-
_push2(`:</p></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> path </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'node:path'</span></span>
|
|
240
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> { defineConfig } </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'vite'</span></span>
|
|
241
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> VueI18n </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'@intlify/unplugin-vue-i18n/vite'</span></span>
|
|
242
|
-
<span class="line"${_scopeId}></span>
|
|
243
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>export</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>default</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>defineConfig</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>({</span></span>
|
|
244
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> plugins: [</span></span>
|
|
245
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>VueI18n</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>({</span></span>
|
|
246
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> runtimeOnly: </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>true</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
247
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> compositionOnly: </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>true</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
248
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> include: [path.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>resolve</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(__dirname, </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'locales/**'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)],</span></span>
|
|
249
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }),</span></span>
|
|
250
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> ],</span></span>
|
|
251
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>})</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> path </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'node:path'</span></span>
|
|
252
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> { defineConfig } </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'vite'</span></span>
|
|
253
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> VueI18n </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'@intlify/unplugin-vue-i18n/vite'</span></span>
|
|
254
|
-
<span class="line"${_scopeId}></span>
|
|
255
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>export</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>default</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>defineConfig</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>({</span></span>
|
|
256
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> plugins: [</span></span>
|
|
257
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>VueI18n</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>({</span></span>
|
|
258
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> runtimeOnly: </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>true</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
259
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> compositionOnly: </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>true</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
260
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> include: [path.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>resolve</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(__dirname, </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'locales/**'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)],</span></span>
|
|
261
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }),</span></span>
|
|
262
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> ],</span></span>
|
|
263
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>})</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>在 <code${_scopeId}>locales</code> 目录下配置 <code${_scopeId}>zh-CN.yml</code> 与 <code${_scopeId}>en.yml</code>:</p></div><div lang="en"${_scopeId}><p${_scopeId}>Write <code${_scopeId}>zh-CN.yml</code> and <code${_scopeId}>en.yml</code> in <code${_scopeId}>locales</code>.</p></div><div class="language-yaml"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>yaml</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}># zh-CN.yml</span></span>
|
|
264
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>sidebar</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:</span></span>
|
|
265
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>toc</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>文章目录</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}># zh-CN.yml</span></span>
|
|
266
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>sidebar</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:</span></span>
|
|
267
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>toc</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>文章目录</span></span></code></pre></div><div class="language-yaml"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>yaml</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}># en.yml</span></span>
|
|
268
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>sidebar</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:</span></span>
|
|
269
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>toc</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>Table of Contents</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}># en.yml</span></span>
|
|
270
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>sidebar</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:</span></span>
|
|
271
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>toc</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>Table of Contents</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>并在主入口文件(如 <code${_scopeId}>main.ts</code>)中初始化:</p></div><div lang="en"${_scopeId}><p${_scopeId}>and initialized in the main entry file (e.g. <code${_scopeId}>main.ts</code>).</p></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> { createI18n } </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'vue-i18n'</span></span>
|
|
272
|
-
<span class="line"${_scopeId}></span>
|
|
273
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// import { createApp } from 'vue'</span></span>
|
|
274
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// import App from './App.vue'</span></span>
|
|
275
|
-
<span class="line"${_scopeId}></span>
|
|
276
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>/*</span></span>
|
|
277
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}> * All i18n resources specified in the plugin \`include\` option can be loaded</span></span>
|
|
278
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}> * at once using the import syntax</span></span>
|
|
279
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}> */</span></span>
|
|
280
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> messages </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'@intlify/unplugin-vue-i18n/messages'</span></span>
|
|
281
|
-
<span class="line"${_scopeId}></span>
|
|
282
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>i18n</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>createI18n</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>({</span></span>
|
|
283
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> legacy: </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>false</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
284
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> locale: </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
285
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> messages,</span></span>
|
|
286
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>})</span></span>
|
|
287
|
-
<span class="line"${_scopeId}></span>
|
|
288
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// const app = createApp(App)</span></span>
|
|
289
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>app.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>use</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(i18n)</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> { createI18n } </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'vue-i18n'</span></span>
|
|
290
|
-
<span class="line"${_scopeId}></span>
|
|
291
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// import { createApp } from 'vue'</span></span>
|
|
292
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// import App from './App.vue'</span></span>
|
|
293
|
-
<span class="line"${_scopeId}></span>
|
|
294
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>/*</span></span>
|
|
295
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}> * All i18n resources specified in the plugin \`include\` option can be loaded</span></span>
|
|
296
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}> * at once using the import syntax</span></span>
|
|
297
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}> */</span></span>
|
|
298
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> messages </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'@intlify/unplugin-vue-i18n/messages'</span></span>
|
|
299
|
-
<span class="line"${_scopeId}></span>
|
|
300
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>i18n</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>createI18n</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>({</span></span>
|
|
301
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> legacy: </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>false</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
302
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> locale: </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
303
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> messages,</span></span>
|
|
304
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>})</span></span>
|
|
305
|
-
<span class="line"${_scopeId}></span>
|
|
306
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// const app = createApp(App)</span></span>
|
|
307
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>app.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>use</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(i18n)</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>此时即可在 Vue 中使用 <code${_scopeId}>t('')</code> 来翻译对应字段文本。</p></div><div lang="en"${_scopeId}><p${_scopeId}>You can then use <code${_scopeId}>t('')</code> in Vue to translate the text of the corresponding field.</p></div><div class="language-vue"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>vue</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"ts"</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>setup</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
308
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> { useI18n } </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'vue-i18n'</span></span>
|
|
309
|
-
<span class="line"${_scopeId}></span>
|
|
310
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> { </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>t</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> } </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>useI18n</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>()</span></span>
|
|
311
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
312
|
-
<span class="line"${_scopeId}></span>
|
|
313
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>template</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
314
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> <</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>h2</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>> {{ t("sidebar.toc") }} </</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>h2</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
315
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>template</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"ts"</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>setup</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
316
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> { useI18n } </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'vue-i18n'</span></span>
|
|
317
|
-
<span class="line"${_scopeId}></span>
|
|
318
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> { </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>t</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> } </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>useI18n</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>()</span></span>
|
|
319
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
320
|
-
<span class="line"${_scopeId}></span>
|
|
321
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>template</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
322
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> <</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>h2</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>> {{ t("sidebar.toc") }} </</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>h2</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
323
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>template</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span></code></pre></div><h3 id="messages-when-ssg" tabindex="-1"${_scopeId}>Messages when SSG `);
|
|
324
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
325
|
-
class: "header-anchor",
|
|
326
|
-
href: "#messages-when-ssg",
|
|
327
|
-
"aria-label": 'Permalink to "Messages when SSG"'
|
|
328
|
-
}, {
|
|
329
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
330
|
-
if (_push3) {
|
|
331
|
-
_push3(``);
|
|
332
|
-
} else {
|
|
333
|
-
return [
|
|
334
|
-
createTextVNode("")
|
|
335
|
-
];
|
|
336
|
-
}
|
|
337
|
-
}),
|
|
338
|
-
_: 1
|
|
339
|
-
/* STABLE */
|
|
340
|
-
}, _parent2, _scopeId));
|
|
341
|
-
_push2(`</h3><div lang="zh-CN"${_scopeId}><p${_scopeId}><code${_scopeId}>vue-i18n</code> 支持使用虚拟模块 <code${_scopeId}>@intlify/unplugin-vue-i18n/messages</code> 的方式来导入多语言。</p><p${_scopeId}>可惜的是,它并没有完美地支持 SSR。`);
|
|
342
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
343
|
-
href: "https://github.com/intlify/bundle-tools/issues/78",
|
|
344
|
-
target: "_blank",
|
|
345
|
-
rel: "noreferrer"
|
|
346
|
-
}, {
|
|
347
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
348
|
-
if (_push3) {
|
|
349
|
-
_push3(`#78 | intlify/bundle-tools`);
|
|
350
|
-
} else {
|
|
351
|
-
return [
|
|
352
|
-
createTextVNode("#78 | intlify/bundle-tools")
|
|
353
|
-
];
|
|
354
|
-
}
|
|
355
|
-
}),
|
|
356
|
-
_: 1
|
|
357
|
-
/* STABLE */
|
|
358
|
-
}, _parent2, _scopeId));
|
|
359
|
-
_push2(`</p><p${_scopeId}>而 Vite 的 <code${_scopeId}>i<wbr${_scopeId}>mport.meta.globEager</code> 导入必须使用静态字符串。</p></div><div lang="en"${_scopeId}><p${_scopeId}><code${_scopeId}>vue-i18n</code> supports importing multiple languages by using the virtual module <code${_scopeId}>@intlify/unplugin-vue-i18n/messages</code>.</p><p${_scopeId}>Unfortunately, it doesn't support SSR perfectly.`);
|
|
360
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
361
|
-
href: "https://github.com/intlify/bundle-tools/issues/78",
|
|
362
|
-
target: "_blank",
|
|
363
|
-
rel: "noreferrer"
|
|
364
|
-
}, {
|
|
365
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
366
|
-
if (_push3) {
|
|
367
|
-
_push3(`#78 | intlify/bundle-tools`);
|
|
368
|
-
} else {
|
|
369
|
-
return [
|
|
370
|
-
createTextVNode("#78 | intlify/bundle-tools")
|
|
371
|
-
];
|
|
372
|
-
}
|
|
373
|
-
}),
|
|
374
|
-
_: 1
|
|
375
|
-
/* STABLE */
|
|
376
|
-
}, _parent2, _scopeId));
|
|
377
|
-
_push2(`</p><p${_scopeId}>And Vite's <code${_scopeId}>i<wbr${_scopeId}>mport.meta.globEager</code> import must use a static string.</p></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark has-highlighted-lines vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>messages</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> Object.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>fromEntries</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span></span>
|
|
378
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> Object.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>entries</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span></span>
|
|
379
|
-
<span class="line highlighted"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>.</span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>meta</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>globEager</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'../../locales/*.y(a)?ml'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
380
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> )</span></span>
|
|
381
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> .</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>map</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(([</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>key</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>value</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>]) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
382
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>yaml</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> key.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>endsWith</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'.yaml'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
383
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> [key.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>slice</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>14</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, yaml </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>?</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>-</span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>5</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>-</span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>4</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>), value.default]</span></span>
|
|
384
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }),</span></span>
|
|
385
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span></code></pre><pre class="shiki github-light has-highlighted-lines vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>messages</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> Object.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>fromEntries</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span></span>
|
|
386
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> Object.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>entries</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span></span>
|
|
387
|
-
<span class="line highlighted"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>.</span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>meta</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>globEager</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'../../locales/*.y(a)?ml'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
388
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> )</span></span>
|
|
389
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> .</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>map</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(([</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>key</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>value</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>]) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
390
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>yaml</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> key.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>endsWith</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'.yaml'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
391
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> [key.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>slice</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>14</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, yaml </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>?</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>-</span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>5</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>-</span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>4</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>), value.default]</span></span>
|
|
392
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }),</span></span>
|
|
393
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>当拥有确定目录时,它是奏效的,但 Valaxy 还需要将 Valaxy 自身的 <code${_scopeId}>locales</code> 与主题的 <code${_scopeId}>locales</code> 以及用户自定义的 <code${_scopeId}>locales</code> 进行合并。 这意味着我们不能使用变量来拼接字符串进行导入,对于不同包管理器的目录结构不同,我们很难确定这些 <code${_scopeId}>locales</code> 处于何处的相对位置。</p><p${_scopeId}>因此我采用插件虚拟模块(<code${_scopeId}>@valaxyjs/locales</code>)的形式实现(依次导入各目录下的 locales 数据并合并):</p><blockquote${_scopeId}><p${_scopeId}>Vite 虚拟模块的原理其实就是拼接字符串。</p></blockquote></div><div lang="en"${_scopeId}><p${_scopeId}>It works when there is a defined directory, but Valaxy also needs to merge Valaxy's own <code${_scopeId}>locales</code> with the theme's <code${_scopeId}>locales</code> and user-defined <code${_scopeId}>locales</code>. This means that we cannot use variables to splice strings for import, and it is difficult to determine the relative location of where these <code${_scopeId}>locales</code> are for different package managers with different directory structures.</p><p${_scopeId}>So I implemented it in the form of a plugin virtual module (<code${_scopeId}>@valaxyjs/locales</code>):</p><blockquote${_scopeId}><p${_scopeId}>The principle of the Vite virtual module is actually a spliced string.</p></blockquote></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>type</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> { Plugin } </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'vite'</span></span>
|
|
394
|
-
<span class="line"${_scopeId}></span>
|
|
395
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// import the locales data in each directory in turn and merge them</span></span>
|
|
396
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>generateLocales</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>roots</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>string</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[]) {</span></span>
|
|
397
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>imports</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>string</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[] </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> [</span></span>
|
|
398
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'const messages = { "zh-CN": {}, en: {} }'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
399
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> ]</span></span>
|
|
400
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>languages</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> [</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'zh-CN'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>]</span></span>
|
|
401
|
-
<span class="line"${_scopeId}></span>
|
|
402
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> roots.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>forEach</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>((</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>root</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>i</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
403
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> languages.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>forEach</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>((</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
404
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>langYml</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>\`\${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>root</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>}/locales/\${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>}.yml\`</span></span>
|
|
405
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>if</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> (fs.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>existsSync</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(langYml) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>&&</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> fs.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>readFileSync</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(langYml, </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'utf-8'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)) {</span></span>
|
|
406
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>varName</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> lang.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>replace</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'-'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>''</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>+</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> i</span></span>
|
|
407
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// in windows, you need to change slash</span></span>
|
|
408
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// more info you can refer 'packages/valaxy/src/node/plugins/index.ts'</span></span>
|
|
409
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>push</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>\`import \${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>varName</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>} from "\${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>langYml</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>}"\`</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
410
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>push</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>\`Object.assign(messages['\${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>}'], \${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>varName</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>})\`</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
411
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
412
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> })</span></span>
|
|
413
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> })</span></span>
|
|
414
|
-
<span class="line"${_scopeId}></span>
|
|
415
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>push</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'export default messages'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
416
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>join</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'</span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>\\n</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
417
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>}</span></span>
|
|
418
|
-
<span class="line"${_scopeId}></span>
|
|
419
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>export</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>createValaxyPlugin</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>options</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>ResolvedValaxyOptions</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>Plugin</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
420
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
421
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>roots</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> [options.clientRoot, options.themeRoot, options.userRoot]</span></span>
|
|
422
|
-
<span class="line"${_scopeId}></span>
|
|
423
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
424
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> name: </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'Valaxy'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
425
|
-
<span class="line"${_scopeId}></span>
|
|
426
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>load</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>id</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) {</span></span>
|
|
427
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
428
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>if</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> (id </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>===</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'/@valaxyjs/locales'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>)</span></span>
|
|
429
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>generateLocales</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(roots)</span></span>
|
|
430
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> },</span></span>
|
|
431
|
-
<span class="line"${_scopeId}></span>
|
|
432
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>async</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>handleHotUpdate</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>ctx</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) {</span></span>
|
|
433
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
434
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> },</span></span>
|
|
435
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
436
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>}</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>type</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> { Plugin } </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'vite'</span></span>
|
|
437
|
-
<span class="line"${_scopeId}></span>
|
|
438
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// import the locales data in each directory in turn and merge them</span></span>
|
|
439
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>generateLocales</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>roots</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>string</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[]) {</span></span>
|
|
440
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>imports</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>string</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[] </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> [</span></span>
|
|
441
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'const messages = { "zh-CN": {}, en: {} }'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
442
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> ]</span></span>
|
|
443
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>languages</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> [</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'zh-CN'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>]</span></span>
|
|
444
|
-
<span class="line"${_scopeId}></span>
|
|
445
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> roots.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>forEach</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>((</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>root</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>i</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
446
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> languages.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>forEach</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>((</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
447
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>langYml</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>\`\${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>root</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>}/locales/\${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>}.yml\`</span></span>
|
|
448
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>if</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> (fs.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>existsSync</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(langYml) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>&&</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> fs.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>readFileSync</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(langYml, </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'utf-8'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)) {</span></span>
|
|
449
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>varName</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> lang.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>replace</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'-'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>''</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>+</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> i</span></span>
|
|
450
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// in windows, you need to change slash</span></span>
|
|
451
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// more info you can refer 'packages/valaxy/src/node/plugins/index.ts'</span></span>
|
|
452
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>push</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>\`import \${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>varName</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>} from "\${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>langYml</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>}"\`</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
453
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>push</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>\`Object.assign(messages['\${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>}'], \${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>varName</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>})\`</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
454
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
455
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> })</span></span>
|
|
456
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> })</span></span>
|
|
457
|
-
<span class="line"${_scopeId}></span>
|
|
458
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>push</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'export default messages'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
459
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> imports.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>join</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'</span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>\\n</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
460
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>}</span></span>
|
|
461
|
-
<span class="line"${_scopeId}></span>
|
|
462
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>export</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>createValaxyPlugin</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>options</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>ResolvedValaxyOptions</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>Plugin</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
463
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
464
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>roots</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> [options.clientRoot, options.themeRoot, options.userRoot]</span></span>
|
|
465
|
-
<span class="line"${_scopeId}></span>
|
|
466
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
467
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> name: </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'Valaxy'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
468
|
-
<span class="line"${_scopeId}></span>
|
|
469
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>load</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>id</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) {</span></span>
|
|
470
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
471
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>if</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> (id </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>===</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'/@valaxyjs/locales'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>)</span></span>
|
|
472
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>return</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>generateLocales</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(roots)</span></span>
|
|
473
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> },</span></span>
|
|
474
|
-
<span class="line"${_scopeId}></span>
|
|
475
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>async</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>handleHotUpdate</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>ctx</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) {</span></span>
|
|
476
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
477
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> },</span></span>
|
|
478
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
479
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>}</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>最后在 i18n 的初始化文件加载:</p></div><div lang="en"${_scopeId}><p${_scopeId}>Finally load in the i18n initialization file:</p></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// i18n.ts</span></span>
|
|
480
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> messages </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'/@valaxyjs/locales'</span></span>
|
|
481
|
-
<span class="line"${_scopeId}></span>
|
|
482
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>i18n</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>createI18n</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>({</span></span>
|
|
483
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> legacy: </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>false</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
484
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> locale: </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
485
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> messages,</span></span>
|
|
486
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>})</span></span>
|
|
487
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>app.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>use</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(i18n)</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// i18n.ts</span></span>
|
|
488
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>import</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> messages </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>from</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'/@valaxyjs/locales'</span></span>
|
|
489
|
-
<span class="line"${_scopeId}></span>
|
|
490
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>i18n</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>createI18n</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>({</span></span>
|
|
491
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> legacy: </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>false</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
492
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> locale: </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
493
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> messages,</span></span>
|
|
494
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>})</span></span>
|
|
495
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>app.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>use</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(i18n)</span></span></code></pre></div><h2 id="css-i18n-another-solution" tabindex="-1"${_scopeId}>CSS i18n - Another solution `);
|
|
496
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
497
|
-
class: "header-anchor",
|
|
498
|
-
href: "#css-i18n-another-solution",
|
|
499
|
-
"aria-label": 'Permalink to "CSS i18n - Another solution"'
|
|
500
|
-
}, {
|
|
501
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
502
|
-
if (_push3) {
|
|
503
|
-
_push3(``);
|
|
504
|
-
} else {
|
|
505
|
-
return [
|
|
506
|
-
createTextVNode("")
|
|
507
|
-
];
|
|
508
|
-
}
|
|
509
|
-
}),
|
|
510
|
-
_: 1
|
|
511
|
-
/* STABLE */
|
|
512
|
-
}, _parent2, _scopeId));
|
|
513
|
-
_push2(`</h2><div lang="zh-CN"${_scopeId}><blockquote${_scopeId}><p${_scopeId}>CSS i18n - 另一种互补解决方案</p></blockquote></div><div lang="en"${_scopeId}><blockquote${_scopeId}><p${_scopeId}>CSS i18n - Another complementary solution</p></blockquote></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>文章部分拥有大段的文本,而 <code${_scopeId}>vue-i18n</code> 的场景则在于一些独立的字段翻译。</p><p${_scopeId}>而传统的分文件独立管理的方式,对于博客来说其实并不方便。<br${_scopeId}> 大多数情况,你并不会想专门建立一个文件夹来管理它。</p><p${_scopeId}>因此我尝试使用纯 CSS 解决该问题。</p></div><div lang="en"${_scopeId}><p${_scopeId}>While the article section has large sections of text, the scenario of <code${_scopeId}>vue-i18n</code> lies in some separate field translations.</p><p${_scopeId}>And the traditional way of managing them independently in separate files is not really convenient for blogs.<br${_scopeId}> In most cases, you don't want to create a dedicated folder to manage it.</p><p${_scopeId}>So I tried to solve the problem using pure CSS.</p></div><div lang="zh-CN"${_scopeId}><div class="tip custom-block"${_scopeId}><p class="custom-block-title"${_scopeId}><i class="icon i-carbon-thumbs-up"${_scopeId}></i><span lang="en"${_scopeId}>思路</span><span lang="zh-CN"${_scopeId}>思路</span></p><p${_scopeId}>即借助 CSS 规则,根据对应语言,显示对应区块内容。<br${_scopeId}> 大体方案:通过 `);
|
|
514
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
515
|
-
href: "https://github.com/markdown-it/markdown-it-container",
|
|
516
|
-
target: "_blank",
|
|
517
|
-
rel: "noreferrer"
|
|
518
|
-
}, {
|
|
519
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
520
|
-
if (_push3) {
|
|
521
|
-
_push3(`markdown-it-container`);
|
|
522
|
-
} else {
|
|
523
|
-
return [
|
|
524
|
-
createTextVNode("markdown-it-container")
|
|
525
|
-
];
|
|
526
|
-
}
|
|
527
|
-
}),
|
|
528
|
-
_: 1
|
|
529
|
-
/* STABLE */
|
|
530
|
-
}, _parent2, _scopeId));
|
|
531
|
-
_push2(` 设置 fence 预编译 Markdown, 为需要进行 i18n 的段落包裹新的 <code${_scopeId}><div lang="zh-CN"></div></code>,并使用 CSS 默认隐藏它们。 当页面初始化或切换语言时,为 html 添加对应语言类,编写对应 CSS 以在该类下显示对应语言的区块。</p></div></div><div lang="en"${_scopeId}><div class="tip custom-block"${_scopeId}><p class="custom-block-title"${_scopeId}><i class="icon i-carbon-thumbs-up"${_scopeId}></i><span lang="en"${_scopeId}>IDEA</span><span lang="zh-CN"${_scopeId}>IDEA</span></p><p${_scopeId}>That is, with the help of CSS rules, the content of the corresponding block is displayed according to the corresponding language.<br${_scopeId}> The general solution: set fence to pre-compile Markdown via `);
|
|
532
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
533
|
-
href: "https://github.com/markdown-it/markdown-it-container",
|
|
534
|
-
target: "_blank",
|
|
535
|
-
rel: "noreferrer"
|
|
536
|
-
}, {
|
|
537
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
538
|
-
if (_push3) {
|
|
539
|
-
_push3(`markdown-it-container`);
|
|
540
|
-
} else {
|
|
541
|
-
return [
|
|
542
|
-
createTextVNode("markdown-it-container")
|
|
543
|
-
];
|
|
544
|
-
}
|
|
545
|
-
}),
|
|
546
|
-
_: 1
|
|
547
|
-
/* STABLE */
|
|
548
|
-
}, _parent2, _scopeId));
|
|
549
|
-
_push2(`. Wrap new <code${_scopeId}><div lang="zh-CN"></div></code>s for the paragraphs that need to be i18n and hide them by default with CSS. When the page initializes or switches languages, add the corresponding language class to html and write the corresponding CSS to display the corresponding language block under that class.</p></div></div><div lang="zh-CN"${_scopeId}><p${_scopeId}><strong${_scopeId}>优势</strong>:</p><ul${_scopeId}><li${_scopeId}>可在同一个 Markdown 文件中进行维护,书写便捷</li><li${_scopeId}>预加载与实时切换</li><li${_scopeId}>URL 不变,便于管理与分享,且切换无需刷新页面</li><li${_scopeId}>渐进式翻译(只翻译部分内容并可共用示例内容等)</li></ul><p${_scopeId}><strong${_scopeId}>劣势</strong>:</p><ul${_scopeId}><li${_scopeId}>多语言内容被渲染在同一页面中,增加冗余(但我觉得这微小的体积完全是可以接受的)</li></ul></div><div lang="en"${_scopeId}><p${_scopeId}><strong${_scopeId}>Advantages</strong>:</p><ul${_scopeId}><li${_scopeId}>Can be maintained in the same Markdown file, easy to write</li><li${_scopeId}>Pre-loading and real-time switching</li><li${_scopeId}>URLs remain unchanged, easy to manage and share, and switch without refreshing the page</li></ul><p${_scopeId}><strong${_scopeId}>Disadvantages</strong>:</p><ul${_scopeId}><li${_scopeId}>Multi-language content is rendered in the same page, adding redundancy (but I think the tiny size is perfectly acceptable)</li></ul></div><h3 id="result" tabindex="-1"${_scopeId}>Result `);
|
|
550
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
551
|
-
class: "header-anchor",
|
|
552
|
-
href: "#result",
|
|
553
|
-
"aria-label": 'Permalink to "Result"'
|
|
554
|
-
}, {
|
|
555
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
556
|
-
if (_push3) {
|
|
557
|
-
_push3(``);
|
|
558
|
-
} else {
|
|
559
|
-
return [
|
|
560
|
-
createTextVNode("")
|
|
561
|
-
];
|
|
562
|
-
}
|
|
563
|
-
}),
|
|
564
|
-
_: 1
|
|
565
|
-
/* STABLE */
|
|
566
|
-
}, _parent2, _scopeId));
|
|
567
|
-
_push2(`</h3><div lang="zh-CN"${_scopeId}><p${_scopeId}><strong${_scopeId}>效果如下</strong>(点击按钮切换):</p></div><div lang="en"${_scopeId}><p${_scopeId}><strong${_scopeId}>The effect is as follows</strong> (click the button to switch).</p></div>`);
|
|
568
|
-
_push2(ssrRenderComponent(_component_PressToggleLocale, { class: "shadow" }, null, _parent2, _scopeId));
|
|
569
|
-
_push2(`<div lang="zh-CN"${_scopeId}><p${_scopeId}>另一种 i18n 方案。</p><blockquote${_scopeId}><p${_scopeId}>更多内容:...</p></blockquote></div><div lang="en"${_scopeId}><p${_scopeId}>Another i18n method.</p><blockquote${_scopeId}><p${_scopeId}>More info...</p></blockquote></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>中文</p></div><div lang="en"${_scopeId}><p${_scopeId}>English</p></div><hr${_scopeId}><div lang="zh-CN"${_scopeId}><p${_scopeId}><strong${_scopeId}>书写方式</strong>如下:</p></div><div lang="en"${_scopeId}><p${_scopeId}><strong${_scopeId}>Written like this</strong>:</p></div><div class="language-md"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>md</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>::: zh-CN</span></span>
|
|
570
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>另一种 i18n 方案。</span></span>
|
|
571
|
-
<span class="line"${_scopeId}></span>
|
|
572
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>更多内容:...</span></span>
|
|
573
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:::</span></span>
|
|
574
|
-
<span class="line"${_scopeId}></span>
|
|
575
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>::: en</span></span>
|
|
576
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>Another i18n method.</span></span>
|
|
577
|
-
<span class="line"${_scopeId}></span>
|
|
578
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>More info...</span></span>
|
|
579
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:::</span></span>
|
|
580
|
-
<span class="line"${_scopeId}></span>
|
|
581
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>::: zh-CN</span></span>
|
|
582
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>中文</span></span>
|
|
583
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:::</span></span>
|
|
584
|
-
<span class="line"${_scopeId}></span>
|
|
585
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>::: en</span></span>
|
|
586
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>English</span></span>
|
|
587
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:::</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>::: zh-CN</span></span>
|
|
588
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>另一种 i18n 方案。</span></span>
|
|
589
|
-
<span class="line"${_scopeId}></span>
|
|
590
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>更多内容:...</span></span>
|
|
591
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:::</span></span>
|
|
592
|
-
<span class="line"${_scopeId}></span>
|
|
593
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>::: en</span></span>
|
|
594
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>Another i18n method.</span></span>
|
|
595
|
-
<span class="line"${_scopeId}></span>
|
|
596
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>More info...</span></span>
|
|
597
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:::</span></span>
|
|
598
|
-
<span class="line"${_scopeId}></span>
|
|
599
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>::: zh-CN</span></span>
|
|
600
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>中文</span></span>
|
|
601
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:::</span></span>
|
|
602
|
-
<span class="line"${_scopeId}></span>
|
|
603
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>::: en</span></span>
|
|
604
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>English</span></span>
|
|
605
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:::</span></span></code></pre></div><h3 id="steps" tabindex="-1"${_scopeId}>Steps `);
|
|
606
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
607
|
-
class: "header-anchor",
|
|
608
|
-
href: "#steps",
|
|
609
|
-
"aria-label": 'Permalink to "Steps"'
|
|
610
|
-
}, {
|
|
611
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
612
|
-
if (_push3) {
|
|
613
|
-
_push3(``);
|
|
614
|
-
} else {
|
|
615
|
-
return [
|
|
616
|
-
createTextVNode("")
|
|
617
|
-
];
|
|
618
|
-
}
|
|
619
|
-
}),
|
|
620
|
-
_: 1
|
|
621
|
-
/* STABLE */
|
|
622
|
-
}, _parent2, _scopeId));
|
|
623
|
-
_push2(`</h3><div lang="zh-CN"${_scopeId}><p${_scopeId}><strong${_scopeId}>实现步骤</strong></p></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>为了能够借助 CSS 处理 i18n,我们借助 markdown-it-container 的 fence 包裹 Markdown 中需要参与 i18n 的内容。</p></div><div lang="en"${_scopeId}><p${_scopeId}>To be able to handle i18n with CSS, we use markdown-it-container's fence to wrap Markdown content that needs to participate in i18n.</p></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>export</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>containerPlugin</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>md</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>MarkdownIt</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) {</span></span>
|
|
624
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
625
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>languages</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> [</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'zh-CN'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>]</span></span>
|
|
626
|
-
<span class="line"${_scopeId}></span>
|
|
627
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> languages.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>forEach</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>((</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
628
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> md.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>use</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(container, lang, {</span></span>
|
|
629
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>render</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>: (</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>tokens</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>Token</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[], </span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>idx</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>number</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> tokens[idx].nesting </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>===</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>1</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>?</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>\`<div lang="\${</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>}"></span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>\\n</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>\`</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'</div></span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>\\n</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>,</span></span>
|
|
630
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> })</span></span>
|
|
631
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> })</span></span>
|
|
632
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>}</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>export</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>containerPlugin</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>md</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>MarkdownIt</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) {</span></span>
|
|
633
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
634
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>languages</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> [</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'zh-CN'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'en'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>]</span></span>
|
|
635
|
-
<span class="line"${_scopeId}></span>
|
|
636
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> languages.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>forEach</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>((</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
637
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> md.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>use</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(container, lang, {</span></span>
|
|
638
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>render</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>: (</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>tokens</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>Token</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[], </span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>idx</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>number</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=></span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> tokens[idx].nesting </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>===</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>1</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>?</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>\`<div lang="\${</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>}"></span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>\\n</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>\`</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'</div></span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>\\n</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>,</span></span>
|
|
639
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> })</span></span>
|
|
640
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> })</span></span>
|
|
641
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>}</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>这可以使:</p></div><div lang="en"${_scopeId}><p${_scopeId}>This allows:</p></div><div class="language-md"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>md</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>::: zh-CN</span></span>
|
|
642
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>中文</span></span>
|
|
643
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>:::</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>::: zh-CN</span></span>
|
|
644
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>中文</span></span>
|
|
645
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>:::</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>变成 <code${_scopeId}><div lang="zh-CN"></div></code> 的形式。</p><blockquote${_scopeId}><p${_scopeId}>`);
|
|
646
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
647
|
-
href: "https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang",
|
|
648
|
-
target: "_blank",
|
|
649
|
-
rel: "noreferrer"
|
|
650
|
-
}, {
|
|
651
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
652
|
-
if (_push3) {
|
|
653
|
-
_push3(`lang`);
|
|
654
|
-
} else {
|
|
655
|
-
return [
|
|
656
|
-
createTextVNode("lang")
|
|
657
|
-
];
|
|
658
|
-
}
|
|
659
|
-
}),
|
|
660
|
-
_: 1
|
|
661
|
-
/* STABLE */
|
|
662
|
-
}, _parent2, _scopeId));
|
|
663
|
-
_push2(` 是 HTML 的一个标准字段。</p></blockquote><p${_scopeId}>为避免 class 命名冲突,我们可以采用 CSS attribute 的查询方式。</p><p${_scopeId}>首先将 i18n 全部隐藏:</p></div><div lang="en"${_scopeId}><p${_scopeId}>Be <code${_scopeId}><div lang="zh-CN"></div></code>.</p><blockquote${_scopeId}><p${_scopeId}>`);
|
|
664
|
-
_push2(ssrRenderComponent(_component_AppLink, {
|
|
665
|
-
href: "https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang",
|
|
666
|
-
target: "_blank",
|
|
667
|
-
rel: "noreferrer"
|
|
668
|
-
}, {
|
|
669
|
-
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
670
|
-
if (_push3) {
|
|
671
|
-
_push3(`lang`);
|
|
672
|
-
} else {
|
|
673
|
-
return [
|
|
674
|
-
createTextVNode("lang")
|
|
675
|
-
];
|
|
676
|
-
}
|
|
677
|
-
}),
|
|
678
|
-
_: 1
|
|
679
|
-
/* STABLE */
|
|
680
|
-
}, _parent2, _scopeId));
|
|
681
|
-
_push2(` is a standard field in HTML.</p></blockquote><p${_scopeId}>To avoid class naming conflicts, we can use the CSS attribute query.</p><p${_scopeId}>First, hide all i18n:</p></div><div class="language-scss"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>scss</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>] {</span></span>
|
|
682
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>.markdown-body</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
683
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>div</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>] {</span></span>
|
|
684
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>display</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>none</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>;</span></span>
|
|
685
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
686
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
687
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>}</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>] {</span></span>
|
|
688
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>.markdown-body</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
689
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>div</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>] {</span></span>
|
|
690
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>display</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>none</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>;</span></span>
|
|
691
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
692
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
693
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>}</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>编写 CSS/SCSS 规则,设定 html <code${_scopeId}>lang</code> 为对应语言时,显示对应语言的元素即可。</p></div><div lang="en"${_scopeId}><p${_scopeId}>Write CSS/SCSS rules and set html <code${_scopeId}>lang</code> to display elements in the corresponding language when it is the corresponding language.</p></div><div class="language-scss"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>scss</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>$languages</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>: zh</span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>-</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>CN, en;</span></span>
|
|
694
|
-
<span class="line"${_scopeId}></span>
|
|
695
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>@each</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>$lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>in</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>$languages</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
696
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>#{$lang}</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>] {</span></span>
|
|
697
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// only for markdown</span></span>
|
|
698
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>.markdown-body</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> {</span></span>
|
|
699
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>div</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>#{$lang}</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>] {</span></span>
|
|
700
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>display</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>block</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>;</span></span>
|
|
701
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
702
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
703
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> }</span></span>
|
|
704
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>}</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>$languages</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>: zh</span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>-</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>CN, en;</span></span>
|
|
705
|
-
<span class="line"${_scopeId}></span>
|
|
706
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>@each</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>$lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>in</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>$languages</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
707
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>#{$lang}</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>] {</span></span>
|
|
708
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// only for markdown</span></span>
|
|
709
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>.markdown-body</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> {</span></span>
|
|
710
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>div</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>[</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>#{$lang}</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>] {</span></span>
|
|
711
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>display</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>: </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>block</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>;</span></span>
|
|
712
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
713
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
714
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> }</span></span>
|
|
715
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>}</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>为了帮助用户记住自己的语言,还请不要忘记初始化。</p></div><div lang="en"${_scopeId}><p${_scopeId}>To help users remember their language, please also don't forget to initialize.</p></div><div class="language-html"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>html</span><pre class="shiki github-dark has-highlighted-lines vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}><!</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>DOCTYPE</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
716
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"en"</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>class</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>"i18n"</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
717
|
-
<span class="line"${_scopeId}></span>
|
|
718
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>head</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
719
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}><!-- ... --></span></span>
|
|
720
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> <</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
721
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> (</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>() {</span></span>
|
|
722
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#79B8FF" })}"${_scopeId}>locale</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> localStorage.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>getItem</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'valaxy-locale'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>||</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'en'</span></span>
|
|
723
|
-
<span class="line highlighted"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> document.documentElement.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>setAttribute</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'lang'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, locale)</span></span>
|
|
724
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> })()</span></span>
|
|
725
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
726
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>head</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
727
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>body</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>>...</</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>body</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span>
|
|
728
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#85E89D" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>></span></span></code></pre><pre class="shiki github-light has-highlighted-lines vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}><!</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>DOCTYPE</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
729
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"en"</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>class</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>"i18n"</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
730
|
-
<span class="line"${_scopeId}></span>
|
|
731
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>head</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
732
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}><!-- ... --></span></span>
|
|
733
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> <</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
734
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> (</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>() {</span></span>
|
|
735
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>const</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#005CC5" })}"${_scopeId}>locale</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>=</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> localStorage.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>getItem</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'valaxy-locale'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) </span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>||</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'en'</span></span>
|
|
736
|
-
<span class="line highlighted"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> document.documentElement.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>setAttribute</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'lang'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, locale)</span></span>
|
|
737
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> })()</span></span>
|
|
738
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>script</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
739
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>head</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
740
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}><</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>body</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>>...</</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>body</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span>
|
|
741
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}></</span><span style="${ssrRenderStyle({ "color": "#22863A" })}"${_scopeId}>html</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>></span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>切换语言时则可做如下处理:</p></div><div lang="en"${_scopeId}><p${_scopeId}>When switching languages, the following can be done.</p></div><div class="language-ts"${_scopeId}><button title="Copy Code" class="copy"${_scopeId}></button><span class="lang"${_scopeId}>ts</span><pre class="shiki github-dark vp-code-dark"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>toggleLocales</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#FFAB70" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#F97583" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>val</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>) {</span></span>
|
|
742
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
743
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// save locale</span></span>
|
|
744
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> localStorage.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>setItem</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'valaxy-locale'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, lang)</span></span>
|
|
745
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// set html lang</span></span>
|
|
746
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}> document.documentElement.</span><span style="${ssrRenderStyle({ "color": "#B392F0" })}"${_scopeId}>setAttribute</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#9ECBFF" })}"${_scopeId}>'lang'</span><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>, lang)</span></span>
|
|
747
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#E1E4E8" })}"${_scopeId}>}</span></span></code></pre><pre class="shiki github-light vp-code-light"${_scopeId}><code${_scopeId}><span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>function</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>toggleLocales</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#E36209" })}"${_scopeId}>lang</span><span style="${ssrRenderStyle({ "color": "#D73A49" })}"${_scopeId}>:</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>val</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>) {</span></span>
|
|
748
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// ...</span></span>
|
|
749
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// save locale</span></span>
|
|
750
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> localStorage.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>setItem</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'valaxy-locale'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, lang)</span></span>
|
|
751
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> </span><span style="${ssrRenderStyle({ "color": "#6A737D" })}"${_scopeId}>// set html lang</span></span>
|
|
752
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}> document.documentElement.</span><span style="${ssrRenderStyle({ "color": "#6F42C1" })}"${_scopeId}>setAttribute</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>(</span><span style="${ssrRenderStyle({ "color": "#032F62" })}"${_scopeId}>'lang'</span><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>, lang)</span></span>
|
|
753
|
-
<span class="line"${_scopeId}><span style="${ssrRenderStyle({ "color": "#24292E" })}"${_scopeId}>}</span></span></code></pre></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>值得一提的是,在查看 <code${_scopeId}>lang</code> 文档时,我意外地发现 <code${_scopeId}>:lang</code> 也是一种支持的选择器。 因此上述的 CSS 中 <code${_scopeId}>[lang="xxx"]</code> 也可以替换为 <code${_scopeId}>:lang(xxx)</code>。</p><p${_scopeId}>但是 <code${_scopeId}>:lang()</code> 也会命中默认语言的 <code${_scopeId}>div</code>(没有 lang 字段,但处于含有 lang 的标签中),因此为了安全,我们还是应该使用 class 的属性查询。</p></div><div lang="en"${_scopeId}><p${_scopeId}>It's worth mentioning that when looking at the <code${_scopeId}>lang</code> documentation, I accidentally found that <code${_scopeId}>:lang</code> is also a supported selector. So <code${_scopeId}>[lang="xxx"]</code> in the CSS above could also be replaced with <code${_scopeId}>:lang(xxx)</code>.</p><p${_scopeId}>However, <code${_scopeId}>:lang()</code> will also hit the default language <code${_scopeId}>div</code> (which has no lang field but is in a tag containing lang), so to be safe we should still use the class attribute query.</p></div><div lang="zh-CN"${_scopeId}><p${_scopeId}>我认为 vue-i18n 与 CSS i18n 的互补,可以非常好地解决单页内的 i18n 切换。 不妨一试?</p></div><div lang="en"${_scopeId}><p${_scopeId}>I think vue-i18n complements CSS i18n and could be a very good solution for i18n switching within a single page. Why not give it a try?</p></div>`);
|
|
754
|
-
} else {
|
|
755
|
-
return [
|
|
756
|
-
createVNode("div", { class: "tip custom-block" }, [
|
|
757
|
-
createVNode("p", { class: "custom-block-title" }, [
|
|
758
|
-
createVNode("i", { class: "icon i-carbon-thumbs-up" }),
|
|
759
|
-
createVNode("span", { lang: "en" }, "TIP"),
|
|
760
|
-
createVNode("span", { lang: "zh-CN" }, "提示")
|
|
761
|
-
]),
|
|
762
|
-
createVNode("p", null, "You can click this button to toggle locales.")
|
|
763
|
-
]),
|
|
764
|
-
createVNode("div", { class: "text-center" }, [
|
|
765
|
-
createVNode(_component_PressToggleLocale, { class: "btn shadow" })
|
|
766
|
-
]),
|
|
767
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
768
|
-
createVNode("blockquote", null, [
|
|
769
|
-
createVNode("p", null, "在一个页面中实现 i18n")
|
|
770
|
-
]),
|
|
771
|
-
createVNode("p", null, [
|
|
772
|
-
createTextVNode("为了使 "),
|
|
773
|
-
createVNode(_component_AppLink, {
|
|
774
|
-
href: "https://github.com/YunYouJun/valaxy",
|
|
775
|
-
target: "_blank",
|
|
776
|
-
rel: "noreferrer"
|
|
777
|
-
}, {
|
|
778
|
-
default: withCtx(() => [
|
|
779
|
-
createTextVNode("Valaxy")
|
|
780
|
-
]),
|
|
781
|
-
_: 1
|
|
782
|
-
/* STABLE */
|
|
783
|
-
}),
|
|
784
|
-
createTextVNode(" 成为一个国际化的项目,i18n 是必不可少的。")
|
|
785
|
-
]),
|
|
786
|
-
createVNode("p", null, [
|
|
787
|
-
createTextVNode("常见的 i18n 方案为采用不同的路径(如 "),
|
|
788
|
-
createVNode("code", null, "/zh-CN/"),
|
|
789
|
-
createTextVNode(")或解析不同的域名("),
|
|
790
|
-
createVNode("code", null, "cn.xxx.xxx"),
|
|
791
|
-
createTextVNode(")来分别维护。")
|
|
792
|
-
]),
|
|
793
|
-
createVNode("blockquote", null, [
|
|
794
|
-
createVNode("p", null, [
|
|
795
|
-
createTextVNode("此外还可使用 "),
|
|
796
|
-
createVNode(_component_AppLink, {
|
|
797
|
-
href: "https://crowdin.com/",
|
|
798
|
-
target: "_blank",
|
|
799
|
-
rel: "noreferrer"
|
|
800
|
-
}, {
|
|
801
|
-
default: withCtx(() => [
|
|
802
|
-
createTextVNode("crowdin")
|
|
803
|
-
]),
|
|
804
|
-
_: 1
|
|
805
|
-
/* STABLE */
|
|
806
|
-
}),
|
|
807
|
-
createTextVNode(" 平台辅助用户进行多语言翻译。")
|
|
808
|
-
])
|
|
809
|
-
]),
|
|
810
|
-
createVNode("p", null, [
|
|
811
|
-
createTextVNode("但对于博客来说,这显然都很麻烦。 当你需要 i18n 时,你不得不同时维护多个目录下的文章。"),
|
|
812
|
-
createVNode("br"),
|
|
813
|
-
createTextVNode(" 当文章间存在相同的示例时,你还需要维护相同的内容。非常不优雅。")
|
|
814
|
-
]),
|
|
815
|
-
createVNode("p", null, [
|
|
816
|
-
createTextVNode("Valaxy 中, 站点的独立字段部分(如文章目录:Table of Contents)基于 "),
|
|
817
|
-
createVNode(_component_AppLink, {
|
|
818
|
-
href: "https://vue-i18n.intlify.dev/",
|
|
819
|
-
target: "_blank",
|
|
820
|
-
rel: "noreferrer"
|
|
821
|
-
}, {
|
|
822
|
-
default: withCtx(() => [
|
|
823
|
-
createTextVNode("vue-i18n")
|
|
824
|
-
]),
|
|
825
|
-
_: 1
|
|
826
|
-
/* STABLE */
|
|
827
|
-
}),
|
|
828
|
-
createTextVNode(" 实现, 而文章内容部分的大段文本则采用另一种 CSS i18n 的方案。")
|
|
829
|
-
]),
|
|
830
|
-
createVNode("p", null, [
|
|
831
|
-
createVNode(_component_AppLink, { href: "#result" }, {
|
|
832
|
-
default: withCtx(() => [
|
|
833
|
-
createTextVNode("我想先看看效果")
|
|
834
|
-
]),
|
|
835
|
-
_: 1
|
|
836
|
-
/* STABLE */
|
|
837
|
-
})
|
|
838
|
-
])
|
|
839
|
-
]),
|
|
840
|
-
createCommentVNode(" more "),
|
|
841
|
-
createVNode("div", { lang: "en" }, [
|
|
842
|
-
createVNode("blockquote", null, [
|
|
843
|
-
createVNode("p", null, [
|
|
844
|
-
createVNode("strong", null, "i18n in One Page")
|
|
845
|
-
])
|
|
846
|
-
]),
|
|
847
|
-
createVNode("p", null, [
|
|
848
|
-
createTextVNode("In order to make "),
|
|
849
|
-
createVNode(_component_AppLink, {
|
|
850
|
-
href: "https://github.com/YunYouJun/valaxy",
|
|
851
|
-
target: "_blank",
|
|
852
|
-
rel: "noreferrer"
|
|
853
|
-
}, {
|
|
854
|
-
default: withCtx(() => [
|
|
855
|
-
createTextVNode("Valaxy")
|
|
856
|
-
]),
|
|
857
|
-
_: 1
|
|
858
|
-
/* STABLE */
|
|
859
|
-
}),
|
|
860
|
-
createTextVNode(" an international project, i18n is essential.")
|
|
861
|
-
]),
|
|
862
|
-
createVNode("p", null, [
|
|
863
|
-
createTextVNode("Common i18n schemes are maintained separately using different paths (e.g. "),
|
|
864
|
-
createVNode("code", null, "/zh-CN/"),
|
|
865
|
-
createTextVNode(") or resolving different domain names ("),
|
|
866
|
-
createVNode("code", null, "cn.xxx.xxx"),
|
|
867
|
-
createTextVNode(").")
|
|
868
|
-
]),
|
|
869
|
-
createVNode("blockquote", null, [
|
|
870
|
-
createVNode("p", null, [
|
|
871
|
-
createTextVNode("In addition, the "),
|
|
872
|
-
createVNode(_component_AppLink, {
|
|
873
|
-
href: "https://crowdin.com/",
|
|
874
|
-
target: "_blank",
|
|
875
|
-
rel: "noreferrer"
|
|
876
|
-
}, {
|
|
877
|
-
default: withCtx(() => [
|
|
878
|
-
createTextVNode("crowdin")
|
|
879
|
-
]),
|
|
880
|
-
_: 1
|
|
881
|
-
/* STABLE */
|
|
882
|
-
}),
|
|
883
|
-
createTextVNode(" platform can be used to assist users with multilingual translations.")
|
|
884
|
-
])
|
|
885
|
-
]),
|
|
886
|
-
createVNode("p", null, [
|
|
887
|
-
createTextVNode("But for blogs, this is obviously all a hassle. When you need i18n, you have to maintain articles in multiple directories at the same time."),
|
|
888
|
-
createVNode("br"),
|
|
889
|
-
createTextVNode(" You also have to maintain the same content when the same examples exist between articles. Very inelegant.")
|
|
890
|
-
]),
|
|
891
|
-
createVNode("p", null, [
|
|
892
|
-
createTextVNode("In Valaxy, the The standalone fields of the site (e.g. Table of Contents) are implemented based on "),
|
|
893
|
-
createVNode(_component_AppLink, {
|
|
894
|
-
href: "https://vue-i18n.intlify.dev/",
|
|
895
|
-
target: "_blank",
|
|
896
|
-
rel: "noreferrer"
|
|
897
|
-
}, {
|
|
898
|
-
default: withCtx(() => [
|
|
899
|
-
createTextVNode("vue-i18n")
|
|
900
|
-
]),
|
|
901
|
-
_: 1
|
|
902
|
-
/* STABLE */
|
|
903
|
-
}),
|
|
904
|
-
createTextVNode(". The large text sections of the article content section use a different CSS i18n scheme.")
|
|
905
|
-
]),
|
|
906
|
-
createVNode("p", null, [
|
|
907
|
-
createVNode(_component_AppLink, { href: "#result" }, {
|
|
908
|
-
default: withCtx(() => [
|
|
909
|
-
createTextVNode("I want to see the result first.")
|
|
910
|
-
]),
|
|
911
|
-
_: 1
|
|
912
|
-
/* STABLE */
|
|
913
|
-
})
|
|
914
|
-
])
|
|
915
|
-
]),
|
|
916
|
-
createVNode("h2", {
|
|
917
|
-
id: "vue-i18n",
|
|
918
|
-
tabindex: "-1"
|
|
919
|
-
}, [
|
|
920
|
-
createTextVNode("Vue-i18n "),
|
|
921
|
-
createVNode(_component_AppLink, {
|
|
922
|
-
class: "header-anchor",
|
|
923
|
-
href: "#vue-i18n",
|
|
924
|
-
"aria-label": 'Permalink to "Vue-i18n"'
|
|
925
|
-
}, {
|
|
926
|
-
default: withCtx(() => [
|
|
927
|
-
createTextVNode("")
|
|
928
|
-
]),
|
|
929
|
-
_: 1
|
|
930
|
-
/* STABLE */
|
|
931
|
-
})
|
|
932
|
-
]),
|
|
933
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
934
|
-
createVNode("p", null, [
|
|
935
|
-
createTextVNode("配置 Vite Vue-i18n 插件 "),
|
|
936
|
-
createVNode(_component_AppLink, {
|
|
937
|
-
href: "https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n",
|
|
938
|
-
target: "_blank",
|
|
939
|
-
rel: "noreferrer"
|
|
940
|
-
}, {
|
|
941
|
-
default: withCtx(() => [
|
|
942
|
-
createTextVNode("@intlify/unplugin-vue-i18n")
|
|
943
|
-
]),
|
|
944
|
-
_: 1
|
|
945
|
-
/* STABLE */
|
|
946
|
-
}),
|
|
947
|
-
createTextVNode(":")
|
|
948
|
-
])
|
|
949
|
-
]),
|
|
950
|
-
createVNode("div", { lang: "en" }, [
|
|
951
|
-
createVNode("p", null, [
|
|
952
|
-
createTextVNode("Config Vite Vue-i18n plugin "),
|
|
953
|
-
createVNode(_component_AppLink, {
|
|
954
|
-
href: "https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n",
|
|
955
|
-
target: "_blank",
|
|
956
|
-
rel: "noreferrer"
|
|
957
|
-
}, {
|
|
958
|
-
default: withCtx(() => [
|
|
959
|
-
createTextVNode("@intlify/unplugin-vue-i18n")
|
|
960
|
-
]),
|
|
961
|
-
_: 1
|
|
962
|
-
/* STABLE */
|
|
963
|
-
}),
|
|
964
|
-
createTextVNode(":")
|
|
965
|
-
])
|
|
966
|
-
]),
|
|
967
|
-
createVNode("div", { class: "language-ts" }, [
|
|
968
|
-
createVNode("button", {
|
|
969
|
-
title: "Copy Code",
|
|
970
|
-
class: "copy"
|
|
971
|
-
}),
|
|
972
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
973
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
974
|
-
createVNode("code", null, [
|
|
975
|
-
createVNode("span", { class: "line" }, [
|
|
976
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
977
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " path "),
|
|
978
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
979
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
980
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'node:path'")
|
|
981
|
-
]),
|
|
982
|
-
createTextVNode("\n"),
|
|
983
|
-
createVNode("span", { class: "line" }, [
|
|
984
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
985
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " { defineConfig } "),
|
|
986
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
987
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
988
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'vite'")
|
|
989
|
-
]),
|
|
990
|
-
createTextVNode("\n"),
|
|
991
|
-
createVNode("span", { class: "line" }, [
|
|
992
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
993
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " VueI18n "),
|
|
994
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
995
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
996
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'@intlify/unplugin-vue-i18n/vite'")
|
|
997
|
-
]),
|
|
998
|
-
createTextVNode("\n"),
|
|
999
|
-
createVNode("span", { class: "line" }),
|
|
1000
|
-
createTextVNode("\n"),
|
|
1001
|
-
createVNode("span", { class: "line" }, [
|
|
1002
|
-
createVNode("span", { style: { "color": "#F97583" } }, "export"),
|
|
1003
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1004
|
-
createVNode("span", { style: { "color": "#F97583" } }, "default"),
|
|
1005
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1006
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "defineConfig"),
|
|
1007
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "({")
|
|
1008
|
-
]),
|
|
1009
|
-
createTextVNode("\n"),
|
|
1010
|
-
createVNode("span", { class: "line" }, [
|
|
1011
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " plugins: [")
|
|
1012
|
-
]),
|
|
1013
|
-
createTextVNode("\n"),
|
|
1014
|
-
createVNode("span", { class: "line" }, [
|
|
1015
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1016
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "VueI18n"),
|
|
1017
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "({")
|
|
1018
|
-
]),
|
|
1019
|
-
createTextVNode("\n"),
|
|
1020
|
-
createVNode("span", { class: "line" }, [
|
|
1021
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " runtimeOnly: "),
|
|
1022
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "true"),
|
|
1023
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
1024
|
-
]),
|
|
1025
|
-
createTextVNode("\n"),
|
|
1026
|
-
createVNode("span", { class: "line" }, [
|
|
1027
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " compositionOnly: "),
|
|
1028
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "true"),
|
|
1029
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
1030
|
-
]),
|
|
1031
|
-
createTextVNode("\n"),
|
|
1032
|
-
createVNode("span", { class: "line" }, [
|
|
1033
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " include: [path."),
|
|
1034
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "resolve"),
|
|
1035
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(__dirname, "),
|
|
1036
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'locales/**'"),
|
|
1037
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")],")
|
|
1038
|
-
]),
|
|
1039
|
-
createTextVNode("\n"),
|
|
1040
|
-
createVNode("span", { class: "line" }, [
|
|
1041
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }),")
|
|
1042
|
-
]),
|
|
1043
|
-
createTextVNode("\n"),
|
|
1044
|
-
createVNode("span", { class: "line" }, [
|
|
1045
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " ],")
|
|
1046
|
-
]),
|
|
1047
|
-
createTextVNode("\n"),
|
|
1048
|
-
createVNode("span", { class: "line" }, [
|
|
1049
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "})")
|
|
1050
|
-
])
|
|
1051
|
-
])
|
|
1052
|
-
]),
|
|
1053
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
1054
|
-
createVNode("code", null, [
|
|
1055
|
-
createVNode("span", { class: "line" }, [
|
|
1056
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1057
|
-
createVNode("span", { style: { "color": "#24292E" } }, " path "),
|
|
1058
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
1059
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1060
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'node:path'")
|
|
1061
|
-
]),
|
|
1062
|
-
createTextVNode("\n"),
|
|
1063
|
-
createVNode("span", { class: "line" }, [
|
|
1064
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1065
|
-
createVNode("span", { style: { "color": "#24292E" } }, " { defineConfig } "),
|
|
1066
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
1067
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1068
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'vite'")
|
|
1069
|
-
]),
|
|
1070
|
-
createTextVNode("\n"),
|
|
1071
|
-
createVNode("span", { class: "line" }, [
|
|
1072
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1073
|
-
createVNode("span", { style: { "color": "#24292E" } }, " VueI18n "),
|
|
1074
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
1075
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1076
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'@intlify/unplugin-vue-i18n/vite'")
|
|
1077
|
-
]),
|
|
1078
|
-
createTextVNode("\n"),
|
|
1079
|
-
createVNode("span", { class: "line" }),
|
|
1080
|
-
createTextVNode("\n"),
|
|
1081
|
-
createVNode("span", { class: "line" }, [
|
|
1082
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "export"),
|
|
1083
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1084
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "default"),
|
|
1085
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1086
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "defineConfig"),
|
|
1087
|
-
createVNode("span", { style: { "color": "#24292E" } }, "({")
|
|
1088
|
-
]),
|
|
1089
|
-
createTextVNode("\n"),
|
|
1090
|
-
createVNode("span", { class: "line" }, [
|
|
1091
|
-
createVNode("span", { style: { "color": "#24292E" } }, " plugins: [")
|
|
1092
|
-
]),
|
|
1093
|
-
createTextVNode("\n"),
|
|
1094
|
-
createVNode("span", { class: "line" }, [
|
|
1095
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1096
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "VueI18n"),
|
|
1097
|
-
createVNode("span", { style: { "color": "#24292E" } }, "({")
|
|
1098
|
-
]),
|
|
1099
|
-
createTextVNode("\n"),
|
|
1100
|
-
createVNode("span", { class: "line" }, [
|
|
1101
|
-
createVNode("span", { style: { "color": "#24292E" } }, " runtimeOnly: "),
|
|
1102
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "true"),
|
|
1103
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
1104
|
-
]),
|
|
1105
|
-
createTextVNode("\n"),
|
|
1106
|
-
createVNode("span", { class: "line" }, [
|
|
1107
|
-
createVNode("span", { style: { "color": "#24292E" } }, " compositionOnly: "),
|
|
1108
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "true"),
|
|
1109
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
1110
|
-
]),
|
|
1111
|
-
createTextVNode("\n"),
|
|
1112
|
-
createVNode("span", { class: "line" }, [
|
|
1113
|
-
createVNode("span", { style: { "color": "#24292E" } }, " include: [path."),
|
|
1114
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "resolve"),
|
|
1115
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(__dirname, "),
|
|
1116
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'locales/**'"),
|
|
1117
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")],")
|
|
1118
|
-
]),
|
|
1119
|
-
createTextVNode("\n"),
|
|
1120
|
-
createVNode("span", { class: "line" }, [
|
|
1121
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }),")
|
|
1122
|
-
]),
|
|
1123
|
-
createTextVNode("\n"),
|
|
1124
|
-
createVNode("span", { class: "line" }, [
|
|
1125
|
-
createVNode("span", { style: { "color": "#24292E" } }, " ],")
|
|
1126
|
-
]),
|
|
1127
|
-
createTextVNode("\n"),
|
|
1128
|
-
createVNode("span", { class: "line" }, [
|
|
1129
|
-
createVNode("span", { style: { "color": "#24292E" } }, "})")
|
|
1130
|
-
])
|
|
1131
|
-
])
|
|
1132
|
-
])
|
|
1133
|
-
]),
|
|
1134
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
1135
|
-
createVNode("p", null, [
|
|
1136
|
-
createTextVNode("在 "),
|
|
1137
|
-
createVNode("code", null, "locales"),
|
|
1138
|
-
createTextVNode(" 目录下配置 "),
|
|
1139
|
-
createVNode("code", null, "zh-CN.yml"),
|
|
1140
|
-
createTextVNode(" 与 "),
|
|
1141
|
-
createVNode("code", null, "en.yml"),
|
|
1142
|
-
createTextVNode(":")
|
|
1143
|
-
])
|
|
1144
|
-
]),
|
|
1145
|
-
createVNode("div", { lang: "en" }, [
|
|
1146
|
-
createVNode("p", null, [
|
|
1147
|
-
createTextVNode("Write "),
|
|
1148
|
-
createVNode("code", null, "zh-CN.yml"),
|
|
1149
|
-
createTextVNode(" and "),
|
|
1150
|
-
createVNode("code", null, "en.yml"),
|
|
1151
|
-
createTextVNode(" in "),
|
|
1152
|
-
createVNode("code", null, "locales"),
|
|
1153
|
-
createTextVNode(".")
|
|
1154
|
-
])
|
|
1155
|
-
]),
|
|
1156
|
-
createVNode("div", { class: "language-yaml" }, [
|
|
1157
|
-
createVNode("button", {
|
|
1158
|
-
title: "Copy Code",
|
|
1159
|
-
class: "copy"
|
|
1160
|
-
}),
|
|
1161
|
-
createVNode("span", { class: "lang" }, "yaml"),
|
|
1162
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
1163
|
-
createVNode("code", null, [
|
|
1164
|
-
createVNode("span", { class: "line" }, [
|
|
1165
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "# zh-CN.yml")
|
|
1166
|
-
]),
|
|
1167
|
-
createTextVNode("\n"),
|
|
1168
|
-
createVNode("span", { class: "line" }, [
|
|
1169
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "sidebar"),
|
|
1170
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":")
|
|
1171
|
-
]),
|
|
1172
|
-
createTextVNode("\n"),
|
|
1173
|
-
createVNode("span", { class: "line" }, [
|
|
1174
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1175
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "toc"),
|
|
1176
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ": "),
|
|
1177
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "文章目录")
|
|
1178
|
-
])
|
|
1179
|
-
])
|
|
1180
|
-
]),
|
|
1181
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
1182
|
-
createVNode("code", null, [
|
|
1183
|
-
createVNode("span", { class: "line" }, [
|
|
1184
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "# zh-CN.yml")
|
|
1185
|
-
]),
|
|
1186
|
-
createTextVNode("\n"),
|
|
1187
|
-
createVNode("span", { class: "line" }, [
|
|
1188
|
-
createVNode("span", { style: { "color": "#22863A" } }, "sidebar"),
|
|
1189
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":")
|
|
1190
|
-
]),
|
|
1191
|
-
createTextVNode("\n"),
|
|
1192
|
-
createVNode("span", { class: "line" }, [
|
|
1193
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1194
|
-
createVNode("span", { style: { "color": "#22863A" } }, "toc"),
|
|
1195
|
-
createVNode("span", { style: { "color": "#24292E" } }, ": "),
|
|
1196
|
-
createVNode("span", { style: { "color": "#032F62" } }, "文章目录")
|
|
1197
|
-
])
|
|
1198
|
-
])
|
|
1199
|
-
])
|
|
1200
|
-
]),
|
|
1201
|
-
createVNode("div", { class: "language-yaml" }, [
|
|
1202
|
-
createVNode("button", {
|
|
1203
|
-
title: "Copy Code",
|
|
1204
|
-
class: "copy"
|
|
1205
|
-
}),
|
|
1206
|
-
createVNode("span", { class: "lang" }, "yaml"),
|
|
1207
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
1208
|
-
createVNode("code", null, [
|
|
1209
|
-
createVNode("span", { class: "line" }, [
|
|
1210
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "# en.yml")
|
|
1211
|
-
]),
|
|
1212
|
-
createTextVNode("\n"),
|
|
1213
|
-
createVNode("span", { class: "line" }, [
|
|
1214
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "sidebar"),
|
|
1215
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":")
|
|
1216
|
-
]),
|
|
1217
|
-
createTextVNode("\n"),
|
|
1218
|
-
createVNode("span", { class: "line" }, [
|
|
1219
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1220
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "toc"),
|
|
1221
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ": "),
|
|
1222
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "Table of Contents")
|
|
1223
|
-
])
|
|
1224
|
-
])
|
|
1225
|
-
]),
|
|
1226
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
1227
|
-
createVNode("code", null, [
|
|
1228
|
-
createVNode("span", { class: "line" }, [
|
|
1229
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "# en.yml")
|
|
1230
|
-
]),
|
|
1231
|
-
createTextVNode("\n"),
|
|
1232
|
-
createVNode("span", { class: "line" }, [
|
|
1233
|
-
createVNode("span", { style: { "color": "#22863A" } }, "sidebar"),
|
|
1234
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":")
|
|
1235
|
-
]),
|
|
1236
|
-
createTextVNode("\n"),
|
|
1237
|
-
createVNode("span", { class: "line" }, [
|
|
1238
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1239
|
-
createVNode("span", { style: { "color": "#22863A" } }, "toc"),
|
|
1240
|
-
createVNode("span", { style: { "color": "#24292E" } }, ": "),
|
|
1241
|
-
createVNode("span", { style: { "color": "#032F62" } }, "Table of Contents")
|
|
1242
|
-
])
|
|
1243
|
-
])
|
|
1244
|
-
])
|
|
1245
|
-
]),
|
|
1246
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
1247
|
-
createVNode("p", null, [
|
|
1248
|
-
createTextVNode("并在主入口文件(如 "),
|
|
1249
|
-
createVNode("code", null, "main.ts"),
|
|
1250
|
-
createTextVNode(")中初始化:")
|
|
1251
|
-
])
|
|
1252
|
-
]),
|
|
1253
|
-
createVNode("div", { lang: "en" }, [
|
|
1254
|
-
createVNode("p", null, [
|
|
1255
|
-
createTextVNode("and initialized in the main entry file (e.g. "),
|
|
1256
|
-
createVNode("code", null, "main.ts"),
|
|
1257
|
-
createTextVNode(").")
|
|
1258
|
-
])
|
|
1259
|
-
]),
|
|
1260
|
-
createVNode("div", { class: "language-ts" }, [
|
|
1261
|
-
createVNode("button", {
|
|
1262
|
-
title: "Copy Code",
|
|
1263
|
-
class: "copy"
|
|
1264
|
-
}),
|
|
1265
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
1266
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
1267
|
-
createVNode("code", null, [
|
|
1268
|
-
createVNode("span", { class: "line" }, [
|
|
1269
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
1270
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " { createI18n } "),
|
|
1271
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
1272
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1273
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'vue-i18n'")
|
|
1274
|
-
]),
|
|
1275
|
-
createTextVNode("\n"),
|
|
1276
|
-
createVNode("span", { class: "line" }),
|
|
1277
|
-
createTextVNode("\n"),
|
|
1278
|
-
createVNode("span", { class: "line" }, [
|
|
1279
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// import { createApp } from 'vue'")
|
|
1280
|
-
]),
|
|
1281
|
-
createTextVNode("\n"),
|
|
1282
|
-
createVNode("span", { class: "line" }, [
|
|
1283
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// import App from './App.vue'")
|
|
1284
|
-
]),
|
|
1285
|
-
createTextVNode("\n"),
|
|
1286
|
-
createVNode("span", { class: "line" }),
|
|
1287
|
-
createTextVNode("\n"),
|
|
1288
|
-
createVNode("span", { class: "line" }, [
|
|
1289
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "/*")
|
|
1290
|
-
]),
|
|
1291
|
-
createTextVNode("\n"),
|
|
1292
|
-
createVNode("span", { class: "line" }, [
|
|
1293
|
-
createVNode("span", { style: { "color": "#6A737D" } }, " * All i18n resources specified in the plugin `include` option can be loaded")
|
|
1294
|
-
]),
|
|
1295
|
-
createTextVNode("\n"),
|
|
1296
|
-
createVNode("span", { class: "line" }, [
|
|
1297
|
-
createVNode("span", { style: { "color": "#6A737D" } }, " * at once using the import syntax")
|
|
1298
|
-
]),
|
|
1299
|
-
createTextVNode("\n"),
|
|
1300
|
-
createVNode("span", { class: "line" }, [
|
|
1301
|
-
createVNode("span", { style: { "color": "#6A737D" } }, " */")
|
|
1302
|
-
]),
|
|
1303
|
-
createTextVNode("\n"),
|
|
1304
|
-
createVNode("span", { class: "line" }, [
|
|
1305
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
1306
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " messages "),
|
|
1307
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
1308
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1309
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'@intlify/unplugin-vue-i18n/messages'")
|
|
1310
|
-
]),
|
|
1311
|
-
createTextVNode("\n"),
|
|
1312
|
-
createVNode("span", { class: "line" }),
|
|
1313
|
-
createTextVNode("\n"),
|
|
1314
|
-
createVNode("span", { class: "line" }, [
|
|
1315
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
1316
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1317
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "i18n"),
|
|
1318
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1319
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
1320
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1321
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "createI18n"),
|
|
1322
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "({")
|
|
1323
|
-
]),
|
|
1324
|
-
createTextVNode("\n"),
|
|
1325
|
-
createVNode("span", { class: "line" }, [
|
|
1326
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " legacy: "),
|
|
1327
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "false"),
|
|
1328
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
1329
|
-
]),
|
|
1330
|
-
createTextVNode("\n"),
|
|
1331
|
-
createVNode("span", { class: "line" }, [
|
|
1332
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " locale: "),
|
|
1333
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'en'"),
|
|
1334
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
1335
|
-
]),
|
|
1336
|
-
createTextVNode("\n"),
|
|
1337
|
-
createVNode("span", { class: "line" }, [
|
|
1338
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " messages,")
|
|
1339
|
-
]),
|
|
1340
|
-
createTextVNode("\n"),
|
|
1341
|
-
createVNode("span", { class: "line" }, [
|
|
1342
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "})")
|
|
1343
|
-
]),
|
|
1344
|
-
createTextVNode("\n"),
|
|
1345
|
-
createVNode("span", { class: "line" }),
|
|
1346
|
-
createTextVNode("\n"),
|
|
1347
|
-
createVNode("span", { class: "line" }, [
|
|
1348
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// const app = createApp(App)")
|
|
1349
|
-
]),
|
|
1350
|
-
createTextVNode("\n"),
|
|
1351
|
-
createVNode("span", { class: "line" }, [
|
|
1352
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "app."),
|
|
1353
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "use"),
|
|
1354
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(i18n)")
|
|
1355
|
-
])
|
|
1356
|
-
])
|
|
1357
|
-
]),
|
|
1358
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
1359
|
-
createVNode("code", null, [
|
|
1360
|
-
createVNode("span", { class: "line" }, [
|
|
1361
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1362
|
-
createVNode("span", { style: { "color": "#24292E" } }, " { createI18n } "),
|
|
1363
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
1364
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1365
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'vue-i18n'")
|
|
1366
|
-
]),
|
|
1367
|
-
createTextVNode("\n"),
|
|
1368
|
-
createVNode("span", { class: "line" }),
|
|
1369
|
-
createTextVNode("\n"),
|
|
1370
|
-
createVNode("span", { class: "line" }, [
|
|
1371
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// import { createApp } from 'vue'")
|
|
1372
|
-
]),
|
|
1373
|
-
createTextVNode("\n"),
|
|
1374
|
-
createVNode("span", { class: "line" }, [
|
|
1375
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// import App from './App.vue'")
|
|
1376
|
-
]),
|
|
1377
|
-
createTextVNode("\n"),
|
|
1378
|
-
createVNode("span", { class: "line" }),
|
|
1379
|
-
createTextVNode("\n"),
|
|
1380
|
-
createVNode("span", { class: "line" }, [
|
|
1381
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "/*")
|
|
1382
|
-
]),
|
|
1383
|
-
createTextVNode("\n"),
|
|
1384
|
-
createVNode("span", { class: "line" }, [
|
|
1385
|
-
createVNode("span", { style: { "color": "#6A737D" } }, " * All i18n resources specified in the plugin `include` option can be loaded")
|
|
1386
|
-
]),
|
|
1387
|
-
createTextVNode("\n"),
|
|
1388
|
-
createVNode("span", { class: "line" }, [
|
|
1389
|
-
createVNode("span", { style: { "color": "#6A737D" } }, " * at once using the import syntax")
|
|
1390
|
-
]),
|
|
1391
|
-
createTextVNode("\n"),
|
|
1392
|
-
createVNode("span", { class: "line" }, [
|
|
1393
|
-
createVNode("span", { style: { "color": "#6A737D" } }, " */")
|
|
1394
|
-
]),
|
|
1395
|
-
createTextVNode("\n"),
|
|
1396
|
-
createVNode("span", { class: "line" }, [
|
|
1397
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1398
|
-
createVNode("span", { style: { "color": "#24292E" } }, " messages "),
|
|
1399
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
1400
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1401
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'@intlify/unplugin-vue-i18n/messages'")
|
|
1402
|
-
]),
|
|
1403
|
-
createTextVNode("\n"),
|
|
1404
|
-
createVNode("span", { class: "line" }),
|
|
1405
|
-
createTextVNode("\n"),
|
|
1406
|
-
createVNode("span", { class: "line" }, [
|
|
1407
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
1408
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1409
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "i18n"),
|
|
1410
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1411
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
1412
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1413
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "createI18n"),
|
|
1414
|
-
createVNode("span", { style: { "color": "#24292E" } }, "({")
|
|
1415
|
-
]),
|
|
1416
|
-
createTextVNode("\n"),
|
|
1417
|
-
createVNode("span", { class: "line" }, [
|
|
1418
|
-
createVNode("span", { style: { "color": "#24292E" } }, " legacy: "),
|
|
1419
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "false"),
|
|
1420
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
1421
|
-
]),
|
|
1422
|
-
createTextVNode("\n"),
|
|
1423
|
-
createVNode("span", { class: "line" }, [
|
|
1424
|
-
createVNode("span", { style: { "color": "#24292E" } }, " locale: "),
|
|
1425
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'en'"),
|
|
1426
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
1427
|
-
]),
|
|
1428
|
-
createTextVNode("\n"),
|
|
1429
|
-
createVNode("span", { class: "line" }, [
|
|
1430
|
-
createVNode("span", { style: { "color": "#24292E" } }, " messages,")
|
|
1431
|
-
]),
|
|
1432
|
-
createTextVNode("\n"),
|
|
1433
|
-
createVNode("span", { class: "line" }, [
|
|
1434
|
-
createVNode("span", { style: { "color": "#24292E" } }, "})")
|
|
1435
|
-
]),
|
|
1436
|
-
createTextVNode("\n"),
|
|
1437
|
-
createVNode("span", { class: "line" }),
|
|
1438
|
-
createTextVNode("\n"),
|
|
1439
|
-
createVNode("span", { class: "line" }, [
|
|
1440
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// const app = createApp(App)")
|
|
1441
|
-
]),
|
|
1442
|
-
createTextVNode("\n"),
|
|
1443
|
-
createVNode("span", { class: "line" }, [
|
|
1444
|
-
createVNode("span", { style: { "color": "#24292E" } }, "app."),
|
|
1445
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "use"),
|
|
1446
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(i18n)")
|
|
1447
|
-
])
|
|
1448
|
-
])
|
|
1449
|
-
])
|
|
1450
|
-
]),
|
|
1451
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
1452
|
-
createVNode("p", null, [
|
|
1453
|
-
createTextVNode("此时即可在 Vue 中使用 "),
|
|
1454
|
-
createVNode("code", null, "t('')"),
|
|
1455
|
-
createTextVNode(" 来翻译对应字段文本。")
|
|
1456
|
-
])
|
|
1457
|
-
]),
|
|
1458
|
-
createVNode("div", { lang: "en" }, [
|
|
1459
|
-
createVNode("p", null, [
|
|
1460
|
-
createTextVNode("You can then use "),
|
|
1461
|
-
createVNode("code", null, "t('')"),
|
|
1462
|
-
createTextVNode(" in Vue to translate the text of the corresponding field.")
|
|
1463
|
-
])
|
|
1464
|
-
]),
|
|
1465
|
-
createVNode("div", { class: "language-vue" }, [
|
|
1466
|
-
createVNode("button", {
|
|
1467
|
-
title: "Copy Code",
|
|
1468
|
-
class: "copy"
|
|
1469
|
-
}),
|
|
1470
|
-
createVNode("span", { class: "lang" }, "vue"),
|
|
1471
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
1472
|
-
createVNode("code", null, [
|
|
1473
|
-
createVNode("span", { class: "line" }, [
|
|
1474
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "<"),
|
|
1475
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "script"),
|
|
1476
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1477
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "lang"),
|
|
1478
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "="),
|
|
1479
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"ts"'),
|
|
1480
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1481
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "setup"),
|
|
1482
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
1483
|
-
]),
|
|
1484
|
-
createTextVNode("\n"),
|
|
1485
|
-
createVNode("span", { class: "line" }, [
|
|
1486
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
1487
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " { useI18n } "),
|
|
1488
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
1489
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1490
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'vue-i18n'")
|
|
1491
|
-
]),
|
|
1492
|
-
createTextVNode("\n"),
|
|
1493
|
-
createVNode("span", { class: "line" }),
|
|
1494
|
-
createTextVNode("\n"),
|
|
1495
|
-
createVNode("span", { class: "line" }, [
|
|
1496
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
1497
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " { "),
|
|
1498
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "t"),
|
|
1499
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " } "),
|
|
1500
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
1501
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1502
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "useI18n"),
|
|
1503
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "()")
|
|
1504
|
-
]),
|
|
1505
|
-
createTextVNode("\n"),
|
|
1506
|
-
createVNode("span", { class: "line" }, [
|
|
1507
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "</"),
|
|
1508
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "script"),
|
|
1509
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
1510
|
-
]),
|
|
1511
|
-
createTextVNode("\n"),
|
|
1512
|
-
createVNode("span", { class: "line" }),
|
|
1513
|
-
createTextVNode("\n"),
|
|
1514
|
-
createVNode("span", { class: "line" }, [
|
|
1515
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "<"),
|
|
1516
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "template"),
|
|
1517
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
1518
|
-
]),
|
|
1519
|
-
createTextVNode("\n"),
|
|
1520
|
-
createVNode("span", { class: "line" }, [
|
|
1521
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " <"),
|
|
1522
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "h2"),
|
|
1523
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, '> {{ t("sidebar.toc") }} </'),
|
|
1524
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "h2"),
|
|
1525
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
1526
|
-
]),
|
|
1527
|
-
createTextVNode("\n"),
|
|
1528
|
-
createVNode("span", { class: "line" }, [
|
|
1529
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "</"),
|
|
1530
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "template"),
|
|
1531
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
1532
|
-
])
|
|
1533
|
-
])
|
|
1534
|
-
]),
|
|
1535
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
1536
|
-
createVNode("code", null, [
|
|
1537
|
-
createVNode("span", { class: "line" }, [
|
|
1538
|
-
createVNode("span", { style: { "color": "#24292E" } }, "<"),
|
|
1539
|
-
createVNode("span", { style: { "color": "#22863A" } }, "script"),
|
|
1540
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1541
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "lang"),
|
|
1542
|
-
createVNode("span", { style: { "color": "#24292E" } }, "="),
|
|
1543
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"ts"'),
|
|
1544
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1545
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "setup"),
|
|
1546
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
1547
|
-
]),
|
|
1548
|
-
createTextVNode("\n"),
|
|
1549
|
-
createVNode("span", { class: "line" }, [
|
|
1550
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1551
|
-
createVNode("span", { style: { "color": "#24292E" } }, " { useI18n } "),
|
|
1552
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
1553
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1554
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'vue-i18n'")
|
|
1555
|
-
]),
|
|
1556
|
-
createTextVNode("\n"),
|
|
1557
|
-
createVNode("span", { class: "line" }),
|
|
1558
|
-
createTextVNode("\n"),
|
|
1559
|
-
createVNode("span", { class: "line" }, [
|
|
1560
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
1561
|
-
createVNode("span", { style: { "color": "#24292E" } }, " { "),
|
|
1562
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "t"),
|
|
1563
|
-
createVNode("span", { style: { "color": "#24292E" } }, " } "),
|
|
1564
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
1565
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1566
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "useI18n"),
|
|
1567
|
-
createVNode("span", { style: { "color": "#24292E" } }, "()")
|
|
1568
|
-
]),
|
|
1569
|
-
createTextVNode("\n"),
|
|
1570
|
-
createVNode("span", { class: "line" }, [
|
|
1571
|
-
createVNode("span", { style: { "color": "#24292E" } }, "</"),
|
|
1572
|
-
createVNode("span", { style: { "color": "#22863A" } }, "script"),
|
|
1573
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
1574
|
-
]),
|
|
1575
|
-
createTextVNode("\n"),
|
|
1576
|
-
createVNode("span", { class: "line" }),
|
|
1577
|
-
createTextVNode("\n"),
|
|
1578
|
-
createVNode("span", { class: "line" }, [
|
|
1579
|
-
createVNode("span", { style: { "color": "#24292E" } }, "<"),
|
|
1580
|
-
createVNode("span", { style: { "color": "#22863A" } }, "template"),
|
|
1581
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
1582
|
-
]),
|
|
1583
|
-
createTextVNode("\n"),
|
|
1584
|
-
createVNode("span", { class: "line" }, [
|
|
1585
|
-
createVNode("span", { style: { "color": "#24292E" } }, " <"),
|
|
1586
|
-
createVNode("span", { style: { "color": "#22863A" } }, "h2"),
|
|
1587
|
-
createVNode("span", { style: { "color": "#24292E" } }, '> {{ t("sidebar.toc") }} </'),
|
|
1588
|
-
createVNode("span", { style: { "color": "#22863A" } }, "h2"),
|
|
1589
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
1590
|
-
]),
|
|
1591
|
-
createTextVNode("\n"),
|
|
1592
|
-
createVNode("span", { class: "line" }, [
|
|
1593
|
-
createVNode("span", { style: { "color": "#24292E" } }, "</"),
|
|
1594
|
-
createVNode("span", { style: { "color": "#22863A" } }, "template"),
|
|
1595
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
1596
|
-
])
|
|
1597
|
-
])
|
|
1598
|
-
])
|
|
1599
|
-
]),
|
|
1600
|
-
createVNode("h3", {
|
|
1601
|
-
id: "messages-when-ssg",
|
|
1602
|
-
tabindex: "-1"
|
|
1603
|
-
}, [
|
|
1604
|
-
createTextVNode("Messages when SSG "),
|
|
1605
|
-
createVNode(_component_AppLink, {
|
|
1606
|
-
class: "header-anchor",
|
|
1607
|
-
href: "#messages-when-ssg",
|
|
1608
|
-
"aria-label": 'Permalink to "Messages when SSG"'
|
|
1609
|
-
}, {
|
|
1610
|
-
default: withCtx(() => [
|
|
1611
|
-
createTextVNode("")
|
|
1612
|
-
]),
|
|
1613
|
-
_: 1
|
|
1614
|
-
/* STABLE */
|
|
1615
|
-
})
|
|
1616
|
-
]),
|
|
1617
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
1618
|
-
createVNode("p", null, [
|
|
1619
|
-
createVNode("code", null, "vue-i18n"),
|
|
1620
|
-
createTextVNode(" 支持使用虚拟模块 "),
|
|
1621
|
-
createVNode("code", null, "@intlify/unplugin-vue-i18n/messages"),
|
|
1622
|
-
createTextVNode(" 的方式来导入多语言。")
|
|
1623
|
-
]),
|
|
1624
|
-
createVNode("p", null, [
|
|
1625
|
-
createTextVNode("可惜的是,它并没有完美地支持 SSR。"),
|
|
1626
|
-
createVNode(_component_AppLink, {
|
|
1627
|
-
href: "https://github.com/intlify/bundle-tools/issues/78",
|
|
1628
|
-
target: "_blank",
|
|
1629
|
-
rel: "noreferrer"
|
|
1630
|
-
}, {
|
|
1631
|
-
default: withCtx(() => [
|
|
1632
|
-
createTextVNode("#78 | intlify/bundle-tools")
|
|
1633
|
-
]),
|
|
1634
|
-
_: 1
|
|
1635
|
-
/* STABLE */
|
|
1636
|
-
})
|
|
1637
|
-
]),
|
|
1638
|
-
createVNode("p", null, [
|
|
1639
|
-
createTextVNode("而 Vite 的 "),
|
|
1640
|
-
createVNode("code", null, [
|
|
1641
|
-
createTextVNode("i"),
|
|
1642
|
-
createVNode("wbr"),
|
|
1643
|
-
createTextVNode("mport.meta.globEager")
|
|
1644
|
-
]),
|
|
1645
|
-
createTextVNode(" 导入必须使用静态字符串。")
|
|
1646
|
-
])
|
|
1647
|
-
]),
|
|
1648
|
-
createVNode("div", { lang: "en" }, [
|
|
1649
|
-
createVNode("p", null, [
|
|
1650
|
-
createVNode("code", null, "vue-i18n"),
|
|
1651
|
-
createTextVNode(" supports importing multiple languages by using the virtual module "),
|
|
1652
|
-
createVNode("code", null, "@intlify/unplugin-vue-i18n/messages"),
|
|
1653
|
-
createTextVNode(".")
|
|
1654
|
-
]),
|
|
1655
|
-
createVNode("p", null, [
|
|
1656
|
-
createTextVNode("Unfortunately, it doesn't support SSR perfectly."),
|
|
1657
|
-
createVNode(_component_AppLink, {
|
|
1658
|
-
href: "https://github.com/intlify/bundle-tools/issues/78",
|
|
1659
|
-
target: "_blank",
|
|
1660
|
-
rel: "noreferrer"
|
|
1661
|
-
}, {
|
|
1662
|
-
default: withCtx(() => [
|
|
1663
|
-
createTextVNode("#78 | intlify/bundle-tools")
|
|
1664
|
-
]),
|
|
1665
|
-
_: 1
|
|
1666
|
-
/* STABLE */
|
|
1667
|
-
})
|
|
1668
|
-
]),
|
|
1669
|
-
createVNode("p", null, [
|
|
1670
|
-
createTextVNode("And Vite's "),
|
|
1671
|
-
createVNode("code", null, [
|
|
1672
|
-
createTextVNode("i"),
|
|
1673
|
-
createVNode("wbr"),
|
|
1674
|
-
createTextVNode("mport.meta.globEager")
|
|
1675
|
-
]),
|
|
1676
|
-
createTextVNode(" import must use a static string.")
|
|
1677
|
-
])
|
|
1678
|
-
]),
|
|
1679
|
-
createVNode("div", { class: "language-ts" }, [
|
|
1680
|
-
createVNode("button", {
|
|
1681
|
-
title: "Copy Code",
|
|
1682
|
-
class: "copy"
|
|
1683
|
-
}),
|
|
1684
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
1685
|
-
createVNode("pre", { class: "shiki github-dark has-highlighted-lines vp-code-dark" }, [
|
|
1686
|
-
createVNode("code", null, [
|
|
1687
|
-
createVNode("span", { class: "line" }, [
|
|
1688
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
1689
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1690
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "messages"),
|
|
1691
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1692
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
1693
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " Object."),
|
|
1694
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "fromEntries"),
|
|
1695
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(")
|
|
1696
|
-
]),
|
|
1697
|
-
createTextVNode("\n"),
|
|
1698
|
-
createVNode("span", { class: "line" }, [
|
|
1699
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " Object."),
|
|
1700
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "entries"),
|
|
1701
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(")
|
|
1702
|
-
]),
|
|
1703
|
-
createTextVNode("\n"),
|
|
1704
|
-
createVNode("span", { class: "line highlighted" }, [
|
|
1705
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1706
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
1707
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "."),
|
|
1708
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "meta"),
|
|
1709
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "."),
|
|
1710
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "globEager"),
|
|
1711
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
1712
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'../../locales/*.y(a)?ml'"),
|
|
1713
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
1714
|
-
]),
|
|
1715
|
-
createTextVNode("\n"),
|
|
1716
|
-
createVNode("span", { class: "line" }, [
|
|
1717
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " )")
|
|
1718
|
-
]),
|
|
1719
|
-
createTextVNode("\n"),
|
|
1720
|
-
createVNode("span", { class: "line" }, [
|
|
1721
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " ."),
|
|
1722
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "map"),
|
|
1723
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "((["),
|
|
1724
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "key"),
|
|
1725
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", "),
|
|
1726
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "value"),
|
|
1727
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "]) "),
|
|
1728
|
-
createVNode("span", { style: { "color": "#F97583" } }, "=>"),
|
|
1729
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
1730
|
-
]),
|
|
1731
|
-
createTextVNode("\n"),
|
|
1732
|
-
createVNode("span", { class: "line" }, [
|
|
1733
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1734
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
1735
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1736
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "yaml"),
|
|
1737
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1738
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
1739
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " key."),
|
|
1740
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "endsWith"),
|
|
1741
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
1742
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'.yaml'"),
|
|
1743
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
1744
|
-
]),
|
|
1745
|
-
createTextVNode("\n"),
|
|
1746
|
-
createVNode("span", { class: "line" }, [
|
|
1747
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1748
|
-
createVNode("span", { style: { "color": "#F97583" } }, "return"),
|
|
1749
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " [key."),
|
|
1750
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "slice"),
|
|
1751
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
1752
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "14"),
|
|
1753
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", yaml "),
|
|
1754
|
-
createVNode("span", { style: { "color": "#F97583" } }, "?"),
|
|
1755
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1756
|
-
createVNode("span", { style: { "color": "#F97583" } }, "-"),
|
|
1757
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "5"),
|
|
1758
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1759
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
1760
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1761
|
-
createVNode("span", { style: { "color": "#F97583" } }, "-"),
|
|
1762
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "4"),
|
|
1763
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "), value.default]")
|
|
1764
|
-
]),
|
|
1765
|
-
createTextVNode("\n"),
|
|
1766
|
-
createVNode("span", { class: "line" }, [
|
|
1767
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }),")
|
|
1768
|
-
]),
|
|
1769
|
-
createTextVNode("\n"),
|
|
1770
|
-
createVNode("span", { class: "line" }, [
|
|
1771
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
1772
|
-
])
|
|
1773
|
-
])
|
|
1774
|
-
]),
|
|
1775
|
-
createVNode("pre", { class: "shiki github-light has-highlighted-lines vp-code-light" }, [
|
|
1776
|
-
createVNode("code", null, [
|
|
1777
|
-
createVNode("span", { class: "line" }, [
|
|
1778
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
1779
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1780
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "messages"),
|
|
1781
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1782
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
1783
|
-
createVNode("span", { style: { "color": "#24292E" } }, " Object."),
|
|
1784
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "fromEntries"),
|
|
1785
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(")
|
|
1786
|
-
]),
|
|
1787
|
-
createTextVNode("\n"),
|
|
1788
|
-
createVNode("span", { class: "line" }, [
|
|
1789
|
-
createVNode("span", { style: { "color": "#24292E" } }, " Object."),
|
|
1790
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "entries"),
|
|
1791
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(")
|
|
1792
|
-
]),
|
|
1793
|
-
createTextVNode("\n"),
|
|
1794
|
-
createVNode("span", { class: "line highlighted" }, [
|
|
1795
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1796
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
1797
|
-
createVNode("span", { style: { "color": "#24292E" } }, "."),
|
|
1798
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "meta"),
|
|
1799
|
-
createVNode("span", { style: { "color": "#24292E" } }, "."),
|
|
1800
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "globEager"),
|
|
1801
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
1802
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'../../locales/*.y(a)?ml'"),
|
|
1803
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
1804
|
-
]),
|
|
1805
|
-
createTextVNode("\n"),
|
|
1806
|
-
createVNode("span", { class: "line" }, [
|
|
1807
|
-
createVNode("span", { style: { "color": "#24292E" } }, " )")
|
|
1808
|
-
]),
|
|
1809
|
-
createTextVNode("\n"),
|
|
1810
|
-
createVNode("span", { class: "line" }, [
|
|
1811
|
-
createVNode("span", { style: { "color": "#24292E" } }, " ."),
|
|
1812
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "map"),
|
|
1813
|
-
createVNode("span", { style: { "color": "#24292E" } }, "((["),
|
|
1814
|
-
createVNode("span", { style: { "color": "#E36209" } }, "key"),
|
|
1815
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", "),
|
|
1816
|
-
createVNode("span", { style: { "color": "#E36209" } }, "value"),
|
|
1817
|
-
createVNode("span", { style: { "color": "#24292E" } }, "]) "),
|
|
1818
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "=>"),
|
|
1819
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
1820
|
-
]),
|
|
1821
|
-
createTextVNode("\n"),
|
|
1822
|
-
createVNode("span", { class: "line" }, [
|
|
1823
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1824
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
1825
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1826
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "yaml"),
|
|
1827
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1828
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
1829
|
-
createVNode("span", { style: { "color": "#24292E" } }, " key."),
|
|
1830
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "endsWith"),
|
|
1831
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
1832
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'.yaml'"),
|
|
1833
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
1834
|
-
]),
|
|
1835
|
-
createTextVNode("\n"),
|
|
1836
|
-
createVNode("span", { class: "line" }, [
|
|
1837
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1838
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "return"),
|
|
1839
|
-
createVNode("span", { style: { "color": "#24292E" } }, " [key."),
|
|
1840
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "slice"),
|
|
1841
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
1842
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "14"),
|
|
1843
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", yaml "),
|
|
1844
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "?"),
|
|
1845
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1846
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "-"),
|
|
1847
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "5"),
|
|
1848
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1849
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
1850
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
1851
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "-"),
|
|
1852
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "4"),
|
|
1853
|
-
createVNode("span", { style: { "color": "#24292E" } }, "), value.default]")
|
|
1854
|
-
]),
|
|
1855
|
-
createTextVNode("\n"),
|
|
1856
|
-
createVNode("span", { class: "line" }, [
|
|
1857
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }),")
|
|
1858
|
-
]),
|
|
1859
|
-
createTextVNode("\n"),
|
|
1860
|
-
createVNode("span", { class: "line" }, [
|
|
1861
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
1862
|
-
])
|
|
1863
|
-
])
|
|
1864
|
-
])
|
|
1865
|
-
]),
|
|
1866
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
1867
|
-
createVNode("p", null, [
|
|
1868
|
-
createTextVNode("当拥有确定目录时,它是奏效的,但 Valaxy 还需要将 Valaxy 自身的 "),
|
|
1869
|
-
createVNode("code", null, "locales"),
|
|
1870
|
-
createTextVNode(" 与主题的 "),
|
|
1871
|
-
createVNode("code", null, "locales"),
|
|
1872
|
-
createTextVNode(" 以及用户自定义的 "),
|
|
1873
|
-
createVNode("code", null, "locales"),
|
|
1874
|
-
createTextVNode(" 进行合并。 这意味着我们不能使用变量来拼接字符串进行导入,对于不同包管理器的目录结构不同,我们很难确定这些 "),
|
|
1875
|
-
createVNode("code", null, "locales"),
|
|
1876
|
-
createTextVNode(" 处于何处的相对位置。")
|
|
1877
|
-
]),
|
|
1878
|
-
createVNode("p", null, [
|
|
1879
|
-
createTextVNode("因此我采用插件虚拟模块("),
|
|
1880
|
-
createVNode("code", null, "@valaxyjs/locales"),
|
|
1881
|
-
createTextVNode(")的形式实现(依次导入各目录下的 locales 数据并合并):")
|
|
1882
|
-
]),
|
|
1883
|
-
createVNode("blockquote", null, [
|
|
1884
|
-
createVNode("p", null, "Vite 虚拟模块的原理其实就是拼接字符串。")
|
|
1885
|
-
])
|
|
1886
|
-
]),
|
|
1887
|
-
createVNode("div", { lang: "en" }, [
|
|
1888
|
-
createVNode("p", null, [
|
|
1889
|
-
createTextVNode("It works when there is a defined directory, but Valaxy also needs to merge Valaxy's own "),
|
|
1890
|
-
createVNode("code", null, "locales"),
|
|
1891
|
-
createTextVNode(" with the theme's "),
|
|
1892
|
-
createVNode("code", null, "locales"),
|
|
1893
|
-
createTextVNode(" and user-defined "),
|
|
1894
|
-
createVNode("code", null, "locales"),
|
|
1895
|
-
createTextVNode(". This means that we cannot use variables to splice strings for import, and it is difficult to determine the relative location of where these "),
|
|
1896
|
-
createVNode("code", null, "locales"),
|
|
1897
|
-
createTextVNode(" are for different package managers with different directory structures.")
|
|
1898
|
-
]),
|
|
1899
|
-
createVNode("p", null, [
|
|
1900
|
-
createTextVNode("So I implemented it in the form of a plugin virtual module ("),
|
|
1901
|
-
createVNode("code", null, "@valaxyjs/locales"),
|
|
1902
|
-
createTextVNode("):")
|
|
1903
|
-
]),
|
|
1904
|
-
createVNode("blockquote", null, [
|
|
1905
|
-
createVNode("p", null, "The principle of the Vite virtual module is actually a spliced string.")
|
|
1906
|
-
])
|
|
1907
|
-
]),
|
|
1908
|
-
createVNode("div", { class: "language-ts" }, [
|
|
1909
|
-
createVNode("button", {
|
|
1910
|
-
title: "Copy Code",
|
|
1911
|
-
class: "copy"
|
|
1912
|
-
}),
|
|
1913
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
1914
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
1915
|
-
createVNode("code", null, [
|
|
1916
|
-
createVNode("span", { class: "line" }, [
|
|
1917
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
1918
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1919
|
-
createVNode("span", { style: { "color": "#F97583" } }, "type"),
|
|
1920
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " { Plugin } "),
|
|
1921
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
1922
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1923
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'vite'")
|
|
1924
|
-
]),
|
|
1925
|
-
createTextVNode("\n"),
|
|
1926
|
-
createVNode("span", { class: "line" }),
|
|
1927
|
-
createTextVNode("\n"),
|
|
1928
|
-
createVNode("span", { class: "line" }, [
|
|
1929
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// import the locales data in each directory in turn and merge them")
|
|
1930
|
-
]),
|
|
1931
|
-
createTextVNode("\n"),
|
|
1932
|
-
createVNode("span", { class: "line" }, [
|
|
1933
|
-
createVNode("span", { style: { "color": "#F97583" } }, "function"),
|
|
1934
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1935
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "generateLocales"),
|
|
1936
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
1937
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "roots"),
|
|
1938
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
1939
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1940
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "string"),
|
|
1941
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "[]) {")
|
|
1942
|
-
]),
|
|
1943
|
-
createTextVNode("\n"),
|
|
1944
|
-
createVNode("span", { class: "line" }, [
|
|
1945
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1946
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
1947
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1948
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "imports"),
|
|
1949
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
1950
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1951
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "string"),
|
|
1952
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "[] "),
|
|
1953
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
1954
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " [")
|
|
1955
|
-
]),
|
|
1956
|
-
createTextVNode("\n"),
|
|
1957
|
-
createVNode("span", { class: "line" }, [
|
|
1958
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1959
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, `'const messages = { "zh-CN": {}, en: {} }'`),
|
|
1960
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
1961
|
-
]),
|
|
1962
|
-
createTextVNode("\n"),
|
|
1963
|
-
createVNode("span", { class: "line" }, [
|
|
1964
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " ]")
|
|
1965
|
-
]),
|
|
1966
|
-
createTextVNode("\n"),
|
|
1967
|
-
createVNode("span", { class: "line" }, [
|
|
1968
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1969
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
1970
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1971
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "languages"),
|
|
1972
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
1973
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
1974
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " ["),
|
|
1975
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'zh-CN'"),
|
|
1976
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", "),
|
|
1977
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'en'"),
|
|
1978
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "]")
|
|
1979
|
-
]),
|
|
1980
|
-
createTextVNode("\n"),
|
|
1981
|
-
createVNode("span", { class: "line" }),
|
|
1982
|
-
createTextVNode("\n"),
|
|
1983
|
-
createVNode("span", { class: "line" }, [
|
|
1984
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " roots."),
|
|
1985
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "forEach"),
|
|
1986
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(("),
|
|
1987
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "root"),
|
|
1988
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", "),
|
|
1989
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "i"),
|
|
1990
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") "),
|
|
1991
|
-
createVNode("span", { style: { "color": "#F97583" } }, "=>"),
|
|
1992
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
1993
|
-
]),
|
|
1994
|
-
createTextVNode("\n"),
|
|
1995
|
-
createVNode("span", { class: "line" }, [
|
|
1996
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " languages."),
|
|
1997
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "forEach"),
|
|
1998
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(("),
|
|
1999
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "lang"),
|
|
2000
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") "),
|
|
2001
|
-
createVNode("span", { style: { "color": "#F97583" } }, "=>"),
|
|
2002
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
2003
|
-
]),
|
|
2004
|
-
createTextVNode("\n"),
|
|
2005
|
-
createVNode("span", { class: "line" }, [
|
|
2006
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2007
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
2008
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2009
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "langYml"),
|
|
2010
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2011
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
2012
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2013
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "`${"),
|
|
2014
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "root"),
|
|
2015
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "}/locales/${"),
|
|
2016
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "lang"),
|
|
2017
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "}.yml`")
|
|
2018
|
-
]),
|
|
2019
|
-
createTextVNode("\n"),
|
|
2020
|
-
createVNode("span", { class: "line" }, [
|
|
2021
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2022
|
-
createVNode("span", { style: { "color": "#F97583" } }, "if"),
|
|
2023
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " (fs."),
|
|
2024
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "existsSync"),
|
|
2025
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(langYml) "),
|
|
2026
|
-
createVNode("span", { style: { "color": "#F97583" } }, "&&"),
|
|
2027
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " fs."),
|
|
2028
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "readFileSync"),
|
|
2029
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(langYml, "),
|
|
2030
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'utf-8'"),
|
|
2031
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")) {")
|
|
2032
|
-
]),
|
|
2033
|
-
createTextVNode("\n"),
|
|
2034
|
-
createVNode("span", { class: "line" }, [
|
|
2035
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2036
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
2037
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2038
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "varName"),
|
|
2039
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2040
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
2041
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " lang."),
|
|
2042
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "replace"),
|
|
2043
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2044
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'-'"),
|
|
2045
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", "),
|
|
2046
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "''"),
|
|
2047
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") "),
|
|
2048
|
-
createVNode("span", { style: { "color": "#F97583" } }, "+"),
|
|
2049
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " i")
|
|
2050
|
-
]),
|
|
2051
|
-
createTextVNode("\n"),
|
|
2052
|
-
createVNode("span", { class: "line" }, [
|
|
2053
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2054
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// in windows, you need to change slash")
|
|
2055
|
-
]),
|
|
2056
|
-
createTextVNode("\n"),
|
|
2057
|
-
createVNode("span", { class: "line" }, [
|
|
2058
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2059
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// more info you can refer 'packages/valaxy/src/node/plugins/index.ts'")
|
|
2060
|
-
]),
|
|
2061
|
-
createTextVNode("\n"),
|
|
2062
|
-
createVNode("span", { class: "line" }, [
|
|
2063
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " imports."),
|
|
2064
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "push"),
|
|
2065
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2066
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "`import ${"),
|
|
2067
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "varName"),
|
|
2068
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '} from "${'),
|
|
2069
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "langYml"),
|
|
2070
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '}"`'),
|
|
2071
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
2072
|
-
]),
|
|
2073
|
-
createTextVNode("\n"),
|
|
2074
|
-
createVNode("span", { class: "line" }, [
|
|
2075
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " imports."),
|
|
2076
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "push"),
|
|
2077
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2078
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "`Object.assign(messages['${"),
|
|
2079
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "lang"),
|
|
2080
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "}'], ${"),
|
|
2081
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "varName"),
|
|
2082
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "})`"),
|
|
2083
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
2084
|
-
]),
|
|
2085
|
-
createTextVNode("\n"),
|
|
2086
|
-
createVNode("span", { class: "line" }, [
|
|
2087
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
2088
|
-
]),
|
|
2089
|
-
createTextVNode("\n"),
|
|
2090
|
-
createVNode("span", { class: "line" }, [
|
|
2091
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " })")
|
|
2092
|
-
]),
|
|
2093
|
-
createTextVNode("\n"),
|
|
2094
|
-
createVNode("span", { class: "line" }, [
|
|
2095
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " })")
|
|
2096
|
-
]),
|
|
2097
|
-
createTextVNode("\n"),
|
|
2098
|
-
createVNode("span", { class: "line" }),
|
|
2099
|
-
createTextVNode("\n"),
|
|
2100
|
-
createVNode("span", { class: "line" }, [
|
|
2101
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " imports."),
|
|
2102
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "push"),
|
|
2103
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2104
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'export default messages'"),
|
|
2105
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
2106
|
-
]),
|
|
2107
|
-
createTextVNode("\n"),
|
|
2108
|
-
createVNode("span", { class: "line" }, [
|
|
2109
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2110
|
-
createVNode("span", { style: { "color": "#F97583" } }, "return"),
|
|
2111
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " imports."),
|
|
2112
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "join"),
|
|
2113
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2114
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'"),
|
|
2115
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "\\n"),
|
|
2116
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'"),
|
|
2117
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
2118
|
-
]),
|
|
2119
|
-
createTextVNode("\n"),
|
|
2120
|
-
createVNode("span", { class: "line" }, [
|
|
2121
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "}")
|
|
2122
|
-
]),
|
|
2123
|
-
createTextVNode("\n"),
|
|
2124
|
-
createVNode("span", { class: "line" }),
|
|
2125
|
-
createTextVNode("\n"),
|
|
2126
|
-
createVNode("span", { class: "line" }, [
|
|
2127
|
-
createVNode("span", { style: { "color": "#F97583" } }, "export"),
|
|
2128
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2129
|
-
createVNode("span", { style: { "color": "#F97583" } }, "function"),
|
|
2130
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2131
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "createValaxyPlugin"),
|
|
2132
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2133
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "options"),
|
|
2134
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
2135
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2136
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "ResolvedValaxyOptions"),
|
|
2137
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")"),
|
|
2138
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
2139
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2140
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "Plugin"),
|
|
2141
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
2142
|
-
]),
|
|
2143
|
-
createTextVNode("\n"),
|
|
2144
|
-
createVNode("span", { class: "line" }, [
|
|
2145
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2146
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
2147
|
-
]),
|
|
2148
|
-
createTextVNode("\n"),
|
|
2149
|
-
createVNode("span", { class: "line" }, [
|
|
2150
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2151
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
2152
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2153
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "roots"),
|
|
2154
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2155
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
2156
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " [options.clientRoot, options.themeRoot, options.userRoot]")
|
|
2157
|
-
]),
|
|
2158
|
-
createTextVNode("\n"),
|
|
2159
|
-
createVNode("span", { class: "line" }),
|
|
2160
|
-
createTextVNode("\n"),
|
|
2161
|
-
createVNode("span", { class: "line" }, [
|
|
2162
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2163
|
-
createVNode("span", { style: { "color": "#F97583" } }, "return"),
|
|
2164
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
2165
|
-
]),
|
|
2166
|
-
createTextVNode("\n"),
|
|
2167
|
-
createVNode("span", { class: "line" }, [
|
|
2168
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " name: "),
|
|
2169
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'Valaxy'"),
|
|
2170
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
2171
|
-
]),
|
|
2172
|
-
createTextVNode("\n"),
|
|
2173
|
-
createVNode("span", { class: "line" }),
|
|
2174
|
-
createTextVNode("\n"),
|
|
2175
|
-
createVNode("span", { class: "line" }, [
|
|
2176
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2177
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "load"),
|
|
2178
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2179
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "id"),
|
|
2180
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") {")
|
|
2181
|
-
]),
|
|
2182
|
-
createTextVNode("\n"),
|
|
2183
|
-
createVNode("span", { class: "line" }, [
|
|
2184
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2185
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
2186
|
-
]),
|
|
2187
|
-
createTextVNode("\n"),
|
|
2188
|
-
createVNode("span", { class: "line" }, [
|
|
2189
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2190
|
-
createVNode("span", { style: { "color": "#F97583" } }, "if"),
|
|
2191
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " (id "),
|
|
2192
|
-
createVNode("span", { style: { "color": "#F97583" } }, "==="),
|
|
2193
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2194
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'/@valaxyjs/locales'"),
|
|
2195
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ")")
|
|
2196
|
-
]),
|
|
2197
|
-
createTextVNode("\n"),
|
|
2198
|
-
createVNode("span", { class: "line" }, [
|
|
2199
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2200
|
-
createVNode("span", { style: { "color": "#F97583" } }, "return"),
|
|
2201
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2202
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "generateLocales"),
|
|
2203
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(roots)")
|
|
2204
|
-
]),
|
|
2205
|
-
createTextVNode("\n"),
|
|
2206
|
-
createVNode("span", { class: "line" }, [
|
|
2207
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " },")
|
|
2208
|
-
]),
|
|
2209
|
-
createTextVNode("\n"),
|
|
2210
|
-
createVNode("span", { class: "line" }),
|
|
2211
|
-
createTextVNode("\n"),
|
|
2212
|
-
createVNode("span", { class: "line" }, [
|
|
2213
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2214
|
-
createVNode("span", { style: { "color": "#F97583" } }, "async"),
|
|
2215
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2216
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "handleHotUpdate"),
|
|
2217
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
2218
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "ctx"),
|
|
2219
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") {")
|
|
2220
|
-
]),
|
|
2221
|
-
createTextVNode("\n"),
|
|
2222
|
-
createVNode("span", { class: "line" }, [
|
|
2223
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2224
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
2225
|
-
]),
|
|
2226
|
-
createTextVNode("\n"),
|
|
2227
|
-
createVNode("span", { class: "line" }, [
|
|
2228
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " },")
|
|
2229
|
-
]),
|
|
2230
|
-
createTextVNode("\n"),
|
|
2231
|
-
createVNode("span", { class: "line" }, [
|
|
2232
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
2233
|
-
]),
|
|
2234
|
-
createTextVNode("\n"),
|
|
2235
|
-
createVNode("span", { class: "line" }, [
|
|
2236
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "}")
|
|
2237
|
-
])
|
|
2238
|
-
])
|
|
2239
|
-
]),
|
|
2240
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
2241
|
-
createVNode("code", null, [
|
|
2242
|
-
createVNode("span", { class: "line" }, [
|
|
2243
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
2244
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2245
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "type"),
|
|
2246
|
-
createVNode("span", { style: { "color": "#24292E" } }, " { Plugin } "),
|
|
2247
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
2248
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2249
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'vite'")
|
|
2250
|
-
]),
|
|
2251
|
-
createTextVNode("\n"),
|
|
2252
|
-
createVNode("span", { class: "line" }),
|
|
2253
|
-
createTextVNode("\n"),
|
|
2254
|
-
createVNode("span", { class: "line" }, [
|
|
2255
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// import the locales data in each directory in turn and merge them")
|
|
2256
|
-
]),
|
|
2257
|
-
createTextVNode("\n"),
|
|
2258
|
-
createVNode("span", { class: "line" }, [
|
|
2259
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "function"),
|
|
2260
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2261
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "generateLocales"),
|
|
2262
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2263
|
-
createVNode("span", { style: { "color": "#E36209" } }, "roots"),
|
|
2264
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
2265
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2266
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "string"),
|
|
2267
|
-
createVNode("span", { style: { "color": "#24292E" } }, "[]) {")
|
|
2268
|
-
]),
|
|
2269
|
-
createTextVNode("\n"),
|
|
2270
|
-
createVNode("span", { class: "line" }, [
|
|
2271
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2272
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
2273
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2274
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "imports"),
|
|
2275
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
2276
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2277
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "string"),
|
|
2278
|
-
createVNode("span", { style: { "color": "#24292E" } }, "[] "),
|
|
2279
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
2280
|
-
createVNode("span", { style: { "color": "#24292E" } }, " [")
|
|
2281
|
-
]),
|
|
2282
|
-
createTextVNode("\n"),
|
|
2283
|
-
createVNode("span", { class: "line" }, [
|
|
2284
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2285
|
-
createVNode("span", { style: { "color": "#032F62" } }, `'const messages = { "zh-CN": {}, en: {} }'`),
|
|
2286
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
2287
|
-
]),
|
|
2288
|
-
createTextVNode("\n"),
|
|
2289
|
-
createVNode("span", { class: "line" }, [
|
|
2290
|
-
createVNode("span", { style: { "color": "#24292E" } }, " ]")
|
|
2291
|
-
]),
|
|
2292
|
-
createTextVNode("\n"),
|
|
2293
|
-
createVNode("span", { class: "line" }, [
|
|
2294
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2295
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
2296
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2297
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "languages"),
|
|
2298
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2299
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
2300
|
-
createVNode("span", { style: { "color": "#24292E" } }, " ["),
|
|
2301
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'zh-CN'"),
|
|
2302
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", "),
|
|
2303
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'en'"),
|
|
2304
|
-
createVNode("span", { style: { "color": "#24292E" } }, "]")
|
|
2305
|
-
]),
|
|
2306
|
-
createTextVNode("\n"),
|
|
2307
|
-
createVNode("span", { class: "line" }),
|
|
2308
|
-
createTextVNode("\n"),
|
|
2309
|
-
createVNode("span", { class: "line" }, [
|
|
2310
|
-
createVNode("span", { style: { "color": "#24292E" } }, " roots."),
|
|
2311
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "forEach"),
|
|
2312
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(("),
|
|
2313
|
-
createVNode("span", { style: { "color": "#E36209" } }, "root"),
|
|
2314
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", "),
|
|
2315
|
-
createVNode("span", { style: { "color": "#E36209" } }, "i"),
|
|
2316
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") "),
|
|
2317
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "=>"),
|
|
2318
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
2319
|
-
]),
|
|
2320
|
-
createTextVNode("\n"),
|
|
2321
|
-
createVNode("span", { class: "line" }, [
|
|
2322
|
-
createVNode("span", { style: { "color": "#24292E" } }, " languages."),
|
|
2323
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "forEach"),
|
|
2324
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(("),
|
|
2325
|
-
createVNode("span", { style: { "color": "#E36209" } }, "lang"),
|
|
2326
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") "),
|
|
2327
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "=>"),
|
|
2328
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
2329
|
-
]),
|
|
2330
|
-
createTextVNode("\n"),
|
|
2331
|
-
createVNode("span", { class: "line" }, [
|
|
2332
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2333
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
2334
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2335
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "langYml"),
|
|
2336
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2337
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
2338
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2339
|
-
createVNode("span", { style: { "color": "#032F62" } }, "`${"),
|
|
2340
|
-
createVNode("span", { style: { "color": "#24292E" } }, "root"),
|
|
2341
|
-
createVNode("span", { style: { "color": "#032F62" } }, "}/locales/${"),
|
|
2342
|
-
createVNode("span", { style: { "color": "#24292E" } }, "lang"),
|
|
2343
|
-
createVNode("span", { style: { "color": "#032F62" } }, "}.yml`")
|
|
2344
|
-
]),
|
|
2345
|
-
createTextVNode("\n"),
|
|
2346
|
-
createVNode("span", { class: "line" }, [
|
|
2347
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2348
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "if"),
|
|
2349
|
-
createVNode("span", { style: { "color": "#24292E" } }, " (fs."),
|
|
2350
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "existsSync"),
|
|
2351
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(langYml) "),
|
|
2352
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "&&"),
|
|
2353
|
-
createVNode("span", { style: { "color": "#24292E" } }, " fs."),
|
|
2354
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "readFileSync"),
|
|
2355
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(langYml, "),
|
|
2356
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'utf-8'"),
|
|
2357
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")) {")
|
|
2358
|
-
]),
|
|
2359
|
-
createTextVNode("\n"),
|
|
2360
|
-
createVNode("span", { class: "line" }, [
|
|
2361
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2362
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
2363
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2364
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "varName"),
|
|
2365
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2366
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
2367
|
-
createVNode("span", { style: { "color": "#24292E" } }, " lang."),
|
|
2368
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "replace"),
|
|
2369
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2370
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'-'"),
|
|
2371
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", "),
|
|
2372
|
-
createVNode("span", { style: { "color": "#032F62" } }, "''"),
|
|
2373
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") "),
|
|
2374
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "+"),
|
|
2375
|
-
createVNode("span", { style: { "color": "#24292E" } }, " i")
|
|
2376
|
-
]),
|
|
2377
|
-
createTextVNode("\n"),
|
|
2378
|
-
createVNode("span", { class: "line" }, [
|
|
2379
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2380
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// in windows, you need to change slash")
|
|
2381
|
-
]),
|
|
2382
|
-
createTextVNode("\n"),
|
|
2383
|
-
createVNode("span", { class: "line" }, [
|
|
2384
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2385
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// more info you can refer 'packages/valaxy/src/node/plugins/index.ts'")
|
|
2386
|
-
]),
|
|
2387
|
-
createTextVNode("\n"),
|
|
2388
|
-
createVNode("span", { class: "line" }, [
|
|
2389
|
-
createVNode("span", { style: { "color": "#24292E" } }, " imports."),
|
|
2390
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "push"),
|
|
2391
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2392
|
-
createVNode("span", { style: { "color": "#032F62" } }, "`import ${"),
|
|
2393
|
-
createVNode("span", { style: { "color": "#24292E" } }, "varName"),
|
|
2394
|
-
createVNode("span", { style: { "color": "#032F62" } }, '} from "${'),
|
|
2395
|
-
createVNode("span", { style: { "color": "#24292E" } }, "langYml"),
|
|
2396
|
-
createVNode("span", { style: { "color": "#032F62" } }, '}"`'),
|
|
2397
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
2398
|
-
]),
|
|
2399
|
-
createTextVNode("\n"),
|
|
2400
|
-
createVNode("span", { class: "line" }, [
|
|
2401
|
-
createVNode("span", { style: { "color": "#24292E" } }, " imports."),
|
|
2402
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "push"),
|
|
2403
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2404
|
-
createVNode("span", { style: { "color": "#032F62" } }, "`Object.assign(messages['${"),
|
|
2405
|
-
createVNode("span", { style: { "color": "#24292E" } }, "lang"),
|
|
2406
|
-
createVNode("span", { style: { "color": "#032F62" } }, "}'], ${"),
|
|
2407
|
-
createVNode("span", { style: { "color": "#24292E" } }, "varName"),
|
|
2408
|
-
createVNode("span", { style: { "color": "#032F62" } }, "})`"),
|
|
2409
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
2410
|
-
]),
|
|
2411
|
-
createTextVNode("\n"),
|
|
2412
|
-
createVNode("span", { class: "line" }, [
|
|
2413
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
2414
|
-
]),
|
|
2415
|
-
createTextVNode("\n"),
|
|
2416
|
-
createVNode("span", { class: "line" }, [
|
|
2417
|
-
createVNode("span", { style: { "color": "#24292E" } }, " })")
|
|
2418
|
-
]),
|
|
2419
|
-
createTextVNode("\n"),
|
|
2420
|
-
createVNode("span", { class: "line" }, [
|
|
2421
|
-
createVNode("span", { style: { "color": "#24292E" } }, " })")
|
|
2422
|
-
]),
|
|
2423
|
-
createTextVNode("\n"),
|
|
2424
|
-
createVNode("span", { class: "line" }),
|
|
2425
|
-
createTextVNode("\n"),
|
|
2426
|
-
createVNode("span", { class: "line" }, [
|
|
2427
|
-
createVNode("span", { style: { "color": "#24292E" } }, " imports."),
|
|
2428
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "push"),
|
|
2429
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2430
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'export default messages'"),
|
|
2431
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
2432
|
-
]),
|
|
2433
|
-
createTextVNode("\n"),
|
|
2434
|
-
createVNode("span", { class: "line" }, [
|
|
2435
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2436
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "return"),
|
|
2437
|
-
createVNode("span", { style: { "color": "#24292E" } }, " imports."),
|
|
2438
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "join"),
|
|
2439
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2440
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'"),
|
|
2441
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "\\n"),
|
|
2442
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'"),
|
|
2443
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
2444
|
-
]),
|
|
2445
|
-
createTextVNode("\n"),
|
|
2446
|
-
createVNode("span", { class: "line" }, [
|
|
2447
|
-
createVNode("span", { style: { "color": "#24292E" } }, "}")
|
|
2448
|
-
]),
|
|
2449
|
-
createTextVNode("\n"),
|
|
2450
|
-
createVNode("span", { class: "line" }),
|
|
2451
|
-
createTextVNode("\n"),
|
|
2452
|
-
createVNode("span", { class: "line" }, [
|
|
2453
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "export"),
|
|
2454
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2455
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "function"),
|
|
2456
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2457
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "createValaxyPlugin"),
|
|
2458
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2459
|
-
createVNode("span", { style: { "color": "#E36209" } }, "options"),
|
|
2460
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
2461
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2462
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "ResolvedValaxyOptions"),
|
|
2463
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")"),
|
|
2464
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
2465
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2466
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "Plugin"),
|
|
2467
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
2468
|
-
]),
|
|
2469
|
-
createTextVNode("\n"),
|
|
2470
|
-
createVNode("span", { class: "line" }, [
|
|
2471
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2472
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
2473
|
-
]),
|
|
2474
|
-
createTextVNode("\n"),
|
|
2475
|
-
createVNode("span", { class: "line" }, [
|
|
2476
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2477
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
2478
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2479
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "roots"),
|
|
2480
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2481
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
2482
|
-
createVNode("span", { style: { "color": "#24292E" } }, " [options.clientRoot, options.themeRoot, options.userRoot]")
|
|
2483
|
-
]),
|
|
2484
|
-
createTextVNode("\n"),
|
|
2485
|
-
createVNode("span", { class: "line" }),
|
|
2486
|
-
createTextVNode("\n"),
|
|
2487
|
-
createVNode("span", { class: "line" }, [
|
|
2488
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2489
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "return"),
|
|
2490
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
2491
|
-
]),
|
|
2492
|
-
createTextVNode("\n"),
|
|
2493
|
-
createVNode("span", { class: "line" }, [
|
|
2494
|
-
createVNode("span", { style: { "color": "#24292E" } }, " name: "),
|
|
2495
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'Valaxy'"),
|
|
2496
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
2497
|
-
]),
|
|
2498
|
-
createTextVNode("\n"),
|
|
2499
|
-
createVNode("span", { class: "line" }),
|
|
2500
|
-
createTextVNode("\n"),
|
|
2501
|
-
createVNode("span", { class: "line" }, [
|
|
2502
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2503
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "load"),
|
|
2504
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2505
|
-
createVNode("span", { style: { "color": "#E36209" } }, "id"),
|
|
2506
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") {")
|
|
2507
|
-
]),
|
|
2508
|
-
createTextVNode("\n"),
|
|
2509
|
-
createVNode("span", { class: "line" }, [
|
|
2510
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2511
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
2512
|
-
]),
|
|
2513
|
-
createTextVNode("\n"),
|
|
2514
|
-
createVNode("span", { class: "line" }, [
|
|
2515
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2516
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "if"),
|
|
2517
|
-
createVNode("span", { style: { "color": "#24292E" } }, " (id "),
|
|
2518
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "==="),
|
|
2519
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2520
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'/@valaxyjs/locales'"),
|
|
2521
|
-
createVNode("span", { style: { "color": "#24292E" } }, ")")
|
|
2522
|
-
]),
|
|
2523
|
-
createTextVNode("\n"),
|
|
2524
|
-
createVNode("span", { class: "line" }, [
|
|
2525
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2526
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "return"),
|
|
2527
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2528
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "generateLocales"),
|
|
2529
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(roots)")
|
|
2530
|
-
]),
|
|
2531
|
-
createTextVNode("\n"),
|
|
2532
|
-
createVNode("span", { class: "line" }, [
|
|
2533
|
-
createVNode("span", { style: { "color": "#24292E" } }, " },")
|
|
2534
|
-
]),
|
|
2535
|
-
createTextVNode("\n"),
|
|
2536
|
-
createVNode("span", { class: "line" }),
|
|
2537
|
-
createTextVNode("\n"),
|
|
2538
|
-
createVNode("span", { class: "line" }, [
|
|
2539
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2540
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "async"),
|
|
2541
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2542
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "handleHotUpdate"),
|
|
2543
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
2544
|
-
createVNode("span", { style: { "color": "#E36209" } }, "ctx"),
|
|
2545
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") {")
|
|
2546
|
-
]),
|
|
2547
|
-
createTextVNode("\n"),
|
|
2548
|
-
createVNode("span", { class: "line" }, [
|
|
2549
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2550
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
2551
|
-
]),
|
|
2552
|
-
createTextVNode("\n"),
|
|
2553
|
-
createVNode("span", { class: "line" }, [
|
|
2554
|
-
createVNode("span", { style: { "color": "#24292E" } }, " },")
|
|
2555
|
-
]),
|
|
2556
|
-
createTextVNode("\n"),
|
|
2557
|
-
createVNode("span", { class: "line" }, [
|
|
2558
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
2559
|
-
]),
|
|
2560
|
-
createTextVNode("\n"),
|
|
2561
|
-
createVNode("span", { class: "line" }, [
|
|
2562
|
-
createVNode("span", { style: { "color": "#24292E" } }, "}")
|
|
2563
|
-
])
|
|
2564
|
-
])
|
|
2565
|
-
])
|
|
2566
|
-
]),
|
|
2567
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2568
|
-
createVNode("p", null, "最后在 i18n 的初始化文件加载:")
|
|
2569
|
-
]),
|
|
2570
|
-
createVNode("div", { lang: "en" }, [
|
|
2571
|
-
createVNode("p", null, "Finally load in the i18n initialization file:")
|
|
2572
|
-
]),
|
|
2573
|
-
createVNode("div", { class: "language-ts" }, [
|
|
2574
|
-
createVNode("button", {
|
|
2575
|
-
title: "Copy Code",
|
|
2576
|
-
class: "copy"
|
|
2577
|
-
}),
|
|
2578
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
2579
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
2580
|
-
createVNode("code", null, [
|
|
2581
|
-
createVNode("span", { class: "line" }, [
|
|
2582
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// i18n.ts")
|
|
2583
|
-
]),
|
|
2584
|
-
createTextVNode("\n"),
|
|
2585
|
-
createVNode("span", { class: "line" }, [
|
|
2586
|
-
createVNode("span", { style: { "color": "#F97583" } }, "import"),
|
|
2587
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " messages "),
|
|
2588
|
-
createVNode("span", { style: { "color": "#F97583" } }, "from"),
|
|
2589
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2590
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'/@valaxyjs/locales'")
|
|
2591
|
-
]),
|
|
2592
|
-
createTextVNode("\n"),
|
|
2593
|
-
createVNode("span", { class: "line" }),
|
|
2594
|
-
createTextVNode("\n"),
|
|
2595
|
-
createVNode("span", { class: "line" }, [
|
|
2596
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
2597
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2598
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "i18n"),
|
|
2599
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2600
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
2601
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
2602
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "createI18n"),
|
|
2603
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "({")
|
|
2604
|
-
]),
|
|
2605
|
-
createTextVNode("\n"),
|
|
2606
|
-
createVNode("span", { class: "line" }, [
|
|
2607
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " legacy: "),
|
|
2608
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "false"),
|
|
2609
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
2610
|
-
]),
|
|
2611
|
-
createTextVNode("\n"),
|
|
2612
|
-
createVNode("span", { class: "line" }, [
|
|
2613
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " locale: "),
|
|
2614
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'en'"),
|
|
2615
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
2616
|
-
]),
|
|
2617
|
-
createTextVNode("\n"),
|
|
2618
|
-
createVNode("span", { class: "line" }, [
|
|
2619
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " messages,")
|
|
2620
|
-
]),
|
|
2621
|
-
createTextVNode("\n"),
|
|
2622
|
-
createVNode("span", { class: "line" }, [
|
|
2623
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "})")
|
|
2624
|
-
]),
|
|
2625
|
-
createTextVNode("\n"),
|
|
2626
|
-
createVNode("span", { class: "line" }, [
|
|
2627
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "app."),
|
|
2628
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "use"),
|
|
2629
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(i18n)")
|
|
2630
|
-
])
|
|
2631
|
-
])
|
|
2632
|
-
]),
|
|
2633
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
2634
|
-
createVNode("code", null, [
|
|
2635
|
-
createVNode("span", { class: "line" }, [
|
|
2636
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// i18n.ts")
|
|
2637
|
-
]),
|
|
2638
|
-
createTextVNode("\n"),
|
|
2639
|
-
createVNode("span", { class: "line" }, [
|
|
2640
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "import"),
|
|
2641
|
-
createVNode("span", { style: { "color": "#24292E" } }, " messages "),
|
|
2642
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "from"),
|
|
2643
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2644
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'/@valaxyjs/locales'")
|
|
2645
|
-
]),
|
|
2646
|
-
createTextVNode("\n"),
|
|
2647
|
-
createVNode("span", { class: "line" }),
|
|
2648
|
-
createTextVNode("\n"),
|
|
2649
|
-
createVNode("span", { class: "line" }, [
|
|
2650
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
2651
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2652
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "i18n"),
|
|
2653
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2654
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
2655
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
2656
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "createI18n"),
|
|
2657
|
-
createVNode("span", { style: { "color": "#24292E" } }, "({")
|
|
2658
|
-
]),
|
|
2659
|
-
createTextVNode("\n"),
|
|
2660
|
-
createVNode("span", { class: "line" }, [
|
|
2661
|
-
createVNode("span", { style: { "color": "#24292E" } }, " legacy: "),
|
|
2662
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "false"),
|
|
2663
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
2664
|
-
]),
|
|
2665
|
-
createTextVNode("\n"),
|
|
2666
|
-
createVNode("span", { class: "line" }, [
|
|
2667
|
-
createVNode("span", { style: { "color": "#24292E" } }, " locale: "),
|
|
2668
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'en'"),
|
|
2669
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
2670
|
-
]),
|
|
2671
|
-
createTextVNode("\n"),
|
|
2672
|
-
createVNode("span", { class: "line" }, [
|
|
2673
|
-
createVNode("span", { style: { "color": "#24292E" } }, " messages,")
|
|
2674
|
-
]),
|
|
2675
|
-
createTextVNode("\n"),
|
|
2676
|
-
createVNode("span", { class: "line" }, [
|
|
2677
|
-
createVNode("span", { style: { "color": "#24292E" } }, "})")
|
|
2678
|
-
]),
|
|
2679
|
-
createTextVNode("\n"),
|
|
2680
|
-
createVNode("span", { class: "line" }, [
|
|
2681
|
-
createVNode("span", { style: { "color": "#24292E" } }, "app."),
|
|
2682
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "use"),
|
|
2683
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(i18n)")
|
|
2684
|
-
])
|
|
2685
|
-
])
|
|
2686
|
-
])
|
|
2687
|
-
]),
|
|
2688
|
-
createVNode("h2", {
|
|
2689
|
-
id: "css-i18n-another-solution",
|
|
2690
|
-
tabindex: "-1"
|
|
2691
|
-
}, [
|
|
2692
|
-
createTextVNode("CSS i18n - Another solution "),
|
|
2693
|
-
createVNode(_component_AppLink, {
|
|
2694
|
-
class: "header-anchor",
|
|
2695
|
-
href: "#css-i18n-another-solution",
|
|
2696
|
-
"aria-label": 'Permalink to "CSS i18n - Another solution"'
|
|
2697
|
-
}, {
|
|
2698
|
-
default: withCtx(() => [
|
|
2699
|
-
createTextVNode("")
|
|
2700
|
-
]),
|
|
2701
|
-
_: 1
|
|
2702
|
-
/* STABLE */
|
|
2703
|
-
})
|
|
2704
|
-
]),
|
|
2705
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2706
|
-
createVNode("blockquote", null, [
|
|
2707
|
-
createVNode("p", null, "CSS i18n - 另一种互补解决方案")
|
|
2708
|
-
])
|
|
2709
|
-
]),
|
|
2710
|
-
createVNode("div", { lang: "en" }, [
|
|
2711
|
-
createVNode("blockquote", null, [
|
|
2712
|
-
createVNode("p", null, "CSS i18n - Another complementary solution")
|
|
2713
|
-
])
|
|
2714
|
-
]),
|
|
2715
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2716
|
-
createVNode("p", null, [
|
|
2717
|
-
createTextVNode("文章部分拥有大段的文本,而 "),
|
|
2718
|
-
createVNode("code", null, "vue-i18n"),
|
|
2719
|
-
createTextVNode(" 的场景则在于一些独立的字段翻译。")
|
|
2720
|
-
]),
|
|
2721
|
-
createVNode("p", null, [
|
|
2722
|
-
createTextVNode("而传统的分文件独立管理的方式,对于博客来说其实并不方便。"),
|
|
2723
|
-
createVNode("br"),
|
|
2724
|
-
createTextVNode(" 大多数情况,你并不会想专门建立一个文件夹来管理它。")
|
|
2725
|
-
]),
|
|
2726
|
-
createVNode("p", null, "因此我尝试使用纯 CSS 解决该问题。")
|
|
2727
|
-
]),
|
|
2728
|
-
createVNode("div", { lang: "en" }, [
|
|
2729
|
-
createVNode("p", null, [
|
|
2730
|
-
createTextVNode("While the article section has large sections of text, the scenario of "),
|
|
2731
|
-
createVNode("code", null, "vue-i18n"),
|
|
2732
|
-
createTextVNode(" lies in some separate field translations.")
|
|
2733
|
-
]),
|
|
2734
|
-
createVNode("p", null, [
|
|
2735
|
-
createTextVNode("And the traditional way of managing them independently in separate files is not really convenient for blogs."),
|
|
2736
|
-
createVNode("br"),
|
|
2737
|
-
createTextVNode(" In most cases, you don't want to create a dedicated folder to manage it.")
|
|
2738
|
-
]),
|
|
2739
|
-
createVNode("p", null, "So I tried to solve the problem using pure CSS.")
|
|
2740
|
-
]),
|
|
2741
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2742
|
-
createVNode("div", { class: "tip custom-block" }, [
|
|
2743
|
-
createVNode("p", { class: "custom-block-title" }, [
|
|
2744
|
-
createVNode("i", { class: "icon i-carbon-thumbs-up" }),
|
|
2745
|
-
createVNode("span", { lang: "en" }, "思路"),
|
|
2746
|
-
createVNode("span", { lang: "zh-CN" }, "思路")
|
|
2747
|
-
]),
|
|
2748
|
-
createVNode("p", null, [
|
|
2749
|
-
createTextVNode("即借助 CSS 规则,根据对应语言,显示对应区块内容。"),
|
|
2750
|
-
createVNode("br"),
|
|
2751
|
-
createTextVNode(" 大体方案:通过 "),
|
|
2752
|
-
createVNode(_component_AppLink, {
|
|
2753
|
-
href: "https://github.com/markdown-it/markdown-it-container",
|
|
2754
|
-
target: "_blank",
|
|
2755
|
-
rel: "noreferrer"
|
|
2756
|
-
}, {
|
|
2757
|
-
default: withCtx(() => [
|
|
2758
|
-
createTextVNode("markdown-it-container")
|
|
2759
|
-
]),
|
|
2760
|
-
_: 1
|
|
2761
|
-
/* STABLE */
|
|
2762
|
-
}),
|
|
2763
|
-
createTextVNode(" 设置 fence 预编译 Markdown, 为需要进行 i18n 的段落包裹新的 "),
|
|
2764
|
-
createVNode("code", null, '<div lang="zh-CN"></div>'),
|
|
2765
|
-
createTextVNode(",并使用 CSS 默认隐藏它们。 当页面初始化或切换语言时,为 html 添加对应语言类,编写对应 CSS 以在该类下显示对应语言的区块。")
|
|
2766
|
-
])
|
|
2767
|
-
])
|
|
2768
|
-
]),
|
|
2769
|
-
createVNode("div", { lang: "en" }, [
|
|
2770
|
-
createVNode("div", { class: "tip custom-block" }, [
|
|
2771
|
-
createVNode("p", { class: "custom-block-title" }, [
|
|
2772
|
-
createVNode("i", { class: "icon i-carbon-thumbs-up" }),
|
|
2773
|
-
createVNode("span", { lang: "en" }, "IDEA"),
|
|
2774
|
-
createVNode("span", { lang: "zh-CN" }, "IDEA")
|
|
2775
|
-
]),
|
|
2776
|
-
createVNode("p", null, [
|
|
2777
|
-
createTextVNode("That is, with the help of CSS rules, the content of the corresponding block is displayed according to the corresponding language."),
|
|
2778
|
-
createVNode("br"),
|
|
2779
|
-
createTextVNode(" The general solution: set fence to pre-compile Markdown via "),
|
|
2780
|
-
createVNode(_component_AppLink, {
|
|
2781
|
-
href: "https://github.com/markdown-it/markdown-it-container",
|
|
2782
|
-
target: "_blank",
|
|
2783
|
-
rel: "noreferrer"
|
|
2784
|
-
}, {
|
|
2785
|
-
default: withCtx(() => [
|
|
2786
|
-
createTextVNode("markdown-it-container")
|
|
2787
|
-
]),
|
|
2788
|
-
_: 1
|
|
2789
|
-
/* STABLE */
|
|
2790
|
-
}),
|
|
2791
|
-
createTextVNode(". Wrap new "),
|
|
2792
|
-
createVNode("code", null, '<div lang="zh-CN"></div>'),
|
|
2793
|
-
createTextVNode("s for the paragraphs that need to be i18n and hide them by default with CSS. When the page initializes or switches languages, add the corresponding language class to html and write the corresponding CSS to display the corresponding language block under that class.")
|
|
2794
|
-
])
|
|
2795
|
-
])
|
|
2796
|
-
]),
|
|
2797
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2798
|
-
createVNode("p", null, [
|
|
2799
|
-
createVNode("strong", null, "优势"),
|
|
2800
|
-
createTextVNode(":")
|
|
2801
|
-
]),
|
|
2802
|
-
createVNode("ul", null, [
|
|
2803
|
-
createVNode("li", null, "可在同一个 Markdown 文件中进行维护,书写便捷"),
|
|
2804
|
-
createVNode("li", null, "预加载与实时切换"),
|
|
2805
|
-
createVNode("li", null, "URL 不变,便于管理与分享,且切换无需刷新页面"),
|
|
2806
|
-
createVNode("li", null, "渐进式翻译(只翻译部分内容并可共用示例内容等)")
|
|
2807
|
-
]),
|
|
2808
|
-
createVNode("p", null, [
|
|
2809
|
-
createVNode("strong", null, "劣势"),
|
|
2810
|
-
createTextVNode(":")
|
|
2811
|
-
]),
|
|
2812
|
-
createVNode("ul", null, [
|
|
2813
|
-
createVNode("li", null, "多语言内容被渲染在同一页面中,增加冗余(但我觉得这微小的体积完全是可以接受的)")
|
|
2814
|
-
])
|
|
2815
|
-
]),
|
|
2816
|
-
createVNode("div", { lang: "en" }, [
|
|
2817
|
-
createVNode("p", null, [
|
|
2818
|
-
createVNode("strong", null, "Advantages"),
|
|
2819
|
-
createTextVNode(":")
|
|
2820
|
-
]),
|
|
2821
|
-
createVNode("ul", null, [
|
|
2822
|
-
createVNode("li", null, "Can be maintained in the same Markdown file, easy to write"),
|
|
2823
|
-
createVNode("li", null, "Pre-loading and real-time switching"),
|
|
2824
|
-
createVNode("li", null, "URLs remain unchanged, easy to manage and share, and switch without refreshing the page")
|
|
2825
|
-
]),
|
|
2826
|
-
createVNode("p", null, [
|
|
2827
|
-
createVNode("strong", null, "Disadvantages"),
|
|
2828
|
-
createTextVNode(":")
|
|
2829
|
-
]),
|
|
2830
|
-
createVNode("ul", null, [
|
|
2831
|
-
createVNode("li", null, "Multi-language content is rendered in the same page, adding redundancy (but I think the tiny size is perfectly acceptable)")
|
|
2832
|
-
])
|
|
2833
|
-
]),
|
|
2834
|
-
createVNode("h3", {
|
|
2835
|
-
id: "result",
|
|
2836
|
-
tabindex: "-1"
|
|
2837
|
-
}, [
|
|
2838
|
-
createTextVNode("Result "),
|
|
2839
|
-
createVNode(_component_AppLink, {
|
|
2840
|
-
class: "header-anchor",
|
|
2841
|
-
href: "#result",
|
|
2842
|
-
"aria-label": 'Permalink to "Result"'
|
|
2843
|
-
}, {
|
|
2844
|
-
default: withCtx(() => [
|
|
2845
|
-
createTextVNode("")
|
|
2846
|
-
]),
|
|
2847
|
-
_: 1
|
|
2848
|
-
/* STABLE */
|
|
2849
|
-
})
|
|
2850
|
-
]),
|
|
2851
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2852
|
-
createVNode("p", null, [
|
|
2853
|
-
createVNode("strong", null, "效果如下"),
|
|
2854
|
-
createTextVNode("(点击按钮切换):")
|
|
2855
|
-
])
|
|
2856
|
-
]),
|
|
2857
|
-
createVNode("div", { lang: "en" }, [
|
|
2858
|
-
createVNode("p", null, [
|
|
2859
|
-
createVNode("strong", null, "The effect is as follows"),
|
|
2860
|
-
createTextVNode(" (click the button to switch).")
|
|
2861
|
-
])
|
|
2862
|
-
]),
|
|
2863
|
-
createVNode(_component_PressToggleLocale, { class: "shadow" }),
|
|
2864
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2865
|
-
createVNode("p", null, "另一种 i18n 方案。"),
|
|
2866
|
-
createVNode("blockquote", null, [
|
|
2867
|
-
createVNode("p", null, "更多内容:...")
|
|
2868
|
-
])
|
|
2869
|
-
]),
|
|
2870
|
-
createVNode("div", { lang: "en" }, [
|
|
2871
|
-
createVNode("p", null, "Another i18n method."),
|
|
2872
|
-
createVNode("blockquote", null, [
|
|
2873
|
-
createVNode("p", null, "More info...")
|
|
2874
|
-
])
|
|
2875
|
-
]),
|
|
2876
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2877
|
-
createVNode("p", null, "中文")
|
|
2878
|
-
]),
|
|
2879
|
-
createVNode("div", { lang: "en" }, [
|
|
2880
|
-
createVNode("p", null, "English")
|
|
2881
|
-
]),
|
|
2882
|
-
createVNode("hr"),
|
|
2883
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
2884
|
-
createVNode("p", null, [
|
|
2885
|
-
createVNode("strong", null, "书写方式"),
|
|
2886
|
-
createTextVNode("如下:")
|
|
2887
|
-
])
|
|
2888
|
-
]),
|
|
2889
|
-
createVNode("div", { lang: "en" }, [
|
|
2890
|
-
createVNode("p", null, [
|
|
2891
|
-
createVNode("strong", null, "Written like this"),
|
|
2892
|
-
createTextVNode(":")
|
|
2893
|
-
])
|
|
2894
|
-
]),
|
|
2895
|
-
createVNode("div", { class: "language-md" }, [
|
|
2896
|
-
createVNode("button", {
|
|
2897
|
-
title: "Copy Code",
|
|
2898
|
-
class: "copy"
|
|
2899
|
-
}),
|
|
2900
|
-
createVNode("span", { class: "lang" }, "md"),
|
|
2901
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
2902
|
-
createVNode("code", null, [
|
|
2903
|
-
createVNode("span", { class: "line" }, [
|
|
2904
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "::: zh-CN")
|
|
2905
|
-
]),
|
|
2906
|
-
createTextVNode("\n"),
|
|
2907
|
-
createVNode("span", { class: "line" }, [
|
|
2908
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "另一种 i18n 方案。")
|
|
2909
|
-
]),
|
|
2910
|
-
createTextVNode("\n"),
|
|
2911
|
-
createVNode("span", { class: "line" }),
|
|
2912
|
-
createTextVNode("\n"),
|
|
2913
|
-
createVNode("span", { class: "line" }, [
|
|
2914
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "更多内容:...")
|
|
2915
|
-
]),
|
|
2916
|
-
createTextVNode("\n"),
|
|
2917
|
-
createVNode("span", { class: "line" }, [
|
|
2918
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":::")
|
|
2919
|
-
]),
|
|
2920
|
-
createTextVNode("\n"),
|
|
2921
|
-
createVNode("span", { class: "line" }),
|
|
2922
|
-
createTextVNode("\n"),
|
|
2923
|
-
createVNode("span", { class: "line" }, [
|
|
2924
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "::: en")
|
|
2925
|
-
]),
|
|
2926
|
-
createTextVNode("\n"),
|
|
2927
|
-
createVNode("span", { class: "line" }, [
|
|
2928
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "Another i18n method.")
|
|
2929
|
-
]),
|
|
2930
|
-
createTextVNode("\n"),
|
|
2931
|
-
createVNode("span", { class: "line" }),
|
|
2932
|
-
createTextVNode("\n"),
|
|
2933
|
-
createVNode("span", { class: "line" }, [
|
|
2934
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "More info...")
|
|
2935
|
-
]),
|
|
2936
|
-
createTextVNode("\n"),
|
|
2937
|
-
createVNode("span", { class: "line" }, [
|
|
2938
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":::")
|
|
2939
|
-
]),
|
|
2940
|
-
createTextVNode("\n"),
|
|
2941
|
-
createVNode("span", { class: "line" }),
|
|
2942
|
-
createTextVNode("\n"),
|
|
2943
|
-
createVNode("span", { class: "line" }, [
|
|
2944
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "::: zh-CN")
|
|
2945
|
-
]),
|
|
2946
|
-
createTextVNode("\n"),
|
|
2947
|
-
createVNode("span", { class: "line" }, [
|
|
2948
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "中文")
|
|
2949
|
-
]),
|
|
2950
|
-
createTextVNode("\n"),
|
|
2951
|
-
createVNode("span", { class: "line" }, [
|
|
2952
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":::")
|
|
2953
|
-
]),
|
|
2954
|
-
createTextVNode("\n"),
|
|
2955
|
-
createVNode("span", { class: "line" }),
|
|
2956
|
-
createTextVNode("\n"),
|
|
2957
|
-
createVNode("span", { class: "line" }, [
|
|
2958
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "::: en")
|
|
2959
|
-
]),
|
|
2960
|
-
createTextVNode("\n"),
|
|
2961
|
-
createVNode("span", { class: "line" }, [
|
|
2962
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "English")
|
|
2963
|
-
]),
|
|
2964
|
-
createTextVNode("\n"),
|
|
2965
|
-
createVNode("span", { class: "line" }, [
|
|
2966
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":::")
|
|
2967
|
-
])
|
|
2968
|
-
])
|
|
2969
|
-
]),
|
|
2970
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
2971
|
-
createVNode("code", null, [
|
|
2972
|
-
createVNode("span", { class: "line" }, [
|
|
2973
|
-
createVNode("span", { style: { "color": "#24292E" } }, "::: zh-CN")
|
|
2974
|
-
]),
|
|
2975
|
-
createTextVNode("\n"),
|
|
2976
|
-
createVNode("span", { class: "line" }, [
|
|
2977
|
-
createVNode("span", { style: { "color": "#24292E" } }, "另一种 i18n 方案。")
|
|
2978
|
-
]),
|
|
2979
|
-
createTextVNode("\n"),
|
|
2980
|
-
createVNode("span", { class: "line" }),
|
|
2981
|
-
createTextVNode("\n"),
|
|
2982
|
-
createVNode("span", { class: "line" }, [
|
|
2983
|
-
createVNode("span", { style: { "color": "#24292E" } }, "更多内容:...")
|
|
2984
|
-
]),
|
|
2985
|
-
createTextVNode("\n"),
|
|
2986
|
-
createVNode("span", { class: "line" }, [
|
|
2987
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":::")
|
|
2988
|
-
]),
|
|
2989
|
-
createTextVNode("\n"),
|
|
2990
|
-
createVNode("span", { class: "line" }),
|
|
2991
|
-
createTextVNode("\n"),
|
|
2992
|
-
createVNode("span", { class: "line" }, [
|
|
2993
|
-
createVNode("span", { style: { "color": "#24292E" } }, "::: en")
|
|
2994
|
-
]),
|
|
2995
|
-
createTextVNode("\n"),
|
|
2996
|
-
createVNode("span", { class: "line" }, [
|
|
2997
|
-
createVNode("span", { style: { "color": "#24292E" } }, "Another i18n method.")
|
|
2998
|
-
]),
|
|
2999
|
-
createTextVNode("\n"),
|
|
3000
|
-
createVNode("span", { class: "line" }),
|
|
3001
|
-
createTextVNode("\n"),
|
|
3002
|
-
createVNode("span", { class: "line" }, [
|
|
3003
|
-
createVNode("span", { style: { "color": "#24292E" } }, "More info...")
|
|
3004
|
-
]),
|
|
3005
|
-
createTextVNode("\n"),
|
|
3006
|
-
createVNode("span", { class: "line" }, [
|
|
3007
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":::")
|
|
3008
|
-
]),
|
|
3009
|
-
createTextVNode("\n"),
|
|
3010
|
-
createVNode("span", { class: "line" }),
|
|
3011
|
-
createTextVNode("\n"),
|
|
3012
|
-
createVNode("span", { class: "line" }, [
|
|
3013
|
-
createVNode("span", { style: { "color": "#24292E" } }, "::: zh-CN")
|
|
3014
|
-
]),
|
|
3015
|
-
createTextVNode("\n"),
|
|
3016
|
-
createVNode("span", { class: "line" }, [
|
|
3017
|
-
createVNode("span", { style: { "color": "#24292E" } }, "中文")
|
|
3018
|
-
]),
|
|
3019
|
-
createTextVNode("\n"),
|
|
3020
|
-
createVNode("span", { class: "line" }, [
|
|
3021
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":::")
|
|
3022
|
-
]),
|
|
3023
|
-
createTextVNode("\n"),
|
|
3024
|
-
createVNode("span", { class: "line" }),
|
|
3025
|
-
createTextVNode("\n"),
|
|
3026
|
-
createVNode("span", { class: "line" }, [
|
|
3027
|
-
createVNode("span", { style: { "color": "#24292E" } }, "::: en")
|
|
3028
|
-
]),
|
|
3029
|
-
createTextVNode("\n"),
|
|
3030
|
-
createVNode("span", { class: "line" }, [
|
|
3031
|
-
createVNode("span", { style: { "color": "#24292E" } }, "English")
|
|
3032
|
-
]),
|
|
3033
|
-
createTextVNode("\n"),
|
|
3034
|
-
createVNode("span", { class: "line" }, [
|
|
3035
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":::")
|
|
3036
|
-
])
|
|
3037
|
-
])
|
|
3038
|
-
])
|
|
3039
|
-
]),
|
|
3040
|
-
createVNode("h3", {
|
|
3041
|
-
id: "steps",
|
|
3042
|
-
tabindex: "-1"
|
|
3043
|
-
}, [
|
|
3044
|
-
createTextVNode("Steps "),
|
|
3045
|
-
createVNode(_component_AppLink, {
|
|
3046
|
-
class: "header-anchor",
|
|
3047
|
-
href: "#steps",
|
|
3048
|
-
"aria-label": 'Permalink to "Steps"'
|
|
3049
|
-
}, {
|
|
3050
|
-
default: withCtx(() => [
|
|
3051
|
-
createTextVNode("")
|
|
3052
|
-
]),
|
|
3053
|
-
_: 1
|
|
3054
|
-
/* STABLE */
|
|
3055
|
-
})
|
|
3056
|
-
]),
|
|
3057
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3058
|
-
createVNode("p", null, [
|
|
3059
|
-
createVNode("strong", null, "实现步骤")
|
|
3060
|
-
])
|
|
3061
|
-
]),
|
|
3062
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3063
|
-
createVNode("p", null, "为了能够借助 CSS 处理 i18n,我们借助 markdown-it-container 的 fence 包裹 Markdown 中需要参与 i18n 的内容。")
|
|
3064
|
-
]),
|
|
3065
|
-
createVNode("div", { lang: "en" }, [
|
|
3066
|
-
createVNode("p", null, "To be able to handle i18n with CSS, we use markdown-it-container's fence to wrap Markdown content that needs to participate in i18n.")
|
|
3067
|
-
]),
|
|
3068
|
-
createVNode("div", { class: "language-ts" }, [
|
|
3069
|
-
createVNode("button", {
|
|
3070
|
-
title: "Copy Code",
|
|
3071
|
-
class: "copy"
|
|
3072
|
-
}),
|
|
3073
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
3074
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
3075
|
-
createVNode("code", null, [
|
|
3076
|
-
createVNode("span", { class: "line" }, [
|
|
3077
|
-
createVNode("span", { style: { "color": "#F97583" } }, "export"),
|
|
3078
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3079
|
-
createVNode("span", { style: { "color": "#F97583" } }, "function"),
|
|
3080
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3081
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "containerPlugin"),
|
|
3082
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
3083
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "md"),
|
|
3084
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
3085
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3086
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "MarkdownIt"),
|
|
3087
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") {")
|
|
3088
|
-
]),
|
|
3089
|
-
createTextVNode("\n"),
|
|
3090
|
-
createVNode("span", { class: "line" }, [
|
|
3091
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3092
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
3093
|
-
]),
|
|
3094
|
-
createTextVNode("\n"),
|
|
3095
|
-
createVNode("span", { class: "line" }, [
|
|
3096
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3097
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
3098
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3099
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "languages"),
|
|
3100
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3101
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
3102
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " ["),
|
|
3103
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'zh-CN'"),
|
|
3104
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", "),
|
|
3105
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'en'"),
|
|
3106
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "]")
|
|
3107
|
-
]),
|
|
3108
|
-
createTextVNode("\n"),
|
|
3109
|
-
createVNode("span", { class: "line" }),
|
|
3110
|
-
createTextVNode("\n"),
|
|
3111
|
-
createVNode("span", { class: "line" }, [
|
|
3112
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " languages."),
|
|
3113
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "forEach"),
|
|
3114
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(("),
|
|
3115
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "lang"),
|
|
3116
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") "),
|
|
3117
|
-
createVNode("span", { style: { "color": "#F97583" } }, "=>"),
|
|
3118
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
3119
|
-
]),
|
|
3120
|
-
createTextVNode("\n"),
|
|
3121
|
-
createVNode("span", { class: "line" }, [
|
|
3122
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " md."),
|
|
3123
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "use"),
|
|
3124
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "(container, lang, {")
|
|
3125
|
-
]),
|
|
3126
|
-
createTextVNode("\n"),
|
|
3127
|
-
createVNode("span", { class: "line" }, [
|
|
3128
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3129
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "render"),
|
|
3130
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ": ("),
|
|
3131
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "tokens"),
|
|
3132
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
3133
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3134
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "Token"),
|
|
3135
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "[], "),
|
|
3136
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "idx"),
|
|
3137
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
3138
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3139
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "number"),
|
|
3140
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") "),
|
|
3141
|
-
createVNode("span", { style: { "color": "#F97583" } }, "=>"),
|
|
3142
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " tokens[idx].nesting "),
|
|
3143
|
-
createVNode("span", { style: { "color": "#F97583" } }, "==="),
|
|
3144
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3145
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "1"),
|
|
3146
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3147
|
-
createVNode("span", { style: { "color": "#F97583" } }, "?"),
|
|
3148
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3149
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '`<div lang="${'),
|
|
3150
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "lang"),
|
|
3151
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '}">'),
|
|
3152
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "\\n"),
|
|
3153
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "`"),
|
|
3154
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3155
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
3156
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3157
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'</div>"),
|
|
3158
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "\\n"),
|
|
3159
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'"),
|
|
3160
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ",")
|
|
3161
|
-
]),
|
|
3162
|
-
createTextVNode("\n"),
|
|
3163
|
-
createVNode("span", { class: "line" }, [
|
|
3164
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " })")
|
|
3165
|
-
]),
|
|
3166
|
-
createTextVNode("\n"),
|
|
3167
|
-
createVNode("span", { class: "line" }, [
|
|
3168
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " })")
|
|
3169
|
-
]),
|
|
3170
|
-
createTextVNode("\n"),
|
|
3171
|
-
createVNode("span", { class: "line" }, [
|
|
3172
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "}")
|
|
3173
|
-
])
|
|
3174
|
-
])
|
|
3175
|
-
]),
|
|
3176
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
3177
|
-
createVNode("code", null, [
|
|
3178
|
-
createVNode("span", { class: "line" }, [
|
|
3179
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "export"),
|
|
3180
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3181
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "function"),
|
|
3182
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3183
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "containerPlugin"),
|
|
3184
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
3185
|
-
createVNode("span", { style: { "color": "#E36209" } }, "md"),
|
|
3186
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
3187
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3188
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "MarkdownIt"),
|
|
3189
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") {")
|
|
3190
|
-
]),
|
|
3191
|
-
createTextVNode("\n"),
|
|
3192
|
-
createVNode("span", { class: "line" }, [
|
|
3193
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3194
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
3195
|
-
]),
|
|
3196
|
-
createTextVNode("\n"),
|
|
3197
|
-
createVNode("span", { class: "line" }, [
|
|
3198
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3199
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
3200
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3201
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "languages"),
|
|
3202
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3203
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
3204
|
-
createVNode("span", { style: { "color": "#24292E" } }, " ["),
|
|
3205
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'zh-CN'"),
|
|
3206
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", "),
|
|
3207
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'en'"),
|
|
3208
|
-
createVNode("span", { style: { "color": "#24292E" } }, "]")
|
|
3209
|
-
]),
|
|
3210
|
-
createTextVNode("\n"),
|
|
3211
|
-
createVNode("span", { class: "line" }),
|
|
3212
|
-
createTextVNode("\n"),
|
|
3213
|
-
createVNode("span", { class: "line" }, [
|
|
3214
|
-
createVNode("span", { style: { "color": "#24292E" } }, " languages."),
|
|
3215
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "forEach"),
|
|
3216
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(("),
|
|
3217
|
-
createVNode("span", { style: { "color": "#E36209" } }, "lang"),
|
|
3218
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") "),
|
|
3219
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "=>"),
|
|
3220
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
3221
|
-
]),
|
|
3222
|
-
createTextVNode("\n"),
|
|
3223
|
-
createVNode("span", { class: "line" }, [
|
|
3224
|
-
createVNode("span", { style: { "color": "#24292E" } }, " md."),
|
|
3225
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "use"),
|
|
3226
|
-
createVNode("span", { style: { "color": "#24292E" } }, "(container, lang, {")
|
|
3227
|
-
]),
|
|
3228
|
-
createTextVNode("\n"),
|
|
3229
|
-
createVNode("span", { class: "line" }, [
|
|
3230
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3231
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "render"),
|
|
3232
|
-
createVNode("span", { style: { "color": "#24292E" } }, ": ("),
|
|
3233
|
-
createVNode("span", { style: { "color": "#E36209" } }, "tokens"),
|
|
3234
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
3235
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3236
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "Token"),
|
|
3237
|
-
createVNode("span", { style: { "color": "#24292E" } }, "[], "),
|
|
3238
|
-
createVNode("span", { style: { "color": "#E36209" } }, "idx"),
|
|
3239
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
3240
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3241
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "number"),
|
|
3242
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") "),
|
|
3243
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "=>"),
|
|
3244
|
-
createVNode("span", { style: { "color": "#24292E" } }, " tokens[idx].nesting "),
|
|
3245
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "==="),
|
|
3246
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3247
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "1"),
|
|
3248
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3249
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "?"),
|
|
3250
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3251
|
-
createVNode("span", { style: { "color": "#032F62" } }, '`<div lang="${'),
|
|
3252
|
-
createVNode("span", { style: { "color": "#24292E" } }, "lang"),
|
|
3253
|
-
createVNode("span", { style: { "color": "#032F62" } }, '}">'),
|
|
3254
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "\\n"),
|
|
3255
|
-
createVNode("span", { style: { "color": "#032F62" } }, "`"),
|
|
3256
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3257
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
3258
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3259
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'</div>"),
|
|
3260
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "\\n"),
|
|
3261
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'"),
|
|
3262
|
-
createVNode("span", { style: { "color": "#24292E" } }, ",")
|
|
3263
|
-
]),
|
|
3264
|
-
createTextVNode("\n"),
|
|
3265
|
-
createVNode("span", { class: "line" }, [
|
|
3266
|
-
createVNode("span", { style: { "color": "#24292E" } }, " })")
|
|
3267
|
-
]),
|
|
3268
|
-
createTextVNode("\n"),
|
|
3269
|
-
createVNode("span", { class: "line" }, [
|
|
3270
|
-
createVNode("span", { style: { "color": "#24292E" } }, " })")
|
|
3271
|
-
]),
|
|
3272
|
-
createTextVNode("\n"),
|
|
3273
|
-
createVNode("span", { class: "line" }, [
|
|
3274
|
-
createVNode("span", { style: { "color": "#24292E" } }, "}")
|
|
3275
|
-
])
|
|
3276
|
-
])
|
|
3277
|
-
])
|
|
3278
|
-
]),
|
|
3279
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3280
|
-
createVNode("p", null, "这可以使:")
|
|
3281
|
-
]),
|
|
3282
|
-
createVNode("div", { lang: "en" }, [
|
|
3283
|
-
createVNode("p", null, "This allows:")
|
|
3284
|
-
]),
|
|
3285
|
-
createVNode("div", { class: "language-md" }, [
|
|
3286
|
-
createVNode("button", {
|
|
3287
|
-
title: "Copy Code",
|
|
3288
|
-
class: "copy"
|
|
3289
|
-
}),
|
|
3290
|
-
createVNode("span", { class: "lang" }, "md"),
|
|
3291
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
3292
|
-
createVNode("code", null, [
|
|
3293
|
-
createVNode("span", { class: "line" }, [
|
|
3294
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "::: zh-CN")
|
|
3295
|
-
]),
|
|
3296
|
-
createTextVNode("\n"),
|
|
3297
|
-
createVNode("span", { class: "line" }, [
|
|
3298
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "中文")
|
|
3299
|
-
]),
|
|
3300
|
-
createTextVNode("\n"),
|
|
3301
|
-
createVNode("span", { class: "line" }, [
|
|
3302
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ":::")
|
|
3303
|
-
])
|
|
3304
|
-
])
|
|
3305
|
-
]),
|
|
3306
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
3307
|
-
createVNode("code", null, [
|
|
3308
|
-
createVNode("span", { class: "line" }, [
|
|
3309
|
-
createVNode("span", { style: { "color": "#24292E" } }, "::: zh-CN")
|
|
3310
|
-
]),
|
|
3311
|
-
createTextVNode("\n"),
|
|
3312
|
-
createVNode("span", { class: "line" }, [
|
|
3313
|
-
createVNode("span", { style: { "color": "#24292E" } }, "中文")
|
|
3314
|
-
]),
|
|
3315
|
-
createTextVNode("\n"),
|
|
3316
|
-
createVNode("span", { class: "line" }, [
|
|
3317
|
-
createVNode("span", { style: { "color": "#24292E" } }, ":::")
|
|
3318
|
-
])
|
|
3319
|
-
])
|
|
3320
|
-
])
|
|
3321
|
-
]),
|
|
3322
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3323
|
-
createVNode("p", null, [
|
|
3324
|
-
createTextVNode("变成 "),
|
|
3325
|
-
createVNode("code", null, '<div lang="zh-CN"></div>'),
|
|
3326
|
-
createTextVNode(" 的形式。")
|
|
3327
|
-
]),
|
|
3328
|
-
createVNode("blockquote", null, [
|
|
3329
|
-
createVNode("p", null, [
|
|
3330
|
-
createVNode(_component_AppLink, {
|
|
3331
|
-
href: "https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang",
|
|
3332
|
-
target: "_blank",
|
|
3333
|
-
rel: "noreferrer"
|
|
3334
|
-
}, {
|
|
3335
|
-
default: withCtx(() => [
|
|
3336
|
-
createTextVNode("lang")
|
|
3337
|
-
]),
|
|
3338
|
-
_: 1
|
|
3339
|
-
/* STABLE */
|
|
3340
|
-
}),
|
|
3341
|
-
createTextVNode(" 是 HTML 的一个标准字段。")
|
|
3342
|
-
])
|
|
3343
|
-
]),
|
|
3344
|
-
createVNode("p", null, "为避免 class 命名冲突,我们可以采用 CSS attribute 的查询方式。"),
|
|
3345
|
-
createVNode("p", null, "首先将 i18n 全部隐藏:")
|
|
3346
|
-
]),
|
|
3347
|
-
createVNode("div", { lang: "en" }, [
|
|
3348
|
-
createVNode("p", null, [
|
|
3349
|
-
createTextVNode("Be "),
|
|
3350
|
-
createVNode("code", null, '<div lang="zh-CN"></div>'),
|
|
3351
|
-
createTextVNode(".")
|
|
3352
|
-
]),
|
|
3353
|
-
createVNode("blockquote", null, [
|
|
3354
|
-
createVNode("p", null, [
|
|
3355
|
-
createVNode(_component_AppLink, {
|
|
3356
|
-
href: "https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang",
|
|
3357
|
-
target: "_blank",
|
|
3358
|
-
rel: "noreferrer"
|
|
3359
|
-
}, {
|
|
3360
|
-
default: withCtx(() => [
|
|
3361
|
-
createTextVNode("lang")
|
|
3362
|
-
]),
|
|
3363
|
-
_: 1
|
|
3364
|
-
/* STABLE */
|
|
3365
|
-
}),
|
|
3366
|
-
createTextVNode(" is a standard field in HTML.")
|
|
3367
|
-
])
|
|
3368
|
-
]),
|
|
3369
|
-
createVNode("p", null, "To avoid class naming conflicts, we can use the CSS attribute query."),
|
|
3370
|
-
createVNode("p", null, "First, hide all i18n:")
|
|
3371
|
-
]),
|
|
3372
|
-
createVNode("div", { class: "language-scss" }, [
|
|
3373
|
-
createVNode("button", {
|
|
3374
|
-
title: "Copy Code",
|
|
3375
|
-
class: "copy"
|
|
3376
|
-
}),
|
|
3377
|
-
createVNode("span", { class: "lang" }, "scss"),
|
|
3378
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
3379
|
-
createVNode("code", null, [
|
|
3380
|
-
createVNode("span", { class: "line" }, [
|
|
3381
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "html"),
|
|
3382
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "["),
|
|
3383
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "lang"),
|
|
3384
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "] {")
|
|
3385
|
-
]),
|
|
3386
|
-
createTextVNode("\n"),
|
|
3387
|
-
createVNode("span", { class: "line" }, [
|
|
3388
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3389
|
-
createVNode("span", { style: { "color": "#B392F0" } }, ".markdown-body"),
|
|
3390
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
3391
|
-
]),
|
|
3392
|
-
createTextVNode("\n"),
|
|
3393
|
-
createVNode("span", { class: "line" }, [
|
|
3394
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3395
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "div"),
|
|
3396
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "["),
|
|
3397
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "lang"),
|
|
3398
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "] {")
|
|
3399
|
-
]),
|
|
3400
|
-
createTextVNode("\n"),
|
|
3401
|
-
createVNode("span", { class: "line" }, [
|
|
3402
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3403
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "display"),
|
|
3404
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ": "),
|
|
3405
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "none"),
|
|
3406
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ";")
|
|
3407
|
-
]),
|
|
3408
|
-
createTextVNode("\n"),
|
|
3409
|
-
createVNode("span", { class: "line" }, [
|
|
3410
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
3411
|
-
]),
|
|
3412
|
-
createTextVNode("\n"),
|
|
3413
|
-
createVNode("span", { class: "line" }, [
|
|
3414
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
3415
|
-
]),
|
|
3416
|
-
createTextVNode("\n"),
|
|
3417
|
-
createVNode("span", { class: "line" }, [
|
|
3418
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "}")
|
|
3419
|
-
])
|
|
3420
|
-
])
|
|
3421
|
-
]),
|
|
3422
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
3423
|
-
createVNode("code", null, [
|
|
3424
|
-
createVNode("span", { class: "line" }, [
|
|
3425
|
-
createVNode("span", { style: { "color": "#22863A" } }, "html"),
|
|
3426
|
-
createVNode("span", { style: { "color": "#24292E" } }, "["),
|
|
3427
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "lang"),
|
|
3428
|
-
createVNode("span", { style: { "color": "#24292E" } }, "] {")
|
|
3429
|
-
]),
|
|
3430
|
-
createTextVNode("\n"),
|
|
3431
|
-
createVNode("span", { class: "line" }, [
|
|
3432
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3433
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, ".markdown-body"),
|
|
3434
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
3435
|
-
]),
|
|
3436
|
-
createTextVNode("\n"),
|
|
3437
|
-
createVNode("span", { class: "line" }, [
|
|
3438
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3439
|
-
createVNode("span", { style: { "color": "#22863A" } }, "div"),
|
|
3440
|
-
createVNode("span", { style: { "color": "#24292E" } }, "["),
|
|
3441
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "lang"),
|
|
3442
|
-
createVNode("span", { style: { "color": "#24292E" } }, "] {")
|
|
3443
|
-
]),
|
|
3444
|
-
createTextVNode("\n"),
|
|
3445
|
-
createVNode("span", { class: "line" }, [
|
|
3446
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3447
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "display"),
|
|
3448
|
-
createVNode("span", { style: { "color": "#24292E" } }, ": "),
|
|
3449
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "none"),
|
|
3450
|
-
createVNode("span", { style: { "color": "#24292E" } }, ";")
|
|
3451
|
-
]),
|
|
3452
|
-
createTextVNode("\n"),
|
|
3453
|
-
createVNode("span", { class: "line" }, [
|
|
3454
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
3455
|
-
]),
|
|
3456
|
-
createTextVNode("\n"),
|
|
3457
|
-
createVNode("span", { class: "line" }, [
|
|
3458
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
3459
|
-
]),
|
|
3460
|
-
createTextVNode("\n"),
|
|
3461
|
-
createVNode("span", { class: "line" }, [
|
|
3462
|
-
createVNode("span", { style: { "color": "#24292E" } }, "}")
|
|
3463
|
-
])
|
|
3464
|
-
])
|
|
3465
|
-
])
|
|
3466
|
-
]),
|
|
3467
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3468
|
-
createVNode("p", null, [
|
|
3469
|
-
createTextVNode("编写 CSS/SCSS 规则,设定 html "),
|
|
3470
|
-
createVNode("code", null, "lang"),
|
|
3471
|
-
createTextVNode(" 为对应语言时,显示对应语言的元素即可。")
|
|
3472
|
-
])
|
|
3473
|
-
]),
|
|
3474
|
-
createVNode("div", { lang: "en" }, [
|
|
3475
|
-
createVNode("p", null, [
|
|
3476
|
-
createTextVNode("Write CSS/SCSS rules and set html "),
|
|
3477
|
-
createVNode("code", null, "lang"),
|
|
3478
|
-
createTextVNode(" to display elements in the corresponding language when it is the corresponding language.")
|
|
3479
|
-
])
|
|
3480
|
-
]),
|
|
3481
|
-
createVNode("div", { class: "language-scss" }, [
|
|
3482
|
-
createVNode("button", {
|
|
3483
|
-
title: "Copy Code",
|
|
3484
|
-
class: "copy"
|
|
3485
|
-
}),
|
|
3486
|
-
createVNode("span", { class: "lang" }, "scss"),
|
|
3487
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
3488
|
-
createVNode("code", null, [
|
|
3489
|
-
createVNode("span", { class: "line" }, [
|
|
3490
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "$languages"),
|
|
3491
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ": zh"),
|
|
3492
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "-"),
|
|
3493
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "CN, en;")
|
|
3494
|
-
]),
|
|
3495
|
-
createTextVNode("\n"),
|
|
3496
|
-
createVNode("span", { class: "line" }),
|
|
3497
|
-
createTextVNode("\n"),
|
|
3498
|
-
createVNode("span", { class: "line" }, [
|
|
3499
|
-
createVNode("span", { style: { "color": "#F97583" } }, "@each"),
|
|
3500
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3501
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "$lang"),
|
|
3502
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3503
|
-
createVNode("span", { style: { "color": "#F97583" } }, "in"),
|
|
3504
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3505
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "$languages"),
|
|
3506
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
3507
|
-
]),
|
|
3508
|
-
createTextVNode("\n"),
|
|
3509
|
-
createVNode("span", { class: "line" }, [
|
|
3510
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3511
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "html"),
|
|
3512
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "["),
|
|
3513
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "lang"),
|
|
3514
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
3515
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"'),
|
|
3516
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "#{$lang}"),
|
|
3517
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"'),
|
|
3518
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "] {")
|
|
3519
|
-
]),
|
|
3520
|
-
createTextVNode("\n"),
|
|
3521
|
-
createVNode("span", { class: "line" }, [
|
|
3522
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3523
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// only for markdown")
|
|
3524
|
-
]),
|
|
3525
|
-
createTextVNode("\n"),
|
|
3526
|
-
createVNode("span", { class: "line" }, [
|
|
3527
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3528
|
-
createVNode("span", { style: { "color": "#B392F0" } }, ".markdown-body"),
|
|
3529
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " {")
|
|
3530
|
-
]),
|
|
3531
|
-
createTextVNode("\n"),
|
|
3532
|
-
createVNode("span", { class: "line" }, [
|
|
3533
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3534
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "div"),
|
|
3535
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "["),
|
|
3536
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "lang"),
|
|
3537
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
3538
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"'),
|
|
3539
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "#{$lang}"),
|
|
3540
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"'),
|
|
3541
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "] {")
|
|
3542
|
-
]),
|
|
3543
|
-
createTextVNode("\n"),
|
|
3544
|
-
createVNode("span", { class: "line" }, [
|
|
3545
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3546
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "display"),
|
|
3547
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ": "),
|
|
3548
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "block"),
|
|
3549
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ";")
|
|
3550
|
-
]),
|
|
3551
|
-
createTextVNode("\n"),
|
|
3552
|
-
createVNode("span", { class: "line" }, [
|
|
3553
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
3554
|
-
]),
|
|
3555
|
-
createTextVNode("\n"),
|
|
3556
|
-
createVNode("span", { class: "line" }, [
|
|
3557
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
3558
|
-
]),
|
|
3559
|
-
createTextVNode("\n"),
|
|
3560
|
-
createVNode("span", { class: "line" }, [
|
|
3561
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " }")
|
|
3562
|
-
]),
|
|
3563
|
-
createTextVNode("\n"),
|
|
3564
|
-
createVNode("span", { class: "line" }, [
|
|
3565
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "}")
|
|
3566
|
-
])
|
|
3567
|
-
])
|
|
3568
|
-
]),
|
|
3569
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
3570
|
-
createVNode("code", null, [
|
|
3571
|
-
createVNode("span", { class: "line" }, [
|
|
3572
|
-
createVNode("span", { style: { "color": "#E36209" } }, "$languages"),
|
|
3573
|
-
createVNode("span", { style: { "color": "#24292E" } }, ": zh"),
|
|
3574
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "-"),
|
|
3575
|
-
createVNode("span", { style: { "color": "#24292E" } }, "CN, en;")
|
|
3576
|
-
]),
|
|
3577
|
-
createTextVNode("\n"),
|
|
3578
|
-
createVNode("span", { class: "line" }),
|
|
3579
|
-
createTextVNode("\n"),
|
|
3580
|
-
createVNode("span", { class: "line" }, [
|
|
3581
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "@each"),
|
|
3582
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3583
|
-
createVNode("span", { style: { "color": "#E36209" } }, "$lang"),
|
|
3584
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3585
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "in"),
|
|
3586
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3587
|
-
createVNode("span", { style: { "color": "#E36209" } }, "$languages"),
|
|
3588
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
3589
|
-
]),
|
|
3590
|
-
createTextVNode("\n"),
|
|
3591
|
-
createVNode("span", { class: "line" }, [
|
|
3592
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3593
|
-
createVNode("span", { style: { "color": "#22863A" } }, "html"),
|
|
3594
|
-
createVNode("span", { style: { "color": "#24292E" } }, "["),
|
|
3595
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "lang"),
|
|
3596
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
3597
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"'),
|
|
3598
|
-
createVNode("span", { style: { "color": "#E36209" } }, "#{$lang}"),
|
|
3599
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"'),
|
|
3600
|
-
createVNode("span", { style: { "color": "#24292E" } }, "] {")
|
|
3601
|
-
]),
|
|
3602
|
-
createTextVNode("\n"),
|
|
3603
|
-
createVNode("span", { class: "line" }, [
|
|
3604
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3605
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// only for markdown")
|
|
3606
|
-
]),
|
|
3607
|
-
createTextVNode("\n"),
|
|
3608
|
-
createVNode("span", { class: "line" }, [
|
|
3609
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3610
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, ".markdown-body"),
|
|
3611
|
-
createVNode("span", { style: { "color": "#24292E" } }, " {")
|
|
3612
|
-
]),
|
|
3613
|
-
createTextVNode("\n"),
|
|
3614
|
-
createVNode("span", { class: "line" }, [
|
|
3615
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3616
|
-
createVNode("span", { style: { "color": "#22863A" } }, "div"),
|
|
3617
|
-
createVNode("span", { style: { "color": "#24292E" } }, "["),
|
|
3618
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "lang"),
|
|
3619
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
3620
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"'),
|
|
3621
|
-
createVNode("span", { style: { "color": "#E36209" } }, "#{$lang}"),
|
|
3622
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"'),
|
|
3623
|
-
createVNode("span", { style: { "color": "#24292E" } }, "] {")
|
|
3624
|
-
]),
|
|
3625
|
-
createTextVNode("\n"),
|
|
3626
|
-
createVNode("span", { class: "line" }, [
|
|
3627
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3628
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "display"),
|
|
3629
|
-
createVNode("span", { style: { "color": "#24292E" } }, ": "),
|
|
3630
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "block"),
|
|
3631
|
-
createVNode("span", { style: { "color": "#24292E" } }, ";")
|
|
3632
|
-
]),
|
|
3633
|
-
createTextVNode("\n"),
|
|
3634
|
-
createVNode("span", { class: "line" }, [
|
|
3635
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
3636
|
-
]),
|
|
3637
|
-
createTextVNode("\n"),
|
|
3638
|
-
createVNode("span", { class: "line" }, [
|
|
3639
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
3640
|
-
]),
|
|
3641
|
-
createTextVNode("\n"),
|
|
3642
|
-
createVNode("span", { class: "line" }, [
|
|
3643
|
-
createVNode("span", { style: { "color": "#24292E" } }, " }")
|
|
3644
|
-
]),
|
|
3645
|
-
createTextVNode("\n"),
|
|
3646
|
-
createVNode("span", { class: "line" }, [
|
|
3647
|
-
createVNode("span", { style: { "color": "#24292E" } }, "}")
|
|
3648
|
-
])
|
|
3649
|
-
])
|
|
3650
|
-
])
|
|
3651
|
-
]),
|
|
3652
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3653
|
-
createVNode("p", null, "为了帮助用户记住自己的语言,还请不要忘记初始化。")
|
|
3654
|
-
]),
|
|
3655
|
-
createVNode("div", { lang: "en" }, [
|
|
3656
|
-
createVNode("p", null, "To help users remember their language, please also don't forget to initialize.")
|
|
3657
|
-
]),
|
|
3658
|
-
createVNode("div", { class: "language-html" }, [
|
|
3659
|
-
createVNode("button", {
|
|
3660
|
-
title: "Copy Code",
|
|
3661
|
-
class: "copy"
|
|
3662
|
-
}),
|
|
3663
|
-
createVNode("span", { class: "lang" }, "html"),
|
|
3664
|
-
createVNode("pre", { class: "shiki github-dark has-highlighted-lines vp-code-dark" }, [
|
|
3665
|
-
createVNode("code", null, [
|
|
3666
|
-
createVNode("span", { class: "line" }, [
|
|
3667
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "<!"),
|
|
3668
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "DOCTYPE"),
|
|
3669
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3670
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "html"),
|
|
3671
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3672
|
-
]),
|
|
3673
|
-
createTextVNode("\n"),
|
|
3674
|
-
createVNode("span", { class: "line" }, [
|
|
3675
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "<"),
|
|
3676
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "html"),
|
|
3677
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3678
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "lang"),
|
|
3679
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "="),
|
|
3680
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"en"'),
|
|
3681
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3682
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "class"),
|
|
3683
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "="),
|
|
3684
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, '"i18n"'),
|
|
3685
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3686
|
-
]),
|
|
3687
|
-
createTextVNode("\n"),
|
|
3688
|
-
createVNode("span", { class: "line" }),
|
|
3689
|
-
createTextVNode("\n"),
|
|
3690
|
-
createVNode("span", { class: "line" }, [
|
|
3691
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "<"),
|
|
3692
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "head"),
|
|
3693
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3694
|
-
]),
|
|
3695
|
-
createTextVNode("\n"),
|
|
3696
|
-
createVNode("span", { class: "line" }, [
|
|
3697
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3698
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "<!-- ... -->")
|
|
3699
|
-
]),
|
|
3700
|
-
createTextVNode("\n"),
|
|
3701
|
-
createVNode("span", { class: "line" }, [
|
|
3702
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " <"),
|
|
3703
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "script"),
|
|
3704
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3705
|
-
]),
|
|
3706
|
-
createTextVNode("\n"),
|
|
3707
|
-
createVNode("span", { class: "line" }, [
|
|
3708
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " ("),
|
|
3709
|
-
createVNode("span", { style: { "color": "#F97583" } }, "function"),
|
|
3710
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "() {")
|
|
3711
|
-
]),
|
|
3712
|
-
createTextVNode("\n"),
|
|
3713
|
-
createVNode("span", { class: "line" }, [
|
|
3714
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3715
|
-
createVNode("span", { style: { "color": "#F97583" } }, "const"),
|
|
3716
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3717
|
-
createVNode("span", { style: { "color": "#79B8FF" } }, "locale"),
|
|
3718
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3719
|
-
createVNode("span", { style: { "color": "#F97583" } }, "="),
|
|
3720
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " localStorage."),
|
|
3721
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "getItem"),
|
|
3722
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
3723
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'valaxy-locale'"),
|
|
3724
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") "),
|
|
3725
|
-
createVNode("span", { style: { "color": "#F97583" } }, "||"),
|
|
3726
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3727
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'en'")
|
|
3728
|
-
]),
|
|
3729
|
-
createTextVNode("\n"),
|
|
3730
|
-
createVNode("span", { class: "line highlighted" }, [
|
|
3731
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " document.documentElement."),
|
|
3732
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "setAttribute"),
|
|
3733
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
3734
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'lang'"),
|
|
3735
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", locale)")
|
|
3736
|
-
]),
|
|
3737
|
-
createTextVNode("\n"),
|
|
3738
|
-
createVNode("span", { class: "line" }, [
|
|
3739
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " })()")
|
|
3740
|
-
]),
|
|
3741
|
-
createTextVNode("\n"),
|
|
3742
|
-
createVNode("span", { class: "line" }, [
|
|
3743
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " </"),
|
|
3744
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "script"),
|
|
3745
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3746
|
-
]),
|
|
3747
|
-
createTextVNode("\n"),
|
|
3748
|
-
createVNode("span", { class: "line" }, [
|
|
3749
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "</"),
|
|
3750
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "head"),
|
|
3751
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3752
|
-
]),
|
|
3753
|
-
createTextVNode("\n"),
|
|
3754
|
-
createVNode("span", { class: "line" }, [
|
|
3755
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "<"),
|
|
3756
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "body"),
|
|
3757
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">...</"),
|
|
3758
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "body"),
|
|
3759
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3760
|
-
]),
|
|
3761
|
-
createTextVNode("\n"),
|
|
3762
|
-
createVNode("span", { class: "line" }, [
|
|
3763
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "</"),
|
|
3764
|
-
createVNode("span", { style: { "color": "#85E89D" } }, "html"),
|
|
3765
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ">")
|
|
3766
|
-
])
|
|
3767
|
-
])
|
|
3768
|
-
]),
|
|
3769
|
-
createVNode("pre", { class: "shiki github-light has-highlighted-lines vp-code-light" }, [
|
|
3770
|
-
createVNode("code", null, [
|
|
3771
|
-
createVNode("span", { class: "line" }, [
|
|
3772
|
-
createVNode("span", { style: { "color": "#24292E" } }, "<!"),
|
|
3773
|
-
createVNode("span", { style: { "color": "#22863A" } }, "DOCTYPE"),
|
|
3774
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3775
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "html"),
|
|
3776
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3777
|
-
]),
|
|
3778
|
-
createTextVNode("\n"),
|
|
3779
|
-
createVNode("span", { class: "line" }, [
|
|
3780
|
-
createVNode("span", { style: { "color": "#24292E" } }, "<"),
|
|
3781
|
-
createVNode("span", { style: { "color": "#22863A" } }, "html"),
|
|
3782
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3783
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "lang"),
|
|
3784
|
-
createVNode("span", { style: { "color": "#24292E" } }, "="),
|
|
3785
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"en"'),
|
|
3786
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3787
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "class"),
|
|
3788
|
-
createVNode("span", { style: { "color": "#24292E" } }, "="),
|
|
3789
|
-
createVNode("span", { style: { "color": "#032F62" } }, '"i18n"'),
|
|
3790
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3791
|
-
]),
|
|
3792
|
-
createTextVNode("\n"),
|
|
3793
|
-
createVNode("span", { class: "line" }),
|
|
3794
|
-
createTextVNode("\n"),
|
|
3795
|
-
createVNode("span", { class: "line" }, [
|
|
3796
|
-
createVNode("span", { style: { "color": "#24292E" } }, "<"),
|
|
3797
|
-
createVNode("span", { style: { "color": "#22863A" } }, "head"),
|
|
3798
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3799
|
-
]),
|
|
3800
|
-
createTextVNode("\n"),
|
|
3801
|
-
createVNode("span", { class: "line" }, [
|
|
3802
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3803
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "<!-- ... -->")
|
|
3804
|
-
]),
|
|
3805
|
-
createTextVNode("\n"),
|
|
3806
|
-
createVNode("span", { class: "line" }, [
|
|
3807
|
-
createVNode("span", { style: { "color": "#24292E" } }, " <"),
|
|
3808
|
-
createVNode("span", { style: { "color": "#22863A" } }, "script"),
|
|
3809
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3810
|
-
]),
|
|
3811
|
-
createTextVNode("\n"),
|
|
3812
|
-
createVNode("span", { class: "line" }, [
|
|
3813
|
-
createVNode("span", { style: { "color": "#24292E" } }, " ("),
|
|
3814
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "function"),
|
|
3815
|
-
createVNode("span", { style: { "color": "#24292E" } }, "() {")
|
|
3816
|
-
]),
|
|
3817
|
-
createTextVNode("\n"),
|
|
3818
|
-
createVNode("span", { class: "line" }, [
|
|
3819
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3820
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "const"),
|
|
3821
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3822
|
-
createVNode("span", { style: { "color": "#005CC5" } }, "locale"),
|
|
3823
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3824
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "="),
|
|
3825
|
-
createVNode("span", { style: { "color": "#24292E" } }, " localStorage."),
|
|
3826
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "getItem"),
|
|
3827
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
3828
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'valaxy-locale'"),
|
|
3829
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") "),
|
|
3830
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "||"),
|
|
3831
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3832
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'en'")
|
|
3833
|
-
]),
|
|
3834
|
-
createTextVNode("\n"),
|
|
3835
|
-
createVNode("span", { class: "line highlighted" }, [
|
|
3836
|
-
createVNode("span", { style: { "color": "#24292E" } }, " document.documentElement."),
|
|
3837
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "setAttribute"),
|
|
3838
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
3839
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'lang'"),
|
|
3840
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", locale)")
|
|
3841
|
-
]),
|
|
3842
|
-
createTextVNode("\n"),
|
|
3843
|
-
createVNode("span", { class: "line" }, [
|
|
3844
|
-
createVNode("span", { style: { "color": "#24292E" } }, " })()")
|
|
3845
|
-
]),
|
|
3846
|
-
createTextVNode("\n"),
|
|
3847
|
-
createVNode("span", { class: "line" }, [
|
|
3848
|
-
createVNode("span", { style: { "color": "#24292E" } }, " </"),
|
|
3849
|
-
createVNode("span", { style: { "color": "#22863A" } }, "script"),
|
|
3850
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3851
|
-
]),
|
|
3852
|
-
createTextVNode("\n"),
|
|
3853
|
-
createVNode("span", { class: "line" }, [
|
|
3854
|
-
createVNode("span", { style: { "color": "#24292E" } }, "</"),
|
|
3855
|
-
createVNode("span", { style: { "color": "#22863A" } }, "head"),
|
|
3856
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3857
|
-
]),
|
|
3858
|
-
createTextVNode("\n"),
|
|
3859
|
-
createVNode("span", { class: "line" }, [
|
|
3860
|
-
createVNode("span", { style: { "color": "#24292E" } }, "<"),
|
|
3861
|
-
createVNode("span", { style: { "color": "#22863A" } }, "body"),
|
|
3862
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">...</"),
|
|
3863
|
-
createVNode("span", { style: { "color": "#22863A" } }, "body"),
|
|
3864
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3865
|
-
]),
|
|
3866
|
-
createTextVNode("\n"),
|
|
3867
|
-
createVNode("span", { class: "line" }, [
|
|
3868
|
-
createVNode("span", { style: { "color": "#24292E" } }, "</"),
|
|
3869
|
-
createVNode("span", { style: { "color": "#22863A" } }, "html"),
|
|
3870
|
-
createVNode("span", { style: { "color": "#24292E" } }, ">")
|
|
3871
|
-
])
|
|
3872
|
-
])
|
|
3873
|
-
])
|
|
3874
|
-
]),
|
|
3875
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3876
|
-
createVNode("p", null, "切换语言时则可做如下处理:")
|
|
3877
|
-
]),
|
|
3878
|
-
createVNode("div", { lang: "en" }, [
|
|
3879
|
-
createVNode("p", null, "When switching languages, the following can be done.")
|
|
3880
|
-
]),
|
|
3881
|
-
createVNode("div", { class: "language-ts" }, [
|
|
3882
|
-
createVNode("button", {
|
|
3883
|
-
title: "Copy Code",
|
|
3884
|
-
class: "copy"
|
|
3885
|
-
}),
|
|
3886
|
-
createVNode("span", { class: "lang" }, "ts"),
|
|
3887
|
-
createVNode("pre", { class: "shiki github-dark vp-code-dark" }, [
|
|
3888
|
-
createVNode("code", null, [
|
|
3889
|
-
createVNode("span", { class: "line" }, [
|
|
3890
|
-
createVNode("span", { style: { "color": "#F97583" } }, "function"),
|
|
3891
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3892
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "toggleLocales"),
|
|
3893
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
3894
|
-
createVNode("span", { style: { "color": "#FFAB70" } }, "lang"),
|
|
3895
|
-
createVNode("span", { style: { "color": "#F97583" } }, ":"),
|
|
3896
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3897
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "val"),
|
|
3898
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ") {")
|
|
3899
|
-
]),
|
|
3900
|
-
createTextVNode("\n"),
|
|
3901
|
-
createVNode("span", { class: "line" }, [
|
|
3902
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3903
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
3904
|
-
]),
|
|
3905
|
-
createTextVNode("\n"),
|
|
3906
|
-
createVNode("span", { class: "line" }, [
|
|
3907
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3908
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// save locale")
|
|
3909
|
-
]),
|
|
3910
|
-
createTextVNode("\n"),
|
|
3911
|
-
createVNode("span", { class: "line" }, [
|
|
3912
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " localStorage."),
|
|
3913
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "setItem"),
|
|
3914
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
3915
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'valaxy-locale'"),
|
|
3916
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", lang)")
|
|
3917
|
-
]),
|
|
3918
|
-
createTextVNode("\n"),
|
|
3919
|
-
createVNode("span", { class: "line" }, [
|
|
3920
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " "),
|
|
3921
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// set html lang")
|
|
3922
|
-
]),
|
|
3923
|
-
createTextVNode("\n"),
|
|
3924
|
-
createVNode("span", { class: "line" }, [
|
|
3925
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, " document.documentElement."),
|
|
3926
|
-
createVNode("span", { style: { "color": "#B392F0" } }, "setAttribute"),
|
|
3927
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "("),
|
|
3928
|
-
createVNode("span", { style: { "color": "#9ECBFF" } }, "'lang'"),
|
|
3929
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, ", lang)")
|
|
3930
|
-
]),
|
|
3931
|
-
createTextVNode("\n"),
|
|
3932
|
-
createVNode("span", { class: "line" }, [
|
|
3933
|
-
createVNode("span", { style: { "color": "#E1E4E8" } }, "}")
|
|
3934
|
-
])
|
|
3935
|
-
])
|
|
3936
|
-
]),
|
|
3937
|
-
createVNode("pre", { class: "shiki github-light vp-code-light" }, [
|
|
3938
|
-
createVNode("code", null, [
|
|
3939
|
-
createVNode("span", { class: "line" }, [
|
|
3940
|
-
createVNode("span", { style: { "color": "#D73A49" } }, "function"),
|
|
3941
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3942
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "toggleLocales"),
|
|
3943
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
3944
|
-
createVNode("span", { style: { "color": "#E36209" } }, "lang"),
|
|
3945
|
-
createVNode("span", { style: { "color": "#D73A49" } }, ":"),
|
|
3946
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3947
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "val"),
|
|
3948
|
-
createVNode("span", { style: { "color": "#24292E" } }, ") {")
|
|
3949
|
-
]),
|
|
3950
|
-
createTextVNode("\n"),
|
|
3951
|
-
createVNode("span", { class: "line" }, [
|
|
3952
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3953
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// ...")
|
|
3954
|
-
]),
|
|
3955
|
-
createTextVNode("\n"),
|
|
3956
|
-
createVNode("span", { class: "line" }, [
|
|
3957
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3958
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// save locale")
|
|
3959
|
-
]),
|
|
3960
|
-
createTextVNode("\n"),
|
|
3961
|
-
createVNode("span", { class: "line" }, [
|
|
3962
|
-
createVNode("span", { style: { "color": "#24292E" } }, " localStorage."),
|
|
3963
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "setItem"),
|
|
3964
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
3965
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'valaxy-locale'"),
|
|
3966
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", lang)")
|
|
3967
|
-
]),
|
|
3968
|
-
createTextVNode("\n"),
|
|
3969
|
-
createVNode("span", { class: "line" }, [
|
|
3970
|
-
createVNode("span", { style: { "color": "#24292E" } }, " "),
|
|
3971
|
-
createVNode("span", { style: { "color": "#6A737D" } }, "// set html lang")
|
|
3972
|
-
]),
|
|
3973
|
-
createTextVNode("\n"),
|
|
3974
|
-
createVNode("span", { class: "line" }, [
|
|
3975
|
-
createVNode("span", { style: { "color": "#24292E" } }, " document.documentElement."),
|
|
3976
|
-
createVNode("span", { style: { "color": "#6F42C1" } }, "setAttribute"),
|
|
3977
|
-
createVNode("span", { style: { "color": "#24292E" } }, "("),
|
|
3978
|
-
createVNode("span", { style: { "color": "#032F62" } }, "'lang'"),
|
|
3979
|
-
createVNode("span", { style: { "color": "#24292E" } }, ", lang)")
|
|
3980
|
-
]),
|
|
3981
|
-
createTextVNode("\n"),
|
|
3982
|
-
createVNode("span", { class: "line" }, [
|
|
3983
|
-
createVNode("span", { style: { "color": "#24292E" } }, "}")
|
|
3984
|
-
])
|
|
3985
|
-
])
|
|
3986
|
-
])
|
|
3987
|
-
]),
|
|
3988
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
3989
|
-
createVNode("p", null, [
|
|
3990
|
-
createTextVNode("值得一提的是,在查看 "),
|
|
3991
|
-
createVNode("code", null, "lang"),
|
|
3992
|
-
createTextVNode(" 文档时,我意外地发现 "),
|
|
3993
|
-
createVNode("code", null, ":lang"),
|
|
3994
|
-
createTextVNode(" 也是一种支持的选择器。 因此上述的 CSS 中 "),
|
|
3995
|
-
createVNode("code", null, '[lang="xxx"]'),
|
|
3996
|
-
createTextVNode(" 也可以替换为 "),
|
|
3997
|
-
createVNode("code", null, ":lang(xxx)"),
|
|
3998
|
-
createTextVNode("。")
|
|
3999
|
-
]),
|
|
4000
|
-
createVNode("p", null, [
|
|
4001
|
-
createTextVNode("但是 "),
|
|
4002
|
-
createVNode("code", null, ":lang()"),
|
|
4003
|
-
createTextVNode(" 也会命中默认语言的 "),
|
|
4004
|
-
createVNode("code", null, "div"),
|
|
4005
|
-
createTextVNode("(没有 lang 字段,但处于含有 lang 的标签中),因此为了安全,我们还是应该使用 class 的属性查询。")
|
|
4006
|
-
])
|
|
4007
|
-
]),
|
|
4008
|
-
createVNode("div", { lang: "en" }, [
|
|
4009
|
-
createVNode("p", null, [
|
|
4010
|
-
createTextVNode("It's worth mentioning that when looking at the "),
|
|
4011
|
-
createVNode("code", null, "lang"),
|
|
4012
|
-
createTextVNode(" documentation, I accidentally found that "),
|
|
4013
|
-
createVNode("code", null, ":lang"),
|
|
4014
|
-
createTextVNode(" is also a supported selector. So "),
|
|
4015
|
-
createVNode("code", null, '[lang="xxx"]'),
|
|
4016
|
-
createTextVNode(" in the CSS above could also be replaced with "),
|
|
4017
|
-
createVNode("code", null, ":lang(xxx)"),
|
|
4018
|
-
createTextVNode(".")
|
|
4019
|
-
]),
|
|
4020
|
-
createVNode("p", null, [
|
|
4021
|
-
createTextVNode("However, "),
|
|
4022
|
-
createVNode("code", null, ":lang()"),
|
|
4023
|
-
createTextVNode(" will also hit the default language "),
|
|
4024
|
-
createVNode("code", null, "div"),
|
|
4025
|
-
createTextVNode(" (which has no lang field but is in a tag containing lang), so to be safe we should still use the class attribute query.")
|
|
4026
|
-
])
|
|
4027
|
-
]),
|
|
4028
|
-
createVNode("div", { lang: "zh-CN" }, [
|
|
4029
|
-
createVNode("p", null, "我认为 vue-i18n 与 CSS i18n 的互补,可以非常好地解决单页内的 i18n 切换。 不妨一试?")
|
|
4030
|
-
]),
|
|
4031
|
-
createVNode("div", { lang: "en" }, [
|
|
4032
|
-
createVNode("p", null, "I think vue-i18n complements CSS i18n and could be a very good solution for i18n switching within a single page. Why not give it a try?")
|
|
4033
|
-
])
|
|
4034
|
-
];
|
|
4035
|
-
}
|
|
4036
|
-
}),
|
|
4037
|
-
"main-header": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4038
|
-
if (_push2) {
|
|
4039
|
-
ssrRenderSlot(_ctx.$slots, "main-header", {}, null, _push2, _parent2, _scopeId);
|
|
4040
|
-
} else {
|
|
4041
|
-
return [
|
|
4042
|
-
renderSlot(_ctx.$slots, "main-header")
|
|
4043
|
-
];
|
|
4044
|
-
}
|
|
4045
|
-
}),
|
|
4046
|
-
"main-header-after": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4047
|
-
if (_push2) {
|
|
4048
|
-
ssrRenderSlot(_ctx.$slots, "main-header-after", {}, null, _push2, _parent2, _scopeId);
|
|
4049
|
-
} else {
|
|
4050
|
-
return [
|
|
4051
|
-
renderSlot(_ctx.$slots, "main-header-after")
|
|
4052
|
-
];
|
|
4053
|
-
}
|
|
4054
|
-
}),
|
|
4055
|
-
"main-nav": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4056
|
-
if (_push2) {
|
|
4057
|
-
ssrRenderSlot(_ctx.$slots, "main-nav", {}, null, _push2, _parent2, _scopeId);
|
|
4058
|
-
} else {
|
|
4059
|
-
return [
|
|
4060
|
-
renderSlot(_ctx.$slots, "main-nav")
|
|
4061
|
-
];
|
|
4062
|
-
}
|
|
4063
|
-
}),
|
|
4064
|
-
"main-content": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4065
|
-
if (_push2) {
|
|
4066
|
-
ssrRenderSlot(_ctx.$slots, "main-content", {}, null, _push2, _parent2, _scopeId);
|
|
4067
|
-
} else {
|
|
4068
|
-
return [
|
|
4069
|
-
renderSlot(_ctx.$slots, "main-content")
|
|
4070
|
-
];
|
|
4071
|
-
}
|
|
4072
|
-
}),
|
|
4073
|
-
"main-content-after": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4074
|
-
if (_push2) {
|
|
4075
|
-
ssrRenderSlot(_ctx.$slots, "main-content-after", {}, null, _push2, _parent2, _scopeId);
|
|
4076
|
-
} else {
|
|
4077
|
-
return [
|
|
4078
|
-
renderSlot(_ctx.$slots, "main-content-after")
|
|
4079
|
-
];
|
|
4080
|
-
}
|
|
4081
|
-
}),
|
|
4082
|
-
"main-nav-before": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4083
|
-
if (_push2) {
|
|
4084
|
-
ssrRenderSlot(_ctx.$slots, "main-nav-before", {}, null, _push2, _parent2, _scopeId);
|
|
4085
|
-
} else {
|
|
4086
|
-
return [
|
|
4087
|
-
renderSlot(_ctx.$slots, "main-nav-before")
|
|
4088
|
-
];
|
|
4089
|
-
}
|
|
4090
|
-
}),
|
|
4091
|
-
"main-nav-after": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4092
|
-
if (_push2) {
|
|
4093
|
-
ssrRenderSlot(_ctx.$slots, "main-nav-after", {}, null, _push2, _parent2, _scopeId);
|
|
4094
|
-
} else {
|
|
4095
|
-
return [
|
|
4096
|
-
renderSlot(_ctx.$slots, "main-nav-after")
|
|
4097
|
-
];
|
|
4098
|
-
}
|
|
4099
|
-
}),
|
|
4100
|
-
comment: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4101
|
-
if (_push2) {
|
|
4102
|
-
ssrRenderSlot(_ctx.$slots, "comment", {}, null, _push2, _parent2, _scopeId);
|
|
4103
|
-
} else {
|
|
4104
|
-
return [
|
|
4105
|
-
renderSlot(_ctx.$slots, "comment")
|
|
4106
|
-
];
|
|
4107
|
-
}
|
|
4108
|
-
}),
|
|
4109
|
-
footer: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4110
|
-
if (_push2) {
|
|
4111
|
-
ssrRenderSlot(_ctx.$slots, "footer", {}, null, _push2, _parent2, _scopeId);
|
|
4112
|
-
} else {
|
|
4113
|
-
return [
|
|
4114
|
-
renderSlot(_ctx.$slots, "footer")
|
|
4115
|
-
];
|
|
4116
|
-
}
|
|
4117
|
-
}),
|
|
4118
|
-
aside: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4119
|
-
if (_push2) {
|
|
4120
|
-
ssrRenderSlot(_ctx.$slots, "aside", {}, null, _push2, _parent2, _scopeId);
|
|
4121
|
-
} else {
|
|
4122
|
-
return [
|
|
4123
|
-
renderSlot(_ctx.$slots, "aside")
|
|
4124
|
-
];
|
|
4125
|
-
}
|
|
4126
|
-
}),
|
|
4127
|
-
"aside-custom": withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4128
|
-
if (_push2) {
|
|
4129
|
-
ssrRenderSlot(_ctx.$slots, "aside-custom", {}, null, _push2, _parent2, _scopeId);
|
|
4130
|
-
} else {
|
|
4131
|
-
return [
|
|
4132
|
-
renderSlot(_ctx.$slots, "aside-custom")
|
|
4133
|
-
];
|
|
4134
|
-
}
|
|
4135
|
-
}),
|
|
4136
|
-
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
4137
|
-
if (_push2) {
|
|
4138
|
-
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
|
|
4139
|
-
} else {
|
|
4140
|
-
return [
|
|
4141
|
-
renderSlot(_ctx.$slots, "default")
|
|
4142
|
-
];
|
|
4143
|
-
}
|
|
4144
|
-
}),
|
|
4145
|
-
_: 3
|
|
4146
|
-
/* FORWARDED */
|
|
4147
|
-
}, _parent));
|
|
4148
|
-
}
|
|
4149
|
-
const _sfc_setup = _sfc_main.setup;
|
|
4150
|
-
_sfc_main.setup = (props, ctx) => {
|
|
4151
|
-
const ssrContext = useSSRContext();
|
|
4152
|
-
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../../../docs/pages/posts/i18n.md");
|
|
4153
|
-
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
4154
|
-
};
|
|
4155
|
-
const i18n = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
|
|
4156
|
-
export {
|
|
4157
|
-
__pageData,
|
|
4158
|
-
i18n as default
|
|
4159
|
-
};
|