@intlayer/docs 7.0.0-canary.1 → 7.0.0-canary.3

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.
Files changed (43) hide show
  1. package/dist/cjs/common.cjs.map +1 -1
  2. package/dist/esm/common.mjs.map +1 -1
  3. package/dist/types/common.d.ts +5 -0
  4. package/dist/types/common.d.ts.map +1 -1
  5. package/docs/ar/intlayer_with_nextjs_16.md +1652 -0
  6. package/docs/ar/releases/v7.md +486 -0
  7. package/docs/de/intlayer_with_nextjs_16.md +1662 -0
  8. package/docs/de/releases/v7.md +503 -0
  9. package/docs/en/intlayer_with_nextjs_15.md +5 -2
  10. package/docs/en/intlayer_with_nextjs_16.md +4 -4
  11. package/docs/en-GB/intlayer_with_nextjs_16.md +1642 -0
  12. package/docs/en-GB/releases/v7.md +486 -0
  13. package/docs/es/intlayer_with_nextjs_16.md +1670 -0
  14. package/docs/es/releases/v7.md +503 -0
  15. package/docs/fr/intlayer_with_nextjs_16.md +1692 -0
  16. package/docs/fr/releases/v7.md +504 -0
  17. package/docs/hi/intlayer_with_nextjs_16.md +1618 -0
  18. package/docs/hi/releases/v7.md +486 -0
  19. package/docs/id/intlayer_with_nextjs_16.md +1604 -0
  20. package/docs/id/releases/v7.md +503 -0
  21. package/docs/it/intlayer_with_nextjs_16.md +1600 -0
  22. package/docs/it/releases/v7.md +505 -0
  23. package/docs/ja/intlayer_CMS.md +0 -9
  24. package/docs/ja/intlayer_with_nextjs_16.md +1788 -0
  25. package/docs/ja/releases/v7.md +504 -0
  26. package/docs/ko/intlayer_with_nextjs_16.md +1641 -0
  27. package/docs/ko/releases/v7.md +504 -0
  28. package/docs/pl/intlayer_with_nextjs_16.md +1645 -0
  29. package/docs/pl/releases/v7.md +486 -0
  30. package/docs/pt/intlayer_with_nextjs_16.md +1646 -0
  31. package/docs/pt/introduction.md +0 -15
  32. package/docs/pt/releases/v7.md +486 -0
  33. package/docs/ru/intlayer_with_nextjs_16.md +1610 -0
  34. package/docs/ru/releases/v7.md +486 -0
  35. package/docs/tr/intlayer_with_nextjs_16.md +1599 -0
  36. package/docs/tr/releases/v7.md +486 -0
  37. package/docs/vi/intlayer_with_nextjs_16.md +1597 -0
  38. package/docs/vi/releases/v7.md +486 -0
  39. package/docs/zh/intlayer_CMS.md +0 -23
  40. package/docs/zh/intlayer_with_nextjs_16.md +1628 -0
  41. package/docs/zh/releases/v7.md +487 -0
  42. package/package.json +14 -14
  43. package/src/common.ts +5 -0
@@ -0,0 +1,504 @@
1
+ ---
2
+ createdAt: 2025-09-22
3
+ updatedAt: 2025-09-23
4
+ title: 新しい Intlayer v7 - 新機能は何ですか?
5
+ description: Intlayer v7 の新機能を発見してください。パフォーマンス、開発者体験の大幅な改善と国際化ワークフローを強化する新機能。
6
+ keywords:
7
+ - Intlayer
8
+ - ローカリゼーション
9
+ - 開発
10
+ - パフォーマンス
11
+ - 開発者体験
12
+ - 機能
13
+ - React
14
+ - Next.js
15
+ - JavaScript
16
+ - TypeScript
17
+ slugs:
18
+ - doc
19
+ - releases
20
+ - v7
21
+ ---
22
+
23
+ # 新しい Intlayer v7 - 新機能は何ですか?
24
+
25
+ Intlayer v7 へようこそ!このメジャーリリースでは、パフォーマンス、型安全性、開発者体験において大幅な改善を導入しました。以下にハイライト、移行ノート、実用的な例を示します。
26
+
27
+ ## ハイライト
28
+
29
+ - より高速なビルドのためのキャッシュ戦略
30
+ - ロケール固有の型を用いたTypeScript型生成の改善
31
+ - バンドル最適化:enumではなく文字列としてのロケール
32
+ - 新しいルーティングモード:`prefix-no-default`、`prefix-all`、`no-prefix`、`search-params`
33
+ - GDPR準拠のロケール保存、デフォルトはlocalStorage
34
+ - 柔軟なストレージ設定:クッキー、localStorage、sessionStorage、または複数の組み合わせ
35
+ - Visual Editorパッケージサイズが30%縮小
36
+ - ミドルウェア設定オプションの強化
37
+ - コンテンツ管理向上のためのfillコマンドの動作更新
38
+ - コンテンツ宣言ファイルの完全更新による安定性向上
39
+ - 翻訳精度のためのインテリジェントなリトライ管理
40
+ - より高速な翻訳処理のための並列化
41
+ - AIコンテキスト制限内で大きなファイルを扱うスマートチャンク処理
42
+
43
+ ---
44
+
45
+ ## パフォーマンス:より高速なビルドのためのキャッシュ
46
+
47
+ esbuildで毎回コンテンツ宣言を再構築する代わりに、v7ではビルドプロセスを高速化するキャッシュ戦略を実装しています。
48
+
49
+ ```bash
50
+ npx intlayer build
51
+ ```
52
+
53
+ 新しいキャッシュシステムは以下を実現します:
54
+
55
+ - コンパイル済みのコンテンツ宣言を保存し、冗長な処理を回避
56
+ - 変更を検出し、変更されたファイルのみを再構築
57
+ - 大規模プロジェクトのビルド時間を大幅に短縮
58
+
59
+ ---
60
+
61
+ ## TypeScript:ロケール別の型生成
62
+
63
+ TypeScriptの型はロケールごとに生成されるようになり、より強力な型付けが可能となり、全ロケールにまたがるユニオン型を排除します。
64
+
65
+ **v6の挙動:**
66
+
67
+ ```tsx
68
+ const content = getIntlayer("my-title-content", "en");
69
+ // typeof content = { title: "My title" } | { title: "Mon titre" } | { title: "Mi título" }
70
+ ```
71
+
72
+ **v7の挙動:**
73
+
74
+ ```tsx
75
+ const content = getIntlayer("my-title-content", "en");
76
+ // typeof content = { title: "My title" }
77
+ ```
78
+
79
+ 利点:
80
+
81
+ - IDEでのより正確なオートコンプリート
82
+ - ロケール間の型汚染がなく、より良い型安全性
83
+ - 型の複雑さを減らすことでパフォーマンスが向上
84
+
85
+ ---
86
+
87
+ ## バンドル最適化: 文字列としてのロケール
88
+
89
+ `Locales`型はもはや列挙型(enum)ではなくなり、完全にツリーシェイク可能となったため、使用されていない何千ものロケールレコードでバンドルが膨らむことがありません。
90
+
91
+ **v6:**
92
+
93
+ ```typescript
94
+ import { Locales } from "intlayer";
95
+ // すべてのロケールを含む列挙型 -> ツリーシェイク不可
96
+
97
+ const locale: Locales = Locales.ENGLISH;
98
+ ```
99
+
100
+ **v7:**
101
+
102
+ ```typescript
103
+ import { Locales, Locale } from "intlayer";
104
+ // 文字列型 -> 完全にツリーシェイク可能
105
+
106
+ const locale: Locale = Locales.ENGLISH;
107
+ ```
108
+
109
+ > `Locales`はもはやenumではないため、型としてロケールを取得するには、型を`Locales`から`Locale`に変更する必要があります。
110
+
111
+ 詳細については、[実装の詳細](https://github.com/aymericzip/intlayer/blob/main/packages/%40intlayer/types/src/index.ts)をご覧ください。
112
+
113
+ ---
114
+
115
+ ## より柔軟な新しいルーティングモード
116
+
117
+ v7では、以前の`prefixDefault`および`noPrefix`オプションに代わる統一された`routing.mode`設定が導入され、URL構造に対するより細かな制御が可能になりました。
118
+
119
+ ### 利用可能なルーティングモード
120
+
121
+ - **`prefix-no-default`**(デフォルト):デフォルトロケールにはプレフィックスがなく、その他のロケールにはプレフィックスが付く
122
+ - `/dashboard`(en)または`/fr/dashboard`(fr)
123
+ - **`prefix-all`**:すべてのロケールにプレフィックスが付く
124
+ - `/en/dashboard`(en)または`/fr/dashboard`(fr)
125
+ - **`no-prefix`**: URLにロケールのプレフィックスがない(ロケールはストレージやヘッダーで管理)
126
+ - すべてのロケールで `/dashboard`
127
+ - **`search-params`**: クエリパラメータとしてロケールを渡す
128
+ - `/dashboard?locale=en` または `/dashboard?locale=fr`
129
+
130
+ ### 基本設定
131
+
132
+ ```typescript
133
+ // intlayer.config.ts
134
+ export default {
135
+ internationalization: {
136
+ locales: ["en", "fr", "es"],
137
+ defaultLocale: "en",
138
+ },
139
+ routing: {
140
+ mode: "prefix-no-default", // デフォルト
141
+ },
142
+ };
143
+ ```
144
+
145
+ ---
146
+
147
+ ## GDPR準拠:localStorage / クッキーのストレージ
148
+
149
+ v7では、ユーザーのプライバシーを優先し、クッキーの代わりに `localStorage` をデフォルトのストレージ機構として使用します。この変更により、ロケール設定に関するクッキー同意の必要がなくなり、GDPR準拠が容易になります。
150
+
151
+ ### ストレージ設定オプション
152
+
153
+ 新しい `routing.storage` フィールドは、以前の `middleware.cookieName` および `middleware.serverSetCookie` オプションに加えて利用可能であり、柔軟なストレージ構成を提供します。
154
+
155
+ ```typescript
156
+ // ストレージを無効化
157
+ storage: false
158
+
159
+ // シンプルなストレージタイプ
160
+ storage: 'cookie'
161
+ storage: 'localStorage'
162
+ storage: 'sessionStorage'
163
+
164
+ // カスタム属性付きのクッキー
165
+ storage: {
166
+ type: 'cookie',
167
+ name: 'custom-locale',
168
+ domain: '.example.com',
169
+ secure: true,
170
+ sameSite: 'strict'
171
+ }
172
+
173
+ // カスタムキー付きの localStorage
174
+ storage: {
175
+ type: 'localStorage',
176
+ name: 'custom-locale'
177
+ }
178
+
179
+ // 冗長性のための複数ストレージタイプ
180
+ storage: ['cookie', 'localStorage']
181
+ ```
182
+
183
+ ### GDPR準拠の設定例
184
+
185
+ 機能性とGDPR準拠のバランスを取る必要がある本番アプリケーション向け:
186
+
187
+ ```typescript
188
+ typescript;
189
+ // intlayer.config.ts
190
+ export default {
191
+ internationalization: {
192
+ locales: ["en", "fr", "es"],
193
+ defaultLocale: "en",
194
+ },
195
+ routing: {
196
+ mode: "prefix-no-default",
197
+ storage: [
198
+ {
199
+ type: "localStorage", // 主なストレージ(同意不要)
200
+ name: "user-locale",
201
+ },
202
+ {
203
+ type: "cookie", // オプションのクッキーストレージ(同意が必要)
204
+ name: "user-locale",
205
+ secure: true,
206
+ sameSite: "strict",
207
+ httpOnly: false,
208
+ },
209
+ ],
210
+ },
211
+ };
212
+ ```
213
+
214
+ ### クッキーストレージの有効化 / 無効化
215
+
216
+ React / Next.js を使用した例:
217
+
218
+ グローバルに定義可能:
219
+
220
+ ```typescript
221
+ <IntlayerProvider isCookieEnabled={false}>
222
+ <App />
223
+ </IntlayerProvider>
224
+ ```
225
+
226
+ 各フックでローカルに上書き可能:
227
+
228
+ ```ts
229
+ const { setLocale } = useLocale({ isCookieEnabled: false });
230
+
231
+ setLocale("en");
232
+ ```
233
+
234
+ **注意:** クッキーはデフォルトで有効になっています。
235
+ **注意:** ご利用のケースに応じて、[GDPRのクッキー要件](https://gdpr.eu/cookies/)を確認してください。
236
+
237
+ ---
238
+
239
+ ## ビジュアルエディター: 30% 小さくなったパッケージ
240
+
241
+ ビジュアルエディターパッケージは、以下の理由により前バージョンより30%小さく最適化されました:
242
+
243
+ - コードエディターのパフォーマンス向上
244
+ - Intlayerコアパッケージの不要な依存関係の削除
245
+ - より良いツリーシェイキングとモジュールバンドリング
246
+
247
+ これにより、ダウンロード時間の短縮とアプリケーションの実行時パフォーマンスの向上が実現します。
248
+
249
+ ---
250
+
251
+ ## fillコマンド: より良いコンテンツ管理のための動作更新
252
+
253
+ v7では、`fill`コマンドの動作が改善され、より予測可能で柔軟なコンテンツ管理が可能になりました:
254
+
255
+ ### 新しい fill の動作
256
+
257
+ - **`fill: true`** - すべてのロケールに対して内容を埋めた状態で現在のファイルを書き換えます
258
+ - **`fill: "path/to/file"`** - 現在のファイルを変更せずに指定したファイルを埋めます
259
+ - **`fill: false`** - 自動埋めを完全に無効にします
260
+
261
+ ### 複雑なコンテンツ構造への対応強化
262
+
263
+ fill コマンドは、以下を含む複雑なコンテンツ宣言構造をサポートするようになりました:
264
+
265
+ - **合成オブジェクト**:他のオブジェクトを参照するコンテンツ宣言
266
+ - **分割代入されたコンテンツ**:分割代入パターンを使用したコンテンツ
267
+ - **ネストされた参照**:複雑な階層で互いに呼び合うオブジェクト
268
+ - **動的コンテンツ構造**:条件付きまたは計算されたプロパティを持つコンテンツ
269
+
270
+ ### 利点
271
+
272
+ - **意図の明確化**:何が変更されるかがより明確になりました
273
+ - **より良い分離**: コンテンツファイルを翻訳済みファイルから分けて管理できます
274
+ - **改善されたワークフロー**: 開発者は翻訳の保存場所をより細かく制御できます
275
+ - **複雑な構造のサポート**: 複数の相互接続されたオブジェクトを持つ高度なコンテンツ構造を扱えます
276
+
277
+ ### 使用例
278
+
279
+ ```typescript
280
+ // すべてのロケールで現在のファイルを書き換え
281
+ const content = {
282
+ key: "example",
283
+ fill: true, // このファイルを書き換え
284
+ content: {
285
+ title: "Hello World",
286
+ },
287
+ };
288
+
289
+ // 現在のファイルを変更せずに別ファイルを埋める
290
+ const content = {
291
+ key: "example",
292
+ fill: "./translations.json", // translations.jsonを作成/更新
293
+ content: {
294
+ title: "Hello World",
295
+ },
296
+ };
297
+
298
+ // 自動埋めを無効化
299
+ const content = {
300
+ key: "example",
301
+ fill: false, // 自動埋めなし
302
+ content: {
303
+ title: "Hello World",
304
+ },
305
+ };
306
+
307
+ // 複合オブジェクトを用いた複雑なコンテンツ構造
308
+ const sharedContent = {
309
+ buttons: {
310
+ save: "保存", // 保存ボタン
311
+ cancel: "キャンセル", // キャンセルボタン
312
+ },
313
+ };
314
+
315
+ const content = {
316
+ key: "complex-example",
317
+ fill: true,
318
+ content: {
319
+ // 他のオブジェクトへの参照
320
+ sharedContent,
321
+
322
+ // 分割代入されたコンテンツ
323
+ ...sharedContent,
324
+
325
+ // ネストされた参照
326
+ sections: [
327
+ {
328
+ ...sharedContent.buttons,
329
+ header: "セクション 1",
330
+ },
331
+ ],
332
+ },
333
+ };
334
+ ```
335
+
336
+ ---
337
+
338
+ ## 安定性と翻訳管理の強化
339
+
340
+ v7では、コンテンツ翻訳をより信頼性が高く効率的にするためのいくつかの改善が導入されました。
341
+
342
+ ### コンテンツ宣言ファイルの完全更新
343
+
344
+ システムは部分的な更新ではなく、`.content.{ts,js,cjs,mjs}` ファイル全体を更新するようになり、以下を保証します:
345
+
346
+ - **データの完全性**: ファイル全体の書き換えにより、部分的な更新によってコンテンツが破損するのを防ぎます
347
+ - **一貫性**: すべてのロケールが原子単位で更新され、同期が維持されます
348
+ - **信頼性**: 不完全または不正なコンテンツファイルのリスクを低減します
349
+
350
+ ### インテリジェントなリトライ管理
351
+
352
+ 新しいリトライ機構により、不正な形式のコンテンツのプッシュを防ぎ、1つのリクエストが失敗しても全体のfillプロセスが壊れるのを回避します。
353
+
354
+ ### 高速処理のための並列化
355
+
356
+ 翻訳操作はキューで実行され、並列処理されるため、処理速度が大幅に向上します。
357
+
358
+ ### 大規模ファイルのためのスマートチャンク分割
359
+
360
+ 高度なチャンク分割戦略により、AIのコンテキストウィンドウを超えないように大規模なコンテンツファイルを処理します:
361
+
362
+ ### ワークフローの例
363
+
364
+ ```typescript
365
+ // 大規模なコンテンツファイルが自動的にチャンク分割される
366
+ const content = {
367
+ key: "large-documentation",
368
+ fill: true,
369
+ content: {
370
+ // AI処理のために自動的にチャンク分割された大容量コンテンツ
371
+ introduction: "..." // 5000文字以上
372
+ sections: [
373
+ // 複数の大きなセクション
374
+ ]
375
+ }
376
+ };
377
+ ```
378
+
379
+ システムは自動的に以下を行います:
380
+
381
+ 1. コンテンツのサイズと構造を解析
382
+ 2. 適切にコンテンツをチャンク分割
383
+ 3. チャンクを並列処理
384
+ 4. 必要に応じて検証とリトライ
385
+ 5. 完全なファイルを再構築
386
+
387
+ ---
388
+
389
+ ## v6からの移行ノート
390
+
391
+ ### 削除された設定
392
+
393
+ - **`middleware.cookieName`**:`routing.storage`に置き換え
394
+ - **`middleware.serverSetCookie`**:`routing.storage`に置き換え
395
+ - **`middleware.prefixDefault`**:`routing.mode`に置き換え
396
+ - **`middleware.noPrefix`**:`routing.mode`に置き換え
397
+
398
+ ### 移行マッピング
399
+
400
+ #### 設定マッピング
401
+
402
+ | v6 設定 | v7 設定 |
403
+ | -------------------------- | ------------------------------------------------------ |
404
+ | `autoFill: xxx` | `fill: xxx` |
405
+ | `prefixDefault: false` | `mode: 'prefix-no-default'` |
406
+ | `prefixDefault: true` | `mode: 'prefix-all'` |
407
+ | `noPrefix: true` | `mode: 'no-prefix'` |
408
+ | `cookieName: 'my-locale'` | `storage: { type: 'cookie', name: 'my-locale' }` |
409
+ | `serverSetCookie: 'never'` | `storage: false` または storage 配列から cookie を削除 |
410
+
411
+ #### マイグレーション例
412
+
413
+ **以前 (v6):**
414
+
415
+ ````typescript
416
+ export default {
417
+ #### 設定マッピング
418
+
419
+ | v6 設定 | v7 設定 |
420
+ | -------------------------- | ---------------------------------------------------- |
421
+ | `autoFill: xxx` | `fill: xxx` |
422
+ | `prefixDefault: false` | `mode: 'prefix-no-default'` |
423
+ | `prefixDefault: true` | `mode: 'prefix-all'` |
424
+ | `noPrefix: true` | `mode: 'no-prefix'` |
425
+ | `cookieName: 'my-locale'` | `storage: { type: 'cookie', name: 'my-locale' }` |
426
+ | `serverSetCookie: 'never'` | `storage: false` または storage 配列から cookie を削除 |
427
+
428
+ #### マイグレーション例
429
+
430
+ **以前 (v6):**
431
+
432
+ ```typescript
433
+ export default {
434
+ middleware: {
435
+ headerName: "x-intlayer-locale",
436
+ cookieName: "intlayer-locale",
437
+ prefixDefault: false,
438
+ basePath: "",
439
+ serverSetCookie: "always",
440
+ noPrefix: false,
441
+ },
442
+ };
443
+ ````
444
+
445
+ **以降 (v7):**
446
+
447
+ ```typescript
448
+ export default {
449
+ routing: {
450
+ mode: "prefix-no-default",
451
+ storage: "localStorage", // cookie ストレージが必要な場合は 'cookie'
452
+ headerName: "x-intlayer-locale",
453
+ basePath: "",
454
+ detectLocaleOnPrefetchNoPrefix: false,
455
+ },
456
+ };
457
+ ```
458
+
459
+ #### 辞書コンテンツのマッピング
460
+
461
+ | v6 辞書コンテンツ | v7 辞書コンテンツ |
462
+ | ----------------- | ----------------- |
463
+ | `autoFill: xxx` | `fill: xxx` |
464
+
465
+ #### マイグレーション例
466
+
467
+ **以前 (v6):**
468
+
469
+ ```typescript
470
+ const content = {
471
+ key: "example",
472
+ autoFill: true, // このファイルを書き換えます
473
+ content: {
474
+ title: "Hello World",
475
+ },
476
+ };
477
+ ```
478
+
479
+ **After (v7):**
480
+
481
+ ```typescript
482
+ const content = {
483
+ key: "example",
484
+ fill: true, // このファイルを書き換えます
485
+ content: {
486
+ title: "Hello World",
487
+ },
488
+ };
489
+ ```
490
+
491
+ ---
492
+
493
+ ## v5 から v6 へのマイグレーションノート
494
+
495
+ 詳細については、[v5 から v6 へのマイグレーションノート](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/releases/v6.md)を参照してください。
496
+
497
+ ---
498
+
499
+ ## 便利なリンク
500
+
501
+ - [設定リファレンス](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/configuration.md)
502
+ - [ミドルウェアドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/packages/next-intlayer/index.md)
503
+ - [TypeScript タイプ](https://github.com/aymericzip/intlayer/blob/main/packages/%40intlayer/types/src/index.ts)
504
+ - [GDPR クッキーガイドライン](https://gdpr.eu/cookies/)