-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathi18n.ts
More file actions
425 lines (419 loc) · 14.3 KB
/
i18n.ts
File metadata and controls
425 lines (419 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
import type { Language } from './ui/UIContext';
type LocaleText = {
navGallery: string;
navGithubLabel: string;
navLanguageToggle: string;
navThemeToggle: string;
langZh: string;
langEn: string;
themeLight: string;
themeDark: string;
heroBadge: string;
heroTitleLine1: string;
heroTitleLine2: string;
heroDescription: string;
livePreview: string;
exploreTemplate: string;
notFoundTitle: string;
notFoundButton: string;
tabConfig: string;
tabCode: string;
panelTitle: string;
codeHint: string;
detailCopy: string;
detailCopied: string;
modeLabel: string;
};
export const localeText: Record<Language, LocaleText> = {
zh: {
navGallery: '作品库',
navGithubLabel: '打开 GitHub 仓库',
navLanguageToggle: '切换语言',
navThemeToggle: '切换明暗模式',
langZh: '中',
langEn: 'EN',
themeLight: '浅色',
themeDark: '夜间',
heroBadge: 'Canvas 动效灵感库',
heroTitleLine1: '让你的首页第一屏',
heroTitleLine2: '更有动态质感',
heroDescription: '直接预览、实时调参、复制代码。每个背景都面向展示型网站优化,适合品牌官网、作品集和活动落地页。',
livePreview: '实时预览',
exploreTemplate: '查看模板',
notFoundTitle: '未找到该背景',
notFoundButton: '返回作品库',
tabConfig: '参数',
tabCode: '代码',
panelTitle: '控制面板',
codeHint: '支持直接复制 HTML 或 JavaScript 代码。建议先在当前页面调好参数,再粘贴到你的项目。',
detailCopy: '复制',
detailCopied: '已复制',
modeLabel: '模式',
},
en: {
navGallery: 'Gallery',
navGithubLabel: 'Open GitHub repository',
navLanguageToggle: 'Toggle language',
navThemeToggle: 'Toggle theme',
langZh: '中',
langEn: 'EN',
themeLight: 'Light',
themeDark: 'Dark',
heroBadge: 'Canvas Motion Library',
heroTitleLine1: 'Make your website hero',
heroTitleLine2: 'feel alive and premium',
heroDescription: 'Preview instantly, tweak controls in real time, then copy the React snippet. Built for portfolios, product sites, and campaign landing pages.',
livePreview: 'Live Preview',
exploreTemplate: 'Explore Template',
notFoundTitle: 'Background not found',
notFoundButton: 'Return to Gallery',
tabConfig: 'Config',
tabCode: 'Code',
panelTitle: 'Control Panel',
codeHint: 'Copy either the HTML or JavaScript snippet directly. Tune the visual parameters first, then paste into your project.',
detailCopy: 'Copy',
detailCopied: 'Copied!',
modeLabel: 'Mode',
},
};
const zhBackgroundText: Record<string, { name: string; description: string }> = {
particles: {
name: '粒子网络',
description: '可交互的连接粒子网络,适合科技感与数据感场景。',
},
waves: {
name: '海浪曲面',
description: '多层正弦波叠加形成柔和流动感,适合品牌展示页。',
},
gradient: {
name: '流体渐变',
description: '有机流动的径向渐变色块,适合视觉主屏和活动页。',
},
confetti: {
name: '彩屑漂流',
description: '彩色粒子缓慢飘落并受鼠标水平影响,氛围感更轻松活泼。',
},
'text-flow': {
name: '文字流场',
description: '粒子从文字中喷涌并在流场和重力影响下运动,适合品牌主视觉。',
},
magnetic: {
name: '磁性流场',
description: '发光粒子会被鼠标吸引并带出拖尾,适合科技感主视觉。',
},
'antigravity-ring': {
name: '反重力环流',
description: '空心环状短划粒子场,跟随鼠标并带有局部色带变化。',
},
'cursor-trail': {
name: '鼠标尾迹',
description: '高密度微粒随鼠标扰动并留下柔滑尾迹,适合深色背景。',
},
'stardust-burst': {
name: '星尘爆发',
description: '点击触发星尘爆发,支持拖尾、重力和颜色漂移,适合活动页和主视觉。',
},
'fireworks-burst': {
name: '烟花爆发',
description: '点击或触摸触发彩色粒子爆发,并带有冲击波圆环扩散效果。',
},
'edge-link': {
name: '边缘连线',
description: '粒子从四周缓慢进入并呼吸闪烁,接近鼠标时形成动态连线网络。',
},
'starfield-warp': {
name: '星际穿梭',
description: '复古 3D 星空穿梭效果,支持 Warp 拖尾与透视速度调节。',
},
'orbit-trails': {
name: '轨道尾迹',
description: '围绕鼠标轨道旋转的粒子尾迹,按住可增强扩散半径。',
},
'dot-countdown': {
name: '粒子倒计时',
description: '彩色粒子先在空间游走,再聚合成倒计时数字与 GO 文案。',
},
'classic-fireworks': {
name: '经典烟花',
description: '火箭升空后在空中爆炸,粒子叠加出明亮的经典烟花拖尾。',
},
'branch-lines': {
name: '分形线生长',
description: '线条从中心开始分叉扩张,叠加出彩色霓虹分形轨迹。',
},
'magic-dust': {
name: '魔法尘粒',
description: '鼠标移动会散发发光尘粒,背景中还有持续漂浮的柔和粒子。',
},
'flow-triangles': {
name: '流场三角粒子',
description: '三角粒子由鼠标发射并沿噪声流场运动,形成灵动的彩色轨迹。',
},
'rain-shower': {
name: '暴雨飞溅',
description: '高性能雨线与水花飞溅效果,支持风向、强度和鼠标交互调节。',
},
'ambient-fireworks': {
name: '环境烟花',
description: '自动爆发式彩色粒子烟花,带拖尾残影和可配置混合亮度。',
},
'snow-drift': {
name: '雪花漂移',
description: '轻柔雪花随风下落并带有横向摆动,可开启鼠标风力交互。',
},
'pixel-field': {
name: '像素力场网格',
description: '高密度像素网格受鼠标力场扰动后回弹,形成丝滑的流体拉扯感。',
},
'pixel-grid-trail': {
name: '像素格子尾迹',
description: '深色格子被鼠标发射的彩色像素点亮并渐隐,形成电子霓虹拖尾效果。',
},
'wave-dots': {
name: '波动点阵',
description: '点阵会随鼠标邻域放大并叠加正弦扰动,形成流动的波纹视觉。',
},
'bubble-drift': {
name: '气泡漂流',
description: '发光气泡从底部缓慢上浮,接近鼠标时会柔和避让,氛围轻盈宁静。',
},
'bubble-bounce': {
name: '反弹气泡',
description: '蓝色描边气泡在屏幕内弹跳,可调节尺寸、速度与拖尾强度,风格简洁干净。',
},
};
const zhConfigLabelMap: Record<string, string> = {
'Background Color': '背景颜色',
'Particle Color': '粒子颜色',
'Particle Count': '粒子数量',
'Connection Distance': '连线距离',
'Line Color': '连线颜色',
'Node Color': '节点颜色',
'Grid Step': '网格步长',
'Neighbor Count': '邻居数量',
'Move Range': '漂移范围',
'Move Speed': '漂移速度',
'Confetti Count': '彩屑数量',
'Size Min': '最小尺寸',
'Size Max': '最大尺寸',
'Fall Speed': '下落速度',
'Horizontal Drift': '水平漂移',
'Mouse Influence': '鼠标影响',
'Fade Speed': '淡入淡出速度',
'Color A': '颜色 A',
'Color B': '颜色 B',
'Color C': '颜色 C',
'Color D': '颜色 D',
'Color E': '颜色 E',
Text: '文字',
Flow: '流场力度',
'Top Speed': '最大速度',
Lifespan: '生命周期',
'Flow Offset': '流场偏移',
'Gravity Direction': '重力方向',
'Gravity Force': '重力强度',
'Particle Scale': '粒子缩放',
Speed: '速度',
'Wave Color Start': '波形起始色',
'Wave Color End': '波形结束色',
'Wave Count': '波浪层数',
Amplitude: '振幅',
Frequency: '频率',
'Color 1': '颜色 1',
'Color 2': '颜色 2',
'Color 3': '颜色 3',
'Glow Color': '辉光颜色',
'Particle Size': '粒子大小',
'Pointer Radius': '鼠标影响半径',
'Pointer Smoothing': '鼠标平滑度',
'Node Radius Min': '节点最小半径',
'Node Radius Max': '节点最大半径',
'Line Width': '线宽',
'Idle Line Alpha': '空闲线透明度',
'Idle Node Alpha': '空闲点透明度',
'Idle Drift': '空闲漂移',
'Pointer Force': '鼠标牵引力',
Friction: '阻尼',
Drift: '随机漂移',
'Ring Radius': '环半径',
'Ring Width': '环宽 1',
'Ring Width 2': '环宽 2',
'Ring Displacement': '环位移强度',
'Noise Amount': '噪声强度',
Density: '密度',
'Particle Limit': '粒子上限',
'Particles Scale': '粒子缩放',
'Max Velocity': '最大速度',
'Mouse Radius': '鼠标影响范围',
'Mouse Strength': '鼠标强度',
'Trail Alpha': '尾迹透明度',
'Point Size': '粒子尺寸',
Jitter: '随机扰动',
Scale: '缩放',
'Max Particle Size': '粒子最大尺寸',
'Color Variation': '颜色波动',
'Background Fade': '背景淡化',
'Auto Burst': '自动爆发',
'Auto Burst Interval': '自动爆发间隔',
'Particle Radius Min': '粒子最小半径',
'Particle Radius Max': '粒子最大半径',
'Spread Min': '最小扩散半径',
'Spread Max': '最大扩散半径',
'Duration Min': '最短时长',
'Duration Max': '最长时长',
'Ring Radius Min': '圆环最小半径',
'Ring Radius Max': '圆环最大半径',
'Ring Line Width': '圆环线宽',
'Fade Alpha': '残影透明度',
'Auto Burst Jitter': '自动爆发抖动',
'Stop Auto On Interact': '交互后停止自动',
'Ball Count': '球体数量',
'Ball Radius': '球体半径',
'Speed Min': '最小速度',
'Speed Max': '最大速度',
'Distance Limit': '连线阈值距离',
'Pulse Speed': '呼吸速度',
'Enable Mouse Node': '启用鼠标节点',
'Spawn Padding': '出生边距',
'Bounds Padding': '边界留白',
'Star Color': '星点颜色',
'Star Count': '星点数量',
'Focal Length': '焦距',
'Base Speed': '基础速度',
'Warp Enabled': '启用 Warp',
'Warp Speed': 'Warp 速度',
'Trail Fade': '拖尾淡化',
'Max Depth': '最大深度',
'Star Size': '星点尺寸',
'Min Opacity': '最小透明度',
'Max Opacity': '最大透明度',
'Orbit Radius': '轨道半径',
'Orbit Scale Max': '最大扩散倍率',
'Luma Min': '亮度下限',
'Luma Max': '亮度上限',
'Hue Min': '色相下限',
'Hue Max': '色相上限',
'Press Boost': '按住增强',
'Dot Count': '点数量',
'Dot Radius': '点半径',
'Sample Gap': '采样间隔',
'Hold Time': '停留时长',
'Step Duration (ms)': '步进时长(ms)',
'Move Ease': '移动缓动',
'Roam Alpha': '游走透明度',
'Form Alpha': '成形透明度',
'Start Number': '起始数字',
'End Number': '终止数字',
'Loop Countdown': '循环倒计时',
'Hue Shift Speed': '色相变化速度',
'Auto Launch Interval': '自动发射间隔',
'Hold Launch Interval': '按住发射间隔',
'Rocket Start Speed': '火箭初始速度',
'Rocket Acceleration': '火箭加速度',
'Rocket Trail Length': '火箭拖尾长度',
'Particle Speed Min': '粒子最小速度',
'Particle Speed Max': '粒子最大速度',
'Particle Friction': '粒子阻尼',
'Particle Gravity': '粒子重力',
'Particle Decay Min': '粒子最小衰减',
'Particle Decay Max': '粒子最大衰减',
'Particle Trail Length': '粒子拖尾长度',
'Min Distance': '最小距离',
'Max Distance': '最大距离',
'Initial Width': '初始宽度',
'Max Lines': '最大线段数',
'Initial Lines': '初始线段数',
'Spawn Interval': '生成间隔',
'Spawn Chance': '生成概率',
'Branch Chance': '分叉概率',
'Die Chance': '终止概率',
'Width Decay': '宽度衰减',
'Shadow Blur': '阴影模糊',
'Ambient Count': '环境粒子数',
'Burst Count': '喷发粒子数',
'Life Min': '最短生命周期',
'Life Max': '最长生命周期',
'Glow Strength': '辉光强度',
'Cell Size': '网格尺寸',
'Force Strength': '流场强度',
'Noise Scale': '噪声缩放',
'Time Scale': '时间尺度',
'Spawn Per Frame': '每帧发射数',
'Emitter Lerp': '发射器跟随',
'Particle Drag': '粒子阻尼',
'Alpha Decay': '透明度衰减',
'Triangle Spread': '三角扩散',
'Hue Saturation': '色相饱和度',
'Lightness Min': '亮度下限',
'Lightness Max': '亮度上限',
'Rain Color': '雨滴颜色',
'Spawn Rate': '生成频率',
Wind: '风力',
'Splash Count': '飞溅数量',
'Line Length': '雨线长度',
'Max Rain': '最大雨滴数',
'Max Drops': '最大水花数',
Gravity: '重力',
'Drop Max Speed': '水花最大速度',
'Drop Size Min': '水花最小尺寸',
'Drop Size Max': '水花最大尺寸',
Interaction: '交互开关',
'Pointer Wind': '鼠标风力',
'Pointer Spawn Boost': '鼠标增雨强度',
'Burst Count Jitter': '爆发粒子抖动',
'Particle Size Min': '粒子最小尺寸',
'Particle Size Max': '粒子最大尺寸',
'Burst Margin': '爆发边距',
'Color Mode': '颜色模式',
'Click Burst': '点击爆发',
'Snow Color': '雪花颜色',
'Drift Min': '最小横向漂移',
'Drift Max': '最大横向漂移',
'Sway Amount': '摆动幅度',
Rows: '行数',
Cols: '列数',
Spacing: '点间距',
Margin: '边距',
Thickness: '力场范围',
Drag: '阻尼',
Ease: '回弹速度',
'Auto Motion': '自动轨迹',
'Motion Scale': '自动轨迹幅度',
Interlace: '隔帧渲染',
'Base Cell Color': '基础网格色',
'Dot Color': '点阵颜色',
'Max Scale': '最大缩放',
'Radius Gain': '半径增益',
'Wave Speed': '波动速度',
'Wave Amplitude': '波动振幅',
'Wave Frequency': '波动频率',
'Bubble Count': '气泡数量',
'Radius Min': '最小半径',
'Radius Max': '最大半径',
'Repel Radius': '排斥半径',
'Repel Strength': '排斥强度',
'Core Color': '核心颜色',
'Mid Color': '中间颜色',
'Edge Color': '边缘颜色',
'Outline Alpha': '描边透明度',
'Circle Count': '圆圈数量',
'Stroke Width': '描边宽度',
'Bounce Loss': '反弹损耗',
};
export function getBackgroundLocalized(
language: Language,
id: string,
fallbackName: string,
fallbackDescription: string
) {
if (language === 'zh' && zhBackgroundText[id]) {
return zhBackgroundText[id];
}
return { name: fallbackName, description: fallbackDescription };
}
export function getConfigLabelLocalized(language: Language, label: string) {
if (language === 'zh') {
return zhConfigLabelMap[label] ?? label;
}
return label;
}