aboutsummaryrefslogtreecommitdiff
path: root/doc/docs/.vitepress
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2026-02-06 08:42:20 +0800
committerLi Jin <dragon-fly@qq.com>2026-02-06 08:42:20 +0800
commitb350a76827329e05e97c25e07bb8ea2a7efe30b4 (patch)
tree81d865d8e5856c4c991385c0d0856522d803f075 /doc/docs/.vitepress
parent5d7a9205df3c20f5b6a0464f3e1123394a7ca23a (diff)
downloadyuescript-b350a76827329e05e97c25e07bb8ea2a7efe30b4.tar.gz
yuescript-b350a76827329e05e97c25e07bb8ea2a7efe30b4.tar.bz2
yuescript-b350a76827329e05e97c25e07bb8ea2a7efe30b4.zip
docs: add German and Portuguese (Brazil) localescodex/add-portuguese-and-german-language-support
Diffstat (limited to 'doc/docs/.vitepress')
-rw-r--r--doc/docs/.vitepress/config.mts335
1 files changed, 203 insertions, 132 deletions
diff --git a/doc/docs/.vitepress/config.mts b/doc/docs/.vitepress/config.mts
index 188c2fa..39ded54 100644
--- a/doc/docs/.vitepress/config.mts
+++ b/doc/docs/.vitepress/config.mts
@@ -19,137 +19,182 @@ const yuescriptLanguage = {
19 aliases: ['yue'], 19 aliases: ['yue'],
20} 20}
21 21
22// Generate sidebar configuration function 22const sidebarText = {
23function createSidebar(basePath: string, zh: boolean) { 23 en: {
24 introduction: 'Introduction',
25 installation: 'Installation',
26 usage: 'Usage',
27 macro: 'Macro',
28 operator: 'Operator',
29 module: 'Module',
30 assignment: 'Assignment',
31 destructuringAssignment: 'Destructuring Assignment',
32 ifAssignment: 'If Assignment',
33 varargsAssignment: 'Varargs Assignment',
34 whitespace: 'Whitespace',
35 comment: 'Comment',
36 try: 'Try',
37 attributes: 'Attributes',
38 literals: 'Literals',
39 functionLiterals: 'Function Literals',
40 backcalls: 'Backcalls',
41 tableLiterals: 'Table Literals',
42 comprehensions: 'Comprehensions',
43 forLoop: 'For Loop',
44 whileLoop: 'While Loop',
45 continueStatement: 'Continue Statement',
46 conditionals: 'Conditionals',
47 lineDecorators: 'Line Decorators',
48 switch: 'Switch',
49 objectOrientedProgramming: 'Object Oriented Programming',
50 withStatement: 'With Statement',
51 do: 'Do',
52 functionStubs: 'Function Stubs',
53 usingClause: 'The Using Clause; Controlling Destructive Assignment',
54 yuescriptLibrary: 'The YueScript Library',
55 licenseMit: 'License: MIT',
56 },
57 zh: {
58 introduction: '介绍',
59 installation: '安装',
60 usage: '使用方法',
61 macro: '宏',
62 operator: '操作符',
63 module: '模块',
64 assignment: '赋值',
65 destructuringAssignment: '解构赋值',
66 ifAssignment: 'if 赋值',
67 varargsAssignment: '可变参数赋值',
68 whitespace: '空白',
69 comment: '注释',
70 try: '错误处理',
71 attributes: '属性',
72 literals: '字面量',
73 functionLiterals: '函数字面量',
74 backcalls: '反向回调',
75 tableLiterals: '表格字面量',
76 comprehensions: '推导式',
77 forLoop: 'for 循环',
78 whileLoop: 'while 循环',
79 continueStatement: 'continue 语句',
80 conditionals: '条件语句',
81 lineDecorators: '代码行修饰符',
82 switch: 'switch 语句',
83 objectOrientedProgramming: '面向对象编程',
84 withStatement: 'with 语句',
85 do: 'do 语句',
86 functionStubs: '函数存根',
87 usingClause: '使用 using 语句:防止破坏性赋值',
88 yuescriptLibrary: '月之脚本语言库',
89 licenseMit: 'MIT 许可证',
90 },
91 de: {
92 introduction: 'Einführung',
93 installation: 'Installation',
94 usage: 'Verwendung',
95 macro: 'Makro',
96 operator: 'Operatoren',
97 module: 'Modul',
98 assignment: 'Zuweisung',
99 destructuringAssignment: 'Destrukturierende Zuweisung',
100 ifAssignment: 'If-Zuweisung',
101 varargsAssignment: 'Varargs-Zuweisung',
102 whitespace: 'Leerraum',
103 comment: 'Kommentare',
104 try: 'Try/Catch',
105 attributes: 'Attribute',
106 literals: 'Literale',
107 functionLiterals: 'Funktionsliterale',
108 backcalls: 'Backcalls',
109 tableLiterals: 'Tabellenliterale',
110 comprehensions: 'Comprehensions',
111 forLoop: 'For-Schleife',
112 whileLoop: 'While-Schleife',
113 continueStatement: 'Continue-Anweisung',
114 conditionals: 'Bedingungen',
115 lineDecorators: 'Zeilen-Dekoratoren',
116 switch: 'Switch',
117 objectOrientedProgramming: 'Objektorientierte Programmierung',
118 withStatement: 'With-Anweisung',
119 do: 'Do',
120 functionStubs: 'Funktions-Stubs',
121 usingClause: 'Die Using-Klausel; Kontrolle destruktiver Zuweisung',
122 yuescriptLibrary: 'Die YueScript-Bibliothek',
123 licenseMit: 'Lizenz: MIT',
124 },
125 ptBr: {
126 introduction: 'Introdução',
127 installation: 'Instalação',
128 usage: 'Uso',
129 macro: 'Macro',
130 operator: 'Operadores',
131 module: 'Módulo',
132 assignment: 'Atribuição',
133 destructuringAssignment: 'Atribuição com desestruturação',
134 ifAssignment: 'Atribuição com if',
135 varargsAssignment: 'Atribuição de varargs',
136 whitespace: 'Espaços em branco',
137 comment: 'Comentários',
138 try: 'Try/Catch',
139 attributes: 'Atributos',
140 literals: 'Literais',
141 functionLiterals: 'Literais de função',
142 backcalls: 'Backcalls',
143 tableLiterals: 'Literais de tabela',
144 comprehensions: 'Compreensões',
145 forLoop: 'Laço for',
146 whileLoop: 'Laço while',
147 continueStatement: 'Instrução continue',
148 conditionals: 'Condicionais',
149 lineDecorators: 'Decoradores de linha',
150 switch: 'Switch',
151 objectOrientedProgramming: 'Programação orientada a objetos',
152 withStatement: 'Instrução with',
153 do: 'Do',
154 functionStubs: 'Stubs de função',
155 usingClause: 'Cláusula using; controlando atribuição destrutiva',
156 yuescriptLibrary: 'A biblioteca do YueScript',
157 licenseMit: 'Licença: MIT',
158 },
159} as const
160
161type SidebarLocale = keyof typeof sidebarText
162
163function createSidebar(basePath: string, locale: SidebarLocale) {
164 const text = sidebarText[locale]
24 return [ 165 return [
25 { 166 { text: text.introduction, link: `${basePath}/introduction` },
26 text: zh ? '介绍' : 'Introduction', 167 { text: text.installation, link: `${basePath}/installation` },
27 link: `${basePath}/introduction`, 168 { text: text.usage, link: `${basePath}/usage` },
28 }, 169 { text: text.macro, link: `${basePath}/macro` },
29 { 170 { text: text.operator, link: `${basePath}/operator` },
30 text: zh ? '安装' : 'Installation', 171 { text: text.module, link: `${basePath}/module` },
31 link: `${basePath}/installation`, 172 { text: text.assignment, link: `${basePath}/assignment` },
32 }, 173 { text: text.destructuringAssignment, link: `${basePath}/destructuring-assignment` },
33 { 174 { text: text.ifAssignment, link: `${basePath}/if-assignment` },
34 text: zh ? '使用方法' : 'Usage', 175 { text: text.varargsAssignment, link: `${basePath}/varargs-assignment` },
35 link: `${basePath}/usage`, 176 { text: text.whitespace, link: `${basePath}/whitespace` },
36 }, 177 { text: text.comment, link: `${basePath}/comment` },
37 { 178 { text: text.try, link: `${basePath}/try` },
38 text: zh ? '宏' : 'Macro', 179 { text: text.attributes, link: `${basePath}/attributes` },
39 link: `${basePath}/macro`, 180 { text: text.literals, link: `${basePath}/literals` },
40 }, 181 { text: text.functionLiterals, link: `${basePath}/function-literals` },
41 { 182 { text: text.backcalls, link: `${basePath}/backcalls` },
42 text: zh ? '操作符' : 'Operator', 183 { text: text.tableLiterals, link: `${basePath}/table-literals` },
43 link: `${basePath}/operator`, 184 { text: text.comprehensions, link: `${basePath}/comprehensions` },
44 }, 185 { text: text.forLoop, link: `${basePath}/for-loop` },
45 { 186 { text: text.whileLoop, link: `${basePath}/while-loop` },
46 text: zh ? '模块' : 'Module', 187 { text: text.continueStatement, link: `${basePath}/continue` },
47 link: `${basePath}/module`, 188 { text: text.conditionals, link: `${basePath}/conditionals` },
48 }, 189 { text: text.lineDecorators, link: `${basePath}/line-decorators` },
49 { 190 { text: text.switch, link: `${basePath}/switch` },
50 text: zh ? '赋值' : 'Assignment', 191 { text: text.objectOrientedProgramming, link: `${basePath}/object-oriented-programming` },
51 link: `${basePath}/assignment`, 192 { text: text.withStatement, link: `${basePath}/with-statement` },
52 }, 193 { text: text.do, link: `${basePath}/do` },
53 { 194 { text: text.functionStubs, link: `${basePath}/function-stubs` },
54 text: zh ? '解构赋值' : 'Destructuring Assignment', 195 { text: text.usingClause, link: `${basePath}/the-using-clause-controlling-destructive-assignment` },
55 link: `${basePath}/destructuring-assignment`, 196 { text: text.yuescriptLibrary, link: `${basePath}/the-yuescript-library` },
56 }, 197 { text: text.licenseMit, link: `${basePath}/licence-mit` },
57 {
58 text: zh ? 'if 赋值' : 'If Assignment',
59 link: `${basePath}/if-assignment`,
60 },
61 {
62 text: zh ? '可变参数赋值' : 'Varargs Assignment',
63 link: `${basePath}/varargs-assignment`,
64 },
65 {
66 text: zh ? '空白' : 'Whitespace',
67 link: `${basePath}/whitespace`,
68 },
69 {
70 text: zh ? '注释' : 'Comment',
71 link: `${basePath}/comment`,
72 },
73 {
74 text: zh ? '错误处理' : 'Try',
75 link: `${basePath}/try`,
76 },
77 {
78 text: zh ? '属性' : 'Attributes',
79 link: `${basePath}/attributes`,
80 },
81 {
82 text: zh ? '字面量' : 'Literals',
83 link: `${basePath}/literals`,
84 },
85 {
86 text: zh ? '函数字面量' : 'Function Literals',
87 link: `${basePath}/function-literals`,
88 },
89 {
90 text: zh ? '反向回调' : 'Backcalls',
91 link: `${basePath}/backcalls`,
92 },
93 {
94 text: zh ? '表格字面量' : 'Table Literals',
95 link: `${basePath}/table-literals`,
96 },
97 {
98 text: zh ? '推导式' : 'Comprehensions',
99 link: `${basePath}/comprehensions`,
100 },
101 {
102 text: zh ? 'for 循环' : 'For Loop',
103 link: `${basePath}/for-loop`,
104 },
105 {
106 text: zh ? 'while 循环' : 'While Loop',
107 link: `${basePath}/while-loop`,
108 },
109 {
110 text: zh ? 'continue 语句' : 'Continue Statement',
111 link: `${basePath}/continue`,
112 },
113 {
114 text: zh ? '条件语句' : 'Conditionals',
115 link: `${basePath}/conditionals`,
116 },
117 {
118 text: zh ? '代码行修饰符' : 'Line Decorators',
119 link: `${basePath}/line-decorators`,
120 },
121 {
122 text: zh ? 'switch 语句' : 'Switch',
123 link: `${basePath}/switch`,
124 },
125 {
126 text: zh ? '面向对象编程' : 'Object Oriented Programming',
127 link: `${basePath}/object-oriented-programming`,
128 },
129 {
130 text: zh ? 'with 语句' : 'With Statement',
131 link: `${basePath}/with-statement`,
132 },
133 {
134 text: zh ? 'do 语句' : 'Do',
135 link: `${basePath}/do`,
136 },
137 {
138 text: zh ? '函数存根' : 'Function Stubs',
139 link: `${basePath}/function-stubs`,
140 },
141 {
142 text: zh ? '使用 using 语句:防止破坏性赋值' : 'The Using Clause; Controlling Destructive Assignment',
143 link: `${basePath}/the-using-clause-controlling-destructive-assignment`,
144 },
145 {
146 text: zh ? '月之脚本语言库' : 'The YueScript Library',
147 link: `${basePath}/the-yuescript-library`,
148 },
149 {
150 text: zh ? 'MIT 许可证' : 'License: MIT',
151 link: `${basePath}/license-mit`,
152 },
153 ] 198 ]
154} 199}
155 200
@@ -223,7 +268,7 @@ export default defineConfig({
223 { text: 'Try yue!', link: '/try/' }, 268 { text: 'Try yue!', link: '/try/' },
224 { text: 'GitHub', link: 'https://github.com/IppClub/Yuescript' } 269 { text: 'GitHub', link: 'https://github.com/IppClub/Yuescript' }
225 ], 270 ],
226 sidebar: createSidebar('/doc', false), 271 sidebar: createSidebar('/doc', 'en'),
227 } 272 }
228 }, 273 },
229 zh: { 274 zh: {
@@ -236,7 +281,33 @@ export default defineConfig({
236 { text: '试一试!', link: '/zh/try/' }, 281 { text: '试一试!', link: '/zh/try/' },
237 { text: 'GitHub', link: 'https://github.com/IppClub/Yuescript' } 282 { text: 'GitHub', link: 'https://github.com/IppClub/Yuescript' }
238 ], 283 ],
239 sidebar: createSidebar('/zh/doc', true), 284 sidebar: createSidebar('/zh/doc', 'zh'),
285 }
286 },
287 de: {
288 label: 'Deutsch',
289 lang: 'de-DE',
290 description: 'Eine Sprache, die zu Lua kompiliert',
291 themeConfig: {
292 nav: [
293 { text: 'Dokumentation', link: '/de/doc/' },
294 { text: 'Yue ausprobieren!', link: '/de/try/' },
295 { text: 'GitHub', link: 'https://github.com/IppClub/Yuescript' }
296 ],
297 sidebar: createSidebar('/de/doc', 'de'),
298 }
299 },
300 'pt-br': {
301 label: 'Português (Brasil)',
302 lang: 'pt-BR',
303 description: 'Uma linguagem que compila para Lua',
304 themeConfig: {
305 nav: [
306 { text: 'Documentação', link: '/pt-br/doc/' },
307 { text: 'Experimente Yue!', link: '/pt-br/try/' },
308 { text: 'GitHub', link: 'https://github.com/IppClub/Yuescript' }
309 ],
310 sidebar: createSidebar('/pt-br/doc', 'ptBr'),
240 } 311 }
241 } 312 }
242 }, 313 },