@intlayer/docs 9.0.0-canary.14 → 9.0.0-canary.16
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/dist/cjs/generated/docs.entry.cjs +40 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +40 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/cli/index.md +1 -1
- package/docs/ar/configuration.md +42 -1
- package/docs/ar/intlayer_CMS.md +5 -128
- package/docs/ar/live-sync.md +174 -0
- package/docs/ar/releases/v9.md +45 -1
- package/docs/bn/cli/index.md +1 -1
- package/docs/bn/configuration.md +45 -1
- package/docs/cs/cli/index.md +1 -1
- package/docs/cs/configuration.md +45 -1
- package/docs/de/cli/index.md +1 -1
- package/docs/de/configuration.md +42 -1
- package/docs/de/intlayer_CMS.md +5 -135
- package/docs/de/live-sync.md +174 -0
- package/docs/de/releases/v9.md +45 -1
- package/docs/en/analytics.md +222 -0
- package/docs/en/cli/index.md +1 -1
- package/docs/en/configuration.md +42 -1
- package/docs/en/intlayer_CMS.md +6 -140
- package/docs/en/live-sync.md +184 -0
- package/docs/en/releases/v9.md +53 -3
- package/docs/en-GB/cli/index.md +1 -1
- package/docs/en-GB/configuration.md +42 -1
- package/docs/en-GB/intlayer_CMS.md +5 -128
- package/docs/en-GB/live-sync.md +173 -0
- package/docs/en-GB/releases/v9.md +45 -1
- package/docs/es/cli/index.md +1 -1
- package/docs/es/configuration.md +42 -1
- package/docs/es/intlayer_CMS.md +5 -140
- package/docs/es/live-sync.md +176 -0
- package/docs/es/releases/v9.md +45 -1
- package/docs/fr/cli/index.md +1 -1
- package/docs/fr/configuration.md +42 -1
- package/docs/fr/intlayer_CMS.md +5 -135
- package/docs/fr/live-sync.md +174 -0
- package/docs/fr/releases/v9.md +45 -1
- package/docs/hi/cli/index.md +1 -1
- package/docs/hi/configuration.md +42 -1
- package/docs/hi/intlayer_CMS.md +5 -128
- package/docs/hi/live-sync.md +174 -0
- package/docs/hi/releases/v9.md +45 -1
- package/docs/id/cli/index.md +1 -1
- package/docs/id/configuration.md +42 -1
- package/docs/id/intlayer_CMS.md +5 -139
- package/docs/id/live-sync.md +185 -0
- package/docs/id/releases/v9.md +45 -1
- package/docs/it/cli/index.md +1 -1
- package/docs/it/configuration.md +42 -1
- package/docs/it/intlayer_CMS.md +5 -128
- package/docs/it/live-sync.md +174 -0
- package/docs/it/releases/v9.md +45 -1
- package/docs/ja/cli/index.md +1 -1
- package/docs/ja/configuration.md +42 -1
- package/docs/ja/intlayer_CMS.md +5 -139
- package/docs/ja/live-sync.md +185 -0
- package/docs/ja/releases/v9.md +45 -1
- package/docs/ko/cli/index.md +1 -1
- package/docs/ko/configuration.md +42 -1
- package/docs/ko/intlayer_CMS.md +5 -141
- package/docs/ko/live-sync.md +187 -0
- package/docs/ko/releases/v9.md +45 -1
- package/docs/nl/cli/index.md +1 -1
- package/docs/nl/configuration.md +45 -1
- package/docs/pl/cli/index.md +1 -1
- package/docs/pl/configuration.md +45 -1
- package/docs/pl/intlayer_CMS.md +5 -139
- package/docs/pl/live-sync.md +185 -0
- package/docs/pl/releases/v9.md +45 -1
- package/docs/pt/cli/index.md +1 -1
- package/docs/pt/configuration.md +45 -1
- package/docs/pt/intlayer_CMS.md +5 -143
- package/docs/pt/live-sync.md +174 -0
- package/docs/pt/releases/v9.md +45 -1
- package/docs/ru/cli/index.md +1 -1
- package/docs/ru/configuration.md +42 -1
- package/docs/ru/intlayer_CMS.md +5 -139
- package/docs/ru/live-sync.md +185 -0
- package/docs/ru/releases/v9.md +45 -1
- package/docs/tr/cli/index.md +1 -1
- package/docs/tr/configuration.md +42 -1
- package/docs/tr/intlayer_CMS.md +5 -127
- package/docs/tr/live-sync.md +173 -0
- package/docs/tr/releases/v9.md +45 -1
- package/docs/uk/cli/index.md +1 -1
- package/docs/uk/configuration.md +42 -1
- package/docs/uk/intlayer_CMS.md +5 -139
- package/docs/uk/live-sync.md +185 -0
- package/docs/uk/releases/v9.md +45 -1
- package/docs/ur/cli/index.md +1 -1
- package/docs/ur/configuration.md +45 -1
- package/docs/vi/cli/index.md +1 -1
- package/docs/vi/configuration.md +42 -1
- package/docs/vi/intlayer_CMS.md +5 -139
- package/docs/vi/live-sync.md +185 -0
- package/docs/vi/releases/v9.md +45 -1
- package/docs/zh/cli/index.md +1 -1
- package/docs/zh/configuration.md +42 -1
- package/docs/zh/intlayer_CMS.md +5 -129
- package/docs/zh/live-sync.md +175 -0
- package/docs/zh/releases/v9.md +45 -1
- package/package.json +7 -7
- package/src/generated/docs.entry.ts +40 -0
package/docs/zh/intlayer_CMS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-08-23
|
|
3
|
-
updatedAt:
|
|
3
|
+
updatedAt: 2026-07-08
|
|
4
4
|
title: Intlayer CMS | 将您的内容外部化到 Intlayer CMS
|
|
5
5
|
description: 将您的内容外部化到 Intlayer CMS,以将内容管理委托给您的团队。
|
|
6
6
|
keywords:
|
|
@@ -18,6 +18,9 @@ slugs:
|
|
|
18
18
|
- cms
|
|
19
19
|
youtubeVideo: https://www.youtube.com/watch?v=UDDTnirwi_4
|
|
20
20
|
history:
|
|
21
|
+
- version: 9.0.0
|
|
22
|
+
date: 2026-07-08
|
|
23
|
+
changes: "将「实时同步」章节移动到独立页面(live-sync.md),此处仅保留简短介绍和链接"
|
|
21
24
|
- version: 6.0.1
|
|
22
25
|
date: 2025-09-22
|
|
23
26
|
changes: "添加实时同步文档"
|
|
@@ -245,134 +248,7 @@ bun x intlayer dictionary push -d my-first-dictionary-key --env production
|
|
|
245
248
|
|
|
246
249
|
实时同步让您的应用在运行时反映 CMS 内容的更改。无需重新构建或重新部署。启用后,更新会被流式传输到实时同步服务器,刷新您的应用读取的字典。
|
|
247
250
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
通过更新您的 Intlayer 配置来启用实时同步:
|
|
251
|
-
|
|
252
|
-
```typescript fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
|
|
253
|
-
import type { IntlayerConfig } from "intlayer";
|
|
254
|
-
|
|
255
|
-
const config: IntlayerConfig = {
|
|
256
|
-
// ... 其他配置设置
|
|
257
|
-
editor: {
|
|
258
|
-
/**
|
|
259
|
-
* 当检测到更改时,启用本地配置的热重载。
|
|
260
|
-
* 例如,当添加或更新字典时,应用程序会更新页面上显示的内容。
|
|
261
|
-
*
|
|
262
|
-
* 由于热重载需要与服务器保持持续连接,
|
|
263
|
-
* 因此仅对 `enterprise` 计划的客户开放。
|
|
264
|
-
*
|
|
265
|
-
* 默认值:false
|
|
266
|
-
*/
|
|
267
|
-
liveSync: true,
|
|
268
|
-
},
|
|
269
|
-
dictionary: {
|
|
270
|
-
/**
|
|
271
|
-
* 控制字典的导入方式:
|
|
272
|
-
*
|
|
273
|
-
* - "live":字典通过 Live Sync API 动态获取。
|
|
274
|
-
* 替换 useIntlayer 为 useDictionaryDynamic。
|
|
275
|
-
*
|
|
276
|
-
* 注意:Live 模式使用 Live Sync API 获取字典。如果 API 调用失败,
|
|
277
|
-
* 字典将动态导入。
|
|
278
|
-
* 注意:只有带有远程内容和 "live" 标志的字典使用 live 模式。
|
|
279
|
-
* 其他字典为了性能使用动态模式。
|
|
280
|
-
*/
|
|
281
|
-
importMode: "fetch",
|
|
282
|
-
},
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
export default config;
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
启动 Live Sync 服务器以包裹您的应用程序:
|
|
289
|
-
|
|
290
|
-
使用 Next.js 的示例:
|
|
291
|
-
|
|
292
|
-
```json5 fileName="package.json"
|
|
293
|
-
{
|
|
294
|
-
"scripts": {
|
|
295
|
-
// ... 其他脚本
|
|
296
|
-
"build": "next build",
|
|
297
|
-
"dev": "next dev",
|
|
298
|
-
"start": "npx intlayer live --with 'next start'",
|
|
299
|
-
},
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
使用 Vite 的示例:
|
|
304
|
-
|
|
305
|
-
```json5 fileName="package.json"
|
|
306
|
-
{
|
|
307
|
-
"scripts": {
|
|
308
|
-
// ... 其他脚本
|
|
309
|
-
"build": "vite build",
|
|
310
|
-
"dev": "vite dev",
|
|
311
|
-
"start": "npx intlayer live --with 'vite start'",
|
|
312
|
-
},
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
Live Sync 服务器包裹您的应用程序,并在更新内容到达时自动应用。
|
|
317
|
-
|
|
318
|
-
为了接收来自 CMS 的变更通知,Live Sync 服务器会与后端保持 SSE 连接。当 CMS 中的内容发生变化时,后端会将更新转发给 Live Sync 服务器,服务器会写入新的字典。您的应用将在下一次导航或浏览器刷新时反映更新, 无需重新构建。
|
|
319
|
-
|
|
320
|
-
流程图(CMS/后端 -> Live Sync 服务器 -> 应用服务器 -> 前端):
|
|
321
|
-
|
|
322
|
-

|
|
323
|
-
|
|
324
|
-
工作原理:
|
|
325
|
-
|
|
326
|
-

|
|
327
|
-
|
|
328
|
-
### 开发工作流程(本地)
|
|
329
|
-
|
|
330
|
-
- 在开发过程中,应用启动时会获取所有远程字典,因此您可以快速测试更新。
|
|
331
|
-
- 要在本地使用 Next.js 测试 Live Sync,请包装您的开发服务器:
|
|
332
|
-
|
|
333
|
-
```json5 fileName="package.json"
|
|
334
|
-
{
|
|
335
|
-
"scripts": {
|
|
336
|
-
// ... 其他脚本
|
|
337
|
-
"dev": "npx intlayer live --with 'next dev'",
|
|
338
|
-
// "dev": "npx intlayer live --with 'vite dev'", // 适用于 Vite
|
|
339
|
-
},
|
|
340
|
-
}
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
启用优化,以便 Intlayer 在开发期间应用实时导入转换:
|
|
344
|
-
|
|
345
|
-
```typescript fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
|
|
346
|
-
import type { IntlayerConfig } from "intlayer";
|
|
347
|
-
|
|
348
|
-
const config: IntlayerConfig = {
|
|
349
|
-
editor: {
|
|
350
|
-
applicationURL: "http://localhost:5173",
|
|
351
|
-
liveSyncURL: "http://localhost:4000",
|
|
352
|
-
liveSync: true,
|
|
353
|
-
},
|
|
354
|
-
dictionary: {
|
|
355
|
-
importMode: "fetch",
|
|
356
|
-
},
|
|
357
|
-
build: {
|
|
358
|
-
optimize: true,
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
export default config;
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
此设置将您的开发服务器与实时同步服务器包装在一起,在启动时获取远程字典,并通过 SSE 从 CMS 流式传输更新。刷新页面以查看更改。
|
|
366
|
-
|
|
367
|
-
注意事项和限制:
|
|
368
|
-
|
|
369
|
-
- 将实时同步源添加到您的站点安全策略(CSP)中。确保实时同步 URL 被允许在 `connect-src` 中(如果相关,也包括 `frame-ancestors`)。
|
|
370
|
-
- 实时同步不适用于静态输出。对于 Next.js,页面必须是动态的才能在运行时接收更新(例如,适当使用 `generateStaticParams`、`generateMetadata`、`getServerSideProps` 或 `getStaticProps`,以避免完全静态的限制)。
|
|
371
|
-
- 应用程序 URL 应与您在编辑器配置中设置的 URL (`applicationURL`) 匹配。
|
|
372
|
-
- CMS URL
|
|
373
|
-
- 确保项目配置已推送到 Intlayer CMS。
|
|
374
|
-
|
|
375
|
-
- 可视化编辑器使用 iframe 来显示您的网站。确保您网站的内容安全策略(CSP)允许 CMS URL 作为 `frame-ancestors`(默认是 'https://intlayer.org')。检查编辑器控制台是否有任何错误。
|
|
251
|
+
完整的设置指南(启用方式、启动 Live Sync 服务器、本地开发工作流程和限制条件)请参阅 [Live Sync 文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/live-sync.md)。
|
|
376
252
|
|
|
377
253
|
## 调试
|
|
378
254
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2026-07-08
|
|
3
|
+
updatedAt: 2026-07-08
|
|
4
|
+
title: 实时同步(Live Sync)| 让应用实时反映 CMS 内容变更
|
|
5
|
+
description: 让您的应用在运行时实时反映 Intlayer CMS 的内容变更,无需重新构建或重新部署。
|
|
6
|
+
keywords:
|
|
7
|
+
- 实时同步
|
|
8
|
+
- Live Sync
|
|
9
|
+
- CMS
|
|
10
|
+
- 可视化编辑器
|
|
11
|
+
- 国际化
|
|
12
|
+
- 文档
|
|
13
|
+
- Intlayer
|
|
14
|
+
- Next.js
|
|
15
|
+
- Vite
|
|
16
|
+
history:
|
|
17
|
+
- version: 9.0.0
|
|
18
|
+
date: 2026-07-08
|
|
19
|
+
changes: "从 Intlayer CMS 文档中拆分为独立页面"
|
|
20
|
+
- version: 6.0.1
|
|
21
|
+
date: 2025-09-22
|
|
22
|
+
changes: "添加实时同步文档"
|
|
23
|
+
- version: 6.0.0
|
|
24
|
+
date: 2025-09-04
|
|
25
|
+
changes: "用 `liveSync` 字段替换 `hotReload` 字段"
|
|
26
|
+
author: aymericzip
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# 实时同步
|
|
30
|
+
|
|
31
|
+
实时同步让您的应用在运行时反映 CMS 内容的更改。无需重新构建或重新部署。启用后,更新会被流式传输到实时同步服务器,刷新您的应用读取的字典。
|
|
32
|
+
|
|
33
|
+
## 目录
|
|
34
|
+
|
|
35
|
+
<TOC/>
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 启用实时同步
|
|
40
|
+
|
|
41
|
+
> 实时同步需要持续的服务器连接,并且仅在企业版计划中可用。
|
|
42
|
+
|
|
43
|
+
通过更新您的 Intlayer 配置来启用实时同步:
|
|
44
|
+
|
|
45
|
+
```typescript fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
|
|
46
|
+
import type { IntlayerConfig } from "intlayer";
|
|
47
|
+
|
|
48
|
+
const config: IntlayerConfig = {
|
|
49
|
+
// ... 其他配置设置
|
|
50
|
+
editor: {
|
|
51
|
+
/**
|
|
52
|
+
* 当检测到更改时,启用本地配置的热重载。
|
|
53
|
+
* 例如,当添加或更新字典时,应用程序会更新页面上显示的内容。
|
|
54
|
+
*
|
|
55
|
+
* 由于热重载需要与服务器保持持续连接,
|
|
56
|
+
* 因此仅对 `enterprise` 计划的客户开放。
|
|
57
|
+
*
|
|
58
|
+
* 默认值:false
|
|
59
|
+
*/
|
|
60
|
+
liveSync: true,
|
|
61
|
+
},
|
|
62
|
+
dictionary: {
|
|
63
|
+
/**
|
|
64
|
+
* 控制字典的导入方式:
|
|
65
|
+
*
|
|
66
|
+
* - "live":字典通过 Live Sync API 动态获取。
|
|
67
|
+
* 替换 useIntlayer 为 useDictionaryDynamic。
|
|
68
|
+
*
|
|
69
|
+
* 注意:Live 模式使用 Live Sync API 获取字典。如果 API 调用失败,
|
|
70
|
+
* 字典将动态导入。
|
|
71
|
+
* 注意:只有带有远程内容和 "live" 标志的字典使用 live 模式。
|
|
72
|
+
* 其他字典为了性能使用动态模式。
|
|
73
|
+
*/
|
|
74
|
+
importMode: "fetch",
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default config;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
启动 Live Sync 服务器以包裹您的应用程序:
|
|
82
|
+
|
|
83
|
+
使用 Next.js 的示例:
|
|
84
|
+
|
|
85
|
+
```json5 fileName="package.json"
|
|
86
|
+
{
|
|
87
|
+
"scripts": {
|
|
88
|
+
// ... 其他脚本
|
|
89
|
+
"build": "next build",
|
|
90
|
+
"dev": "next dev",
|
|
91
|
+
"start": "npx intlayer live --with 'next start'",
|
|
92
|
+
},
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
使用 Vite 的示例:
|
|
97
|
+
|
|
98
|
+
```json5 fileName="package.json"
|
|
99
|
+
{
|
|
100
|
+
"scripts": {
|
|
101
|
+
// ... 其他脚本
|
|
102
|
+
"build": "vite build",
|
|
103
|
+
"dev": "vite dev",
|
|
104
|
+
"start": "npx intlayer live --with 'vite start'",
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Live Sync 服务器包裹您的应用程序,并在更新内容到达时自动应用。
|
|
110
|
+
|
|
111
|
+
为了接收来自 CMS 的变更通知,Live Sync 服务器会与后端保持 SSE 连接。当 CMS 中的内容发生变化时,后端会将更新转发给 Live Sync 服务器,服务器会写入新的字典。您的应用将在下一次导航或浏览器刷新时反映更新, 无需重新构建。
|
|
112
|
+
|
|
113
|
+
流程图(CMS/后端 -> Live Sync 服务器 -> 应用服务器 -> 前端):
|
|
114
|
+
|
|
115
|
+

|
|
116
|
+
|
|
117
|
+
工作原理:
|
|
118
|
+
|
|
119
|
+

|
|
120
|
+
|
|
121
|
+
## 开发工作流程(本地)
|
|
122
|
+
|
|
123
|
+
- 在开发过程中,应用启动时会获取所有远程字典,因此您可以快速测试更新。
|
|
124
|
+
- 要在本地使用 Next.js 测试 Live Sync,请包装您的开发服务器:
|
|
125
|
+
|
|
126
|
+
```json5 fileName="package.json"
|
|
127
|
+
{
|
|
128
|
+
"scripts": {
|
|
129
|
+
// ... 其他脚本
|
|
130
|
+
"dev": "npx intlayer live --with 'next dev'",
|
|
131
|
+
// "dev": "npx intlayer live --with 'vite dev'", // 适用于 Vite
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
启用优化,以便 Intlayer 在开发期间应用实时导入转换:
|
|
137
|
+
|
|
138
|
+
```typescript fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
|
|
139
|
+
import type { IntlayerConfig } from "intlayer";
|
|
140
|
+
|
|
141
|
+
const config: IntlayerConfig = {
|
|
142
|
+
editor: {
|
|
143
|
+
applicationURL: "http://localhost:5173",
|
|
144
|
+
liveSyncURL: "http://localhost:4000",
|
|
145
|
+
liveSync: true,
|
|
146
|
+
},
|
|
147
|
+
dictionary: {
|
|
148
|
+
importMode: "fetch",
|
|
149
|
+
},
|
|
150
|
+
build: {
|
|
151
|
+
optimize: true,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export default config;
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
此设置将您的开发服务器与实时同步服务器包装在一起,在启动时获取远程字典,并通过 SSE 从 CMS 流式传输更新。刷新页面以查看更改。
|
|
159
|
+
|
|
160
|
+
## 注意事项和限制
|
|
161
|
+
|
|
162
|
+
- 将实时同步源添加到您的站点安全策略(CSP)中。确保实时同步 URL 被允许在 `connect-src` 中(如果相关,也包括 `frame-ancestors`)。
|
|
163
|
+
- 实时同步不适用于静态输出。对于 Next.js,页面必须是动态的才能在运行时接收更新(例如,适当使用 `generateStaticParams`、`generateMetadata`、`getServerSideProps` 或 `getStaticProps`,以避免完全静态的限制)。
|
|
164
|
+
- 应用程序 URL 应与您在编辑器配置中设置的 URL (`applicationURL`) 匹配。
|
|
165
|
+
- CMS URL
|
|
166
|
+
- 确保项目配置已推送到 Intlayer CMS。
|
|
167
|
+
|
|
168
|
+
- 可视化编辑器使用 iframe 来显示您的网站。确保您网站的内容安全策略(CSP)允许 CMS URL 作为 `frame-ancestors`(默认是 'https://intlayer.org')。检查编辑器控制台是否有任何错误。
|
|
169
|
+
|
|
170
|
+
## Useful links
|
|
171
|
+
|
|
172
|
+
- [Intlayer CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_CMS.md)
|
|
173
|
+
- [Intlayer 可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_visual_editor.md)
|
|
174
|
+
- [配置参考](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/configuration.md)
|
|
175
|
+
- [自托管指南](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/self_hosting.md)
|
package/docs/zh/releases/v9.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2026-06-14
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-07-08
|
|
4
4
|
title: New Intlayer v9 - What's new?
|
|
5
5
|
description: Discover what's new in Intlayer v9. Introducing drop-in compatibility packages for popular i18n libraries and support for Collections and Variants.
|
|
6
6
|
keywords:
|
|
@@ -199,6 +199,49 @@ const product = useIntlayer("product-copy", {
|
|
|
199
199
|
|
|
200
200
|
---
|
|
201
201
|
|
|
202
|
+
## `@intlayer/analytics`:内容曝光追踪与 A/B 测试
|
|
203
|
+
|
|
204
|
+
全新的可选包 [`@intlayer/analytics`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/analytics.md) 会告诉您访客实际看到了哪些内容——并通过让您对内容进行 A/B 测试、按变体衡量转化率,补上 **Collections & Variants** 的最后一环。
|
|
205
|
+
|
|
206
|
+
- **Provider 级别追踪**:`IntlayerProvider`(React / Next.js / React Native)会在加载、路由变化和语言切换时自动记录 `page_view` 事件。
|
|
207
|
+
- **节点级别追踪**:每次 `useIntlayer` 解析都会上报一个 `content_exposure` 事件——包括显示了哪个字典键、键路径、语言,以及(如适用)哪个 A/B **变体**。同一刷新窗口内对同一节点的重复曝光会被合并为一个事件。
|
|
208
|
+
- **确定性 A/B 分配**:`getVariant(experimentKey, variants)` 在**无需服务器往返**的情况下为每个会话分配变体,因此首次渲染前不会出现闪烁。
|
|
209
|
+
- **`useConversion()`**:将目标(注册、点击、购买等)归因于会话所看到的变体。
|
|
210
|
+
- **未安装时零成本**:与 `@intlayer/editor` 相同的可摇树优化模式——用 `try/catch` 包裹的动态 `import()`,加上一个编译期环境变量(`INTLAYER_ANALYTICS_ENABLED`),对未启用的应用会将整个集成从打包结果中彻底移除。
|
|
211
|
+
- **无需新增配置项**:复用现有的 `editor.backendURL`(上报端点 / 自托管)和 `editor.clientId`(项目密钥,同时也是启用开关)。
|
|
212
|
+
- **注重隐私**:会话匿名哈希化(SHA-256,不存储原始 ID)、不存储 IP、仅保留粗粒度的国家级地理位置,请求大约每 20 秒批量发送一次。
|
|
213
|
+
- **仪表盘**:新的 **Analytics** 页面(选择项目后显示在侧边栏中)展示活跃用户数、今日用户数、最近 7/30/90 天用户数、访客变化趋势图,以及按语言和地理位置的细分。
|
|
214
|
+
|
|
215
|
+
```tsx fileName="CTAButton.tsx" codeFormat="tsx"
|
|
216
|
+
import { useConversion } from "react-intlayer";
|
|
217
|
+
|
|
218
|
+
const CTAButton = () => {
|
|
219
|
+
const trackConversion = useConversion();
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<button
|
|
223
|
+
onClick={() =>
|
|
224
|
+
trackConversion({
|
|
225
|
+
experimentKey: "homepage-hero",
|
|
226
|
+
variant: "black_friday",
|
|
227
|
+
goal: "cta_click",
|
|
228
|
+
})
|
|
229
|
+
}
|
|
230
|
+
>
|
|
231
|
+
Get started
|
|
232
|
+
</button>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```bash packageManager="npm"
|
|
238
|
+
npm install @intlayer/analytics
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
目前已支持 React、Next.js 和 React Native(通过 `react-intlayer`);其他框架绑定(Vue、Svelte、Angular 等)正在规划中,将遵循与 `@intlayer/editor` 相同的推广模式。完整指南请参阅 [Analytics 文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/analytics.md)。
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
202
245
|
## Vite Plugin: 捆绑编译器和代理
|
|
203
246
|
|
|
204
247
|
`intlayer()` Vite 插件现在直接捆绑了**编译器**和**区域设置路由代理**,因此大多数项目只需在 `vite.config.ts` 中使用单个插件:
|
|
@@ -320,5 +363,6 @@ If you are upgrading from v8, note that the v9 does not include breaking changes
|
|
|
320
363
|
|
|
321
364
|
- [Compat Adapter Packages Guide](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/compat/index.md)
|
|
322
365
|
- [Dynamic Dictionaries - Collections & Variants](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dynamic_dictionaries/index.md)
|
|
366
|
+
- [Analytics - 内容曝光追踪与 A/B 测试](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/analytics.md)
|
|
323
367
|
- [Configuration Reference](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md)
|
|
324
368
|
- [CMS SDK - 通过 @intlayer/api 进行编程访问](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_CMS.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/docs",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer documentation",
|
|
6
6
|
"keywords": [
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"watch": "webpack --config ./webpack.config.ts --watch"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@intlayer/config": "9.0.0-canary.
|
|
77
|
-
"@intlayer/core": "9.0.0-canary.
|
|
78
|
-
"@intlayer/types": "9.0.0-canary.
|
|
76
|
+
"@intlayer/config": "9.0.0-canary.16",
|
|
77
|
+
"@intlayer/core": "9.0.0-canary.16",
|
|
78
|
+
"@intlayer/types": "9.0.0-canary.16"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@intlayer/api": "9.0.0-canary.
|
|
82
|
-
"@intlayer/cli": "9.0.0-canary.
|
|
81
|
+
"@intlayer/api": "9.0.0-canary.16",
|
|
82
|
+
"@intlayer/cli": "9.0.0-canary.16",
|
|
83
83
|
"@types/node": "25.9.4",
|
|
84
84
|
"@utils/ts-config": "1.0.4",
|
|
85
85
|
"@utils/ts-config-types": "1.0.4",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"rimraf": "6.1.3",
|
|
89
89
|
"tsdown": "0.21.10",
|
|
90
90
|
"typescript": "6.0.3",
|
|
91
|
-
"vitest": "4.1.
|
|
91
|
+
"vitest": "4.1.10"
|
|
92
92
|
},
|
|
93
93
|
"engines": {
|
|
94
94
|
"node": ">=14.18"
|
|
@@ -93,6 +93,26 @@ export const docsEntry = {
|
|
|
93
93
|
vi: readLocale('agent_skills.md', 'vi'),
|
|
94
94
|
uk: readLocale('agent_skills.md', 'uk'),
|
|
95
95
|
} as unknown as Record<LocalesValues, Promise<string>>,
|
|
96
|
+
'./docs/en/analytics.md': {
|
|
97
|
+
en: readLocale('analytics.md', 'en'),
|
|
98
|
+
ru: readLocale('analytics.md', 'ru'),
|
|
99
|
+
ja: readLocale('analytics.md', 'ja'),
|
|
100
|
+
fr: readLocale('analytics.md', 'fr'),
|
|
101
|
+
ko: readLocale('analytics.md', 'ko'),
|
|
102
|
+
zh: readLocale('analytics.md', 'zh'),
|
|
103
|
+
es: readLocale('analytics.md', 'es'),
|
|
104
|
+
de: readLocale('analytics.md', 'de'),
|
|
105
|
+
ar: readLocale('analytics.md', 'ar'),
|
|
106
|
+
it: readLocale('analytics.md', 'it'),
|
|
107
|
+
'en-GB': readLocale('analytics.md', 'en-GB'),
|
|
108
|
+
pt: readLocale('analytics.md', 'pt'),
|
|
109
|
+
hi: readLocale('analytics.md', 'hi'),
|
|
110
|
+
tr: readLocale('analytics.md', 'tr'),
|
|
111
|
+
pl: readLocale('analytics.md', 'pl'),
|
|
112
|
+
id: readLocale('analytics.md', 'id'),
|
|
113
|
+
vi: readLocale('analytics.md', 'vi'),
|
|
114
|
+
uk: readLocale('analytics.md', 'uk'),
|
|
115
|
+
} as unknown as Record<LocalesValues, Promise<string>>,
|
|
96
116
|
'./docs/en/autoFill.md': {
|
|
97
117
|
en: readLocale('autoFill.md', 'en'),
|
|
98
118
|
ru: readLocale('autoFill.md', 'ru'),
|
|
@@ -2393,6 +2413,26 @@ export const docsEntry = {
|
|
|
2393
2413
|
vi: readLocale('introduction.md', 'vi'),
|
|
2394
2414
|
uk: readLocale('introduction.md', 'uk'),
|
|
2395
2415
|
} as unknown as Record<LocalesValues, Promise<string>>,
|
|
2416
|
+
'./docs/en/live-sync.md': {
|
|
2417
|
+
en: readLocale('live-sync.md', 'en'),
|
|
2418
|
+
ru: readLocale('live-sync.md', 'ru'),
|
|
2419
|
+
ja: readLocale('live-sync.md', 'ja'),
|
|
2420
|
+
fr: readLocale('live-sync.md', 'fr'),
|
|
2421
|
+
ko: readLocale('live-sync.md', 'ko'),
|
|
2422
|
+
zh: readLocale('live-sync.md', 'zh'),
|
|
2423
|
+
es: readLocale('live-sync.md', 'es'),
|
|
2424
|
+
de: readLocale('live-sync.md', 'de'),
|
|
2425
|
+
ar: readLocale('live-sync.md', 'ar'),
|
|
2426
|
+
it: readLocale('live-sync.md', 'it'),
|
|
2427
|
+
'en-GB': readLocale('live-sync.md', 'en-GB'),
|
|
2428
|
+
pt: readLocale('live-sync.md', 'pt'),
|
|
2429
|
+
hi: readLocale('live-sync.md', 'hi'),
|
|
2430
|
+
tr: readLocale('live-sync.md', 'tr'),
|
|
2431
|
+
pl: readLocale('live-sync.md', 'pl'),
|
|
2432
|
+
id: readLocale('live-sync.md', 'id'),
|
|
2433
|
+
vi: readLocale('live-sync.md', 'vi'),
|
|
2434
|
+
uk: readLocale('live-sync.md', 'uk'),
|
|
2435
|
+
} as unknown as Record<LocalesValues, Promise<string>>,
|
|
2396
2436
|
'./docs/en/locale_mapper.md': {
|
|
2397
2437
|
en: readLocale('locale_mapper.md', 'en'),
|
|
2398
2438
|
ru: readLocale('locale_mapper.md', 'ru'),
|