@intlayer/docs 8.4.5 → 8.4.6

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 (48) hide show
  1. package/dist/cjs/generated/docs.entry.cjs +20 -0
  2. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  3. package/dist/esm/generated/docs.entry.mjs +20 -0
  4. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  5. package/dist/types/generated/docs.entry.d.ts +1 -0
  6. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  7. package/docs/ar/configuration.md +520 -722
  8. package/docs/ar/intlayer_with_storybook.md +521 -0
  9. package/docs/bn/configuration.md +922 -0
  10. package/docs/bn/intlayer_with_hono.md +428 -0
  11. package/docs/de/configuration.md +369 -743
  12. package/docs/de/intlayer_with_storybook.md +521 -0
  13. package/docs/en/configuration.md +181 -507
  14. package/docs/en/intlayer_with_storybook.md +521 -0
  15. package/docs/en-GB/configuration.md +456 -657
  16. package/docs/en-GB/intlayer_with_storybook.md +521 -0
  17. package/docs/es/configuration.md +379 -754
  18. package/docs/es/intlayer_with_storybook.md +521 -0
  19. package/docs/fr/configuration.md +376 -757
  20. package/docs/fr/intlayer_with_storybook.md +521 -0
  21. package/docs/hi/configuration.md +532 -728
  22. package/docs/hi/intlayer_with_storybook.md +521 -0
  23. package/docs/id/configuration.md +371 -684
  24. package/docs/id/intlayer_with_storybook.md +521 -0
  25. package/docs/it/configuration.md +397 -775
  26. package/docs/it/intlayer_with_storybook.md +521 -0
  27. package/docs/ja/configuration.md +525 -724
  28. package/docs/ja/intlayer_with_storybook.md +521 -0
  29. package/docs/ko/configuration.md +525 -724
  30. package/docs/ko/intlayer_with_storybook.md +521 -0
  31. package/docs/pl/configuration.md +430 -734
  32. package/docs/pl/intlayer_with_storybook.md +521 -0
  33. package/docs/pt/configuration.md +375 -746
  34. package/docs/pt/intlayer_with_storybook.md +521 -0
  35. package/docs/ru/configuration.md +532 -701
  36. package/docs/ru/intlayer_with_storybook.md +521 -0
  37. package/docs/tr/configuration.md +527 -719
  38. package/docs/tr/intlayer_with_storybook.md +521 -0
  39. package/docs/uk/configuration.md +425 -744
  40. package/docs/uk/intlayer_with_storybook.md +521 -0
  41. package/docs/ur/configuration.md +922 -0
  42. package/docs/ur/intlayer_with_hono.md +428 -0
  43. package/docs/vi/configuration.md +412 -753
  44. package/docs/vi/intlayer_with_storybook.md +521 -0
  45. package/docs/zh/configuration.md +521 -714
  46. package/docs/zh/intlayer_with_storybook.md +521 -0
  47. package/package.json +6 -6
  48. package/src/generated/docs.entry.ts +20 -0
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  createdAt: 2024-08-13
3
- updatedAt: 2026-03-12
4
- title: 設定
5
- description: Intlayerをアプリケーション向けに設定する方法を学びます。Intlayerをニーズに合わせてカスタマイズするためのさまざまな設定やオプションについて理解しましょう。
3
+ updatedAt: 2026-03-20
4
+ title: 設定 (Configuration)
5
+ description: アプリケーションにIntlayerを設定する方法を学びます。ニーズに合わせてIntlayerをカスタマイズするためのさまざまな設定とオプションを理解してください。
6
6
  keywords:
7
7
  - 設定
8
8
  - セッティング
@@ -14,61 +14,88 @@ slugs:
14
14
  - concept
15
15
  - configuration
16
16
  history:
17
+ - version: 8.4.0
18
+ date: 2026-03-20
19
+ changes: 'compiler.output' と 'dictionary.fill' に対するロケールごとのオブジェクト表記を追加
17
20
  - version: 8.3.0
18
21
  date: 2026-03-11
19
- changes: "'baseDir' を 'content' 設定から 'system' 設定に移動"
22
+ changes: 'baseDir' を 'content' 設定から 'system' 設定に移動
20
23
  - version: 8.2.0
21
- date: 2026-03-10
22
- changes: コンパイラーオプションの更新、'output' および 'noMetadata' のサポートを追加
24
+ date: 2026-03-09
25
+ changes: コンパイラオプションを更新し、'output' 'noMetadata' のサポートを追加
23
26
  - version: 8.1.7
24
27
  date: 2026-02-25
25
- changes: コンパイラーオプションの更新
28
+ changes: コンパイラオプションを更新
29
+ - version: 8.1.5
30
+ date: 2026-02-23
31
+ changes: コンパイラオプション 'build-only' とディクショナリプレフィックスを追加
26
32
  - version: 8.0.6
27
33
  date: 2026-02-12
28
34
  changes: Open Router, Alibaba, Amazon, Google Vertex Bedrock, Fireworks, Groq, Hugging Face, Together.ai プロバイダーのサポートを追加
29
35
  - version: 8.0.5
30
36
  date: 2026-02-06
31
- changes: AI設定に `dataSerialization` を追加
37
+ changes: AI 設定に `dataSerialization` を追加
38
+ - version: 8.0.0
39
+ date: 2026-01-24
40
+ changes: 基本的なメカニズムをより適切に説明するために、インポートモード `live` を `fetch` に変更。
41
+ - version: 8.0.0
42
+ date: 2026-01-22
43
+ changes: ビルド設定 `importMode` を `dictionary` 設定に移動。
32
44
  - version: 8.0.0
33
45
  date: 2026-01-22
34
- changes: importMode のビルド設定を辞書設定に移動。
46
+ changes: ルーティング設定に `rewrite` オプションを追加
35
47
  - version: 8.0.0
36
48
  date: 2026-01-18
37
49
  changes: システム設定をコンテンツ設定から分離。内部パスを `system` プロパティに移動。コンテンツファイルとコード変換を分離するために `codeDir` を追加。
38
50
  - version: 8.0.0
39
51
  date: 2026-01-18
40
- changes: 辞書オプション `location` と `schema` を追加
52
+ changes: ディクショナリオプション `location` と `schema` を追加
41
53
  - version: 7.5.1
42
54
  date: 2026-01-10
43
55
  changes: JSON5 および JSONC ファイル形式のサポートを追加
44
56
  - version: 7.5.0
45
57
  date: 2025-12-17
46
- changes: "`buildMode` オプションを追加"
58
+ changes: `buildMode` オプションを追加
59
+ - version: 7.0.0
60
+ date: 2025-10-25
61
+ changes: `dictionary` 設定を追加
62
+ - version: 7.0.0
63
+ date: 2025-10-21
64
+ changes: `middleware` をルーティング設定 `routing` に置き換え
65
+ - version: 7.0.0
66
+ date: 2025-10-12
67
+ changes: `formatCommand` オプションを追加
68
+ - version: 6.2.0
69
+ date: 2025-10-12
70
+ changes: `excludedPath` オプションを更新
71
+ - version: 6.0.2
72
+ date: 2025-09-23
73
+ changes: `outputFormat` オプションを追加
47
74
  - version: 6.0.0
48
- date: 2025-09-16
49
- changes: "`live` インポートモードを追加"
75
+ date: 2025-09-21
76
+ changes: `dictionaryOutput` フィールドと `i18nextResourcesDir` フィールドを削除
50
77
  - version: 6.0.0
51
78
  date: 2025-09-16
52
- changes: "`live` インポートモードを追加"
79
+ changes: `live` インポートモードを追加
53
80
  - version: 6.0.0
54
81
  date: 2025-09-04
55
- changes: "`hotReload` フィールドを `liveSync` に置き換え、`liveSyncPort` `liveSyncURL` フィールドを追加"
82
+ changes: `hotReload` フィールドを `liveSync` に置き換え、`liveSyncPort` および `liveSyncURL` フィールドを追加
56
83
  - version: 5.6.1
57
84
  date: 2025-07-25
58
- changes: "`activateDynamicImport` を `importMode` オプションに置き換え"
85
+ changes: `activateDynamicImport` を `importMode` オプションに置き換え
59
86
  - version: 5.6.0
60
87
  date: 2025-07-13
61
88
  changes: デフォルトの contentDir を `['src']` から `['.']` に変更
62
89
  - version: 5.5.11
63
90
  date: 2025-06-29
64
- changes: "`docs` コマンドを追加"
91
+ changes: `docs` コマンドを追加
65
92
  ---
66
93
 
67
94
  # Intlayer 設定ドキュメント
68
95
 
69
96
  ## 概要
70
97
 
71
- Intlayerの設定ファイルは、国際化、ミドルウェア、コンテンツ処理など、プラグインのさまざまな側面をカスタマイズすることを可能にします。本ドキュメントでは、設定内の各プロパティについて詳細に説明します。
98
+ Intlayer 設定ファイルを使用すると、国際化 (internationalization)、ミドルウェア、コンテンツ処理など、プラグインのさまざまな側面をカスタマイズできます。このドキュメントでは、設定内の各プロパティについて詳しく説明します。
72
99
 
73
100
  ---
74
101
 
@@ -78,9 +105,9 @@ Intlayerの設定ファイルは、国際化、ミドルウェア、コンテン
78
105
 
79
106
  ---
80
107
 
81
- ## 設定ファイルの対応形式
108
+ ## サポートされている設定ファイル形式
82
109
 
83
- IntlayerJSON、JS、MJS、TSの設定ファイル形式をサポートしています:
110
+ Intlayer は、JSON、JS、MJS、TS などの設定ファイル形式を受け入れます。
84
111
 
85
112
  - `intlayer.config.ts`
86
113
  - `intlayer.config.js`
@@ -101,108 +128,108 @@ import { nextjsRewrite } from "intlayer/routing";
101
128
  import { z } from "zod";
102
129
 
103
130
  /**
104
- * Example Intlayer configuration file showing all available options.
131
+ * すべての利用可能なオプションを表示する Intlayer 設定ファイルの例。
105
132
  */
106
133
  const config: IntlayerConfig = {
107
134
  /**
108
- * Configuration for internationalization settings.
135
+ * 国際化設定の構成。
109
136
  */
110
137
  internationalization: {
111
138
  /**
112
- * List of supported locales in the application.
113
- * Default: [Locales.ENGLISH]
139
+ * アプリケーションでサポートされるロケール (locales) のリスト。
140
+ * デフォルト: [Locales.ENGLISH]
114
141
  */
115
142
  locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
116
143
 
117
144
  /**
118
- * List of required locales that must be defined in every dictionary.
119
- * If empty, all locales are required in `strict` mode.
120
- * Default: []
145
+ * 各辞書で定義する必要がある必須ロケールのリスト。
146
+ * 空の場合、`strict` モードではすべてのロケールが必須になります。
147
+ * デフォルト: []
121
148
  */
122
149
  requiredLocales: [Locales.ENGLISH],
123
150
 
124
151
  /**
125
- * Strictness level for internationalized content.
126
- * - "strict": Errors if any declared locale is missing or undeclared.
127
- * - "inclusive": Warnings if a declared locale is missing.
128
- * - "loose": Accepts any existing locale.
129
- * Default: "inclusive"
152
+ * 国際化されたコンテンツの厳格さのレベル。
153
+ * - "strict": 宣言されたロケールが欠落しているか、未宣言の場合はエラー。
154
+ * - "inclusive": 宣言されたロケールが欠落している場合は警告。
155
+ * - "loose": 既存のロケールを受け入れる。
156
+ * デフォルト: "inclusive"
130
157
  */
131
158
  strictMode: "inclusive",
132
159
 
133
160
  /**
134
- * Default locale used as a fallback if the requested locale is not found.
135
- * Default: Locales.ENGLISH
161
+ * リクエストされたロケールが見つからない場合にフォールバックとして使用されるデフォルトロケール。
162
+ * デフォルト: Locales.ENGLISH
136
163
  */
137
164
  defaultLocale: Locales.ENGLISH,
138
165
  },
139
166
 
140
167
  /**
141
- * Settings that control dictionary operations and fallback behavior.
168
+ * 辞書操作とフォールバック動作を制御する設定。
142
169
  */
143
170
  dictionary: {
144
171
  /**
145
- * Controls how dictionaries are imported.
146
- * - "static": Statically imported at build time.
147
- * - "dynamic": Dynamically imported using Suspense.
148
- * - "fetch": Fetched dynamically via the live sync API.
149
- * Default: "static"
172
+ * 辞書のインポート方法を制御します。
173
+ * - "static": ビルド時に静的にインポート。
174
+ * - "dynamic": Suspense を使用して動的にインポート。
175
+ * - "fetch": Live Sync API を介して動的に取得。
176
+ * デフォルト: "static"
150
177
  */
151
178
  importMode: "static",
152
179
 
153
180
  /**
154
- * Strategy for auto-filling missing translations using AI.
155
- * Can be a boolean or a path pattern to store filled content.
156
- * Default: true
181
+ * AI を使用して欠落している翻訳を自動的に埋める戦略。
182
+ * ブール値または埋められたコンテンツを保存するためのパスパターンを指定できます。
183
+ * デフォルト: true
157
184
  */
158
185
  fill: true,
159
186
 
160
187
  /**
161
- * Physical location of the dictionary files.
162
- * - "local": Stored in the local filesystem.
163
- * - "remote": Stored in the Intlayer CMS.
164
- * - "hybrid": Stored in the local filesystem and the Intlayer CMS.
165
- * - "plugin" (or any custom string): Provided by a plugin or a custom source.
166
- * Default: "local"
188
+ * 辞書ファイルの物理的な場所。
189
+ * - "local": ローカルファイルシステムに保存。
190
+ * - "remote": Intlayer CMS に保存。
191
+ * - "hybrid": ローカルと Intlayer CMS の両方に保存。
192
+ * - "plugin" (または任意のカスタム文字列): プラグインまたはカスタムソースによって提供。
193
+ * デフォルト: "local"
167
194
  */
168
195
  location: "local",
169
196
 
170
197
  /**
171
- * Whether to automatically transform content (e.g., Markdown to HTML).
172
- * Default: false
198
+ * コンテンツを自動的に変換するかどうか (例: Markdown から HTML)
199
+ * デフォルト: false
173
200
  */
174
201
  contentAutoTransformation: false,
175
202
  },
176
203
 
177
204
  /**
178
- * Routing and middleware configuration.
205
+ * ルーティングとミドルウェアの設定。
179
206
  */
180
207
  routing: {
181
208
  /**
182
- * Locale routing strategy.
183
- * - "prefix-no-default": Prefix all except the default locale (e.g., /dashboard, /fr/dashboard).
184
- * - "prefix-all": Prefix all locales (e.g., /en/dashboard, /fr/dashboard).
185
- * - "no-prefix": No locale in the URL.
186
- * - "search-params": Use ?locale=...
187
- * Default: "prefix-no-default"
209
+ * ロケールルーティング戦略。
210
+ * - "prefix-no-default": デフォルトロケール以外にプレフィックスを付ける (例: /dashboard, /fr/dashboard)
211
+ * - "prefix-all": すべてのロケールにプレフィックスを付ける (例: /en/dashboard, /fr/dashboard)
212
+ * - "no-prefix": URL にロケールを含めない。
213
+ * - "search-params": ?locale=... を使用。
214
+ * デフォルト: "prefix-no-default"
188
215
  */
189
216
  mode: "prefix-no-default",
190
217
 
191
218
  /**
192
- * Where to store the user's selected locale.
193
- * Options: 'cookie', 'localStorage', 'sessionStorage', 'header', or an array of these.
194
- * Default: ['cookie', 'header']
219
+ * ユーザーが選択したロケールを保存する場所。
220
+ * オプション: 'cookie', 'localStorage', 'sessionStorage', 'header', またはこれらの配列。
221
+ * デフォルト: ['cookie', 'header']
195
222
  */
196
223
  storage: ["cookie", "header"],
197
224
 
198
225
  /**
199
- * Base path for the application URLs.
200
- * Default: ""
226
+ * アプリケーション URL のベースパス。
227
+ * デフォルト: ""
201
228
  */
202
229
  basePath: "",
203
230
 
204
231
  /**
205
- * Custom URL rewriting rules for locale-specific paths.
232
+ * ロケールごとの特定のパスに対するカスタム URL リライトルール。
206
233
  */
207
234
  rewrite: nextjsRewrite({
208
235
  "/[locale]/about": {
@@ -213,130 +240,130 @@ const config: IntlayerConfig = {
213
240
  },
214
241
 
215
242
  /**
216
- * Settings for finding and processing content files.
243
+ * コンテンツファイルの検索と処理に関する設定。
217
244
  */
218
245
  content: {
219
246
  /**
220
- * File extensions to scan for dictionaries.
221
- * Default: ['.content.ts', '.content.js', '.content.json', etc.]
247
+ * 辞書をスキャンするためのファイル拡張子。
248
+ * デフォルト: ['.content.ts', '.content.js', '.content.json' など]
222
249
  */
223
250
  fileExtensions: [".content.ts", ".content.js", ".content.json"],
224
251
 
225
252
  /**
226
- * Directories where .content files are located.
227
- * Default: ["."]
253
+ * .content ファイルが配置されているディレクトリ。
254
+ * デフォルト: ["."]
228
255
  */
229
256
  contentDir: ["src"],
230
257
 
231
258
  /**
232
- * Directories where source code is located.
233
- * Used for build optimization and code transformation.
234
- * Default: ["."]
259
+ * ソースコードが配置されている場所。
260
+ * ビルドの最適化とコード変換に使用されます。
261
+ * デフォルト: ["."]
235
262
  */
236
263
  codeDir: ["src"],
237
264
 
238
265
  /**
239
- * Patterns to exclude from scanning.
240
- * Default: ['node_modules', '.intlayer', etc.]
266
+ * スキャンから除外されるパターン。
267
+ * デフォルト: ['node_modules', '.intlayer' など]
241
268
  */
242
269
  excludedPath: ["node_modules"],
243
270
 
244
271
  /**
245
- * Whether to watch for changes and rebuild dictionaries in development.
246
- * Default: true in development
272
+ * 開発中に変更を監視し、辞書を再構築するかどうか。
273
+ * デフォルト: 開発中は true
247
274
  */
248
275
  watch: true,
249
276
 
250
277
  /**
251
- * Command to format newly created / updated .content files.
278
+ * 新しく作成または更新された .content ファイルをフォーマットするために使用されるコマンド。
252
279
  */
253
280
  formatCommand: 'npx prettier --write "{{file}}"',
254
281
  },
255
282
 
256
283
  /**
257
- * Visual Editor configuration.
284
+ * ビジュアルエディターの設定。
258
285
  */
259
286
  editor: {
260
287
  /**
261
- * Whether the visual editor is enabled.
262
- * Default: false
288
+ * ビジュアルエディターが有効かどうか。
289
+ * デフォルト: false
263
290
  */
264
291
  enabled: true,
265
292
 
266
293
  /**
267
- * URL of your application for origin validation.
268
- * Default: ""
294
+ * オリジン検証のためのアプリケーションの URL
295
+ * デフォルト: ""
269
296
  */
270
297
  applicationURL: "http://localhost:3000",
271
298
 
272
299
  /**
273
- * Port for the local editor server.
274
- * Default: 8000
300
+ * ローカルエディターサーバーのポート。
301
+ * デフォルト: 8000
275
302
  */
276
303
  port: 8000,
277
304
 
278
305
  /**
279
- * Public URL for the editor.
280
- * Default: "http://localhost:8000"
306
+ * エディターの公開 URL
307
+ * デフォルト: "http://localhost:8000"
281
308
  */
282
309
  editorURL: "http://localhost:8000",
283
310
 
284
311
  /**
285
- * Intlayer CMS URL.
286
- * Default: "https://app.intlayer.org"
312
+ * Intlayer CMS URL
313
+ * デフォルト: "https://app.intlayer.org"
287
314
  */
288
315
  cmsURL: "https://app.intlayer.org",
289
316
 
290
317
  /**
291
- * Backend API URL.
292
- * Default: "https://back.intlayer.org"
318
+ * バックエンド API URL
319
+ * デフォルト: "https://back.intlayer.org"
293
320
  */
294
321
  backendURL: "https://back.intlayer.org",
295
322
 
296
323
  /**
297
- * Whether to enable real-time content synchronization.
298
- * Default: false
324
+ * リアルタイムコンテンツ同期を有効にするかどうか。
325
+ * デフォルト: false
299
326
  */
300
327
  liveSync: true,
301
328
  },
302
329
 
303
330
  /**
304
- * AI-powered translation and generation settings.
331
+ * AI ベースの翻訳および構築設定。
305
332
  */
306
333
  ai: {
307
334
  /**
308
- * AI provider to use.
309
- * Options: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai'
310
- * Default: 'openai'
335
+ * 使用する AI プロバイダー。
336
+ * オプション: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai'
337
+ * デフォルト: 'openai'
311
338
  */
312
339
  provider: "openai",
313
340
 
314
341
  /**
315
- * Model to use from the selected provider.
342
+ * 使用する選択されたプロバイダーのモデル。
316
343
  */
317
344
  model: "gpt-4o",
318
345
 
319
346
  /**
320
- * Provider API key.
347
+ * プロバイダーの API キー。
321
348
  */
322
349
  apiKey: process.env.OPENAI_API_KEY,
323
350
 
324
351
  /**
325
- * Global context to guide the AI in generating translations.
352
+ * 翻訳を生成する際に AI を導くためのグローバルコンテキスト。
326
353
  */
327
- applicationContext: "This is a travel booking application.",
354
+ applicationContext: "これは旅行予約アプリケーションです。",
328
355
 
329
356
  /**
330
- * Base URL for the AI API.
357
+ * AI API のベース URL。
331
358
  */
332
359
  baseURL: "http://localhost:3000",
333
360
 
334
361
  /**
335
- * データシリアライゼーション
362
+ * データシリアル化 (Data Serialization)
336
363
  *
337
364
  * オプション:
338
- * - "json": 標準、信頼性あり。より多くのトークンを使用します。
339
- * - "toon": より少ないトークンを使用しますが、JSON ほど一貫性がありません。
365
+ * - "json": デフォルト、堅牢、より多くのトークンを消費します。
366
+ * - "toon": トークンの消費が少なく、JSON ほど一貫性がない場合があります。
340
367
  *
341
368
  * デフォルト: "json"
342
369
  */
@@ -344,170 +371,170 @@ const config: IntlayerConfig = {
344
371
  },
345
372
 
346
373
  /**
347
- * Build and optimization settings.
374
+ * ビルドと最適化の設定。
348
375
  */
349
376
  build: {
350
377
  /**
351
- * Build execution mode.
352
- * - "auto": Automatic build during app build.
353
- * - "manual": Requires explicit build command.
354
- * Default: "auto"
378
+ * ビルド実行モード。
379
+ * - "auto": アプリケーションのビルド中に自動的にビルド。
380
+ * - "manual": 明示的なビルドコマンドが必要。
381
+ * デフォルト: "auto"
355
382
  */
356
383
  mode: "auto",
357
384
 
358
385
  /**
359
- * Whether to optimize the final bundle by pruning unused dictionaries.
360
- * Default: true in production
386
+ * 未使用の辞書を削除して、最終的なバンドルを最適化するかどうか。
387
+ * デフォルト: 本番環境では true
361
388
  */
362
389
  optimize: true,
363
390
 
364
391
  /**
365
- * Output format for generated dictionary files.
366
- * Default: ['esm', 'cjs']
392
+ * 生成された辞書ファイルの出力形式。
393
+ * デフォルト: ['cjs', 'esm']
367
394
  */
368
- outputFormat: ["esm"],
395
+ outputFormat: ["cjs", "esm"],
369
396
 
370
397
  /**
371
- * Indicates if the build should check TypeScript types.
372
- * Default: false
398
+ * ビルドが TypeScript の型をチェックするかどうかを指定します。
399
+ * デフォルト: false
373
400
  */
374
401
  checkTypes: false,
375
402
  },
376
403
 
377
404
  /**
378
- * Logger configuration.
405
+ * ロガー設定。
379
406
  */
380
407
  log: {
381
408
  /**
382
- * Logging level.
383
- * - "default": Standard logging.
384
- * - "verbose": Detailed debug logging.
385
- * - "disabled": No logging.
386
- * Default: "default"
409
+ * ログレベル。
410
+ * - "default": 標準的なロギング。
411
+ * - "verbose": 詳細なデバッグロギング。
412
+ * - "disabled": ロギングを無効化。
413
+ * デフォルト: "default"
387
414
  */
388
415
  mode: "default",
389
416
 
390
417
  /**
391
- * Prefix for all log messages.
392
- * Default: "[intlayer]"
418
+ * すべてのログメッセージのプレフィックス。
419
+ * デフォルト: "[intlayer]"
393
420
  */
394
421
  prefix: "[intlayer]",
395
422
  },
396
423
 
397
424
  /**
398
- * System configuration (Advanced use cases)
425
+ * システム設定 (高度な使用向け)
399
426
  */
400
427
  system: {
401
428
  /**
402
- * Directory for storing localization dictionaries.
429
+ * ローカライズされた辞書を保存するためのディレクトリ。
403
430
  */
404
431
  dictionariesDir: ".intlayer/dictionary",
405
432
 
406
433
  /**
407
- * Directory for module augmentation.
434
+ * TypeScript モジュール拡張用のディレクトリ。
408
435
  */
409
436
  moduleAugmentationDir: ".intlayer/types",
410
437
 
411
438
  /**
412
- * Directory for storing unmerged dictionaries.
439
+ * マージされていない辞書を保存するためのディレクトリ。
413
440
  */
414
441
  unmergedDictionariesDir: ".intlayer/unmerged_dictionary",
415
442
 
416
443
  /**
417
- * Directory for storing dictionary types.
444
+ * 辞書の型を保存するためのディレクトリ。
418
445
  */
419
446
  typesDir: ".intlayer/types",
420
447
 
421
448
  /**
422
- * Directory where main application files are stored.
449
+ * メインアプリケーションファイルが保存されるディレクトリ。
423
450
  */
424
451
  mainDir: ".intlayer/main",
425
452
 
426
453
  /**
427
- * Directory where the configuration files are stored.
454
+ * 設定ファイルが保存されるディレクトリ。
428
455
  */
429
456
  configDir: ".intlayer/config",
430
457
 
431
458
  /**
432
- * Directory where the cache files are stored.
459
+ * キャッシュファイルが保存されるディレクトリ。
433
460
  */
434
461
  cacheDir: ".intlayer/cache",
435
462
  },
436
463
 
437
464
  /**
438
- * Compiler configuration (Advanced use cases)
465
+ * コンパイラ設定 (高度な使用向け)
439
466
  */
440
467
  compiler: {
441
468
  /**
442
- * コンパイラを有効にするかどうかを示します。
469
+ * コンパイラを有効にするかどうかを指定します。
443
470
  *
444
- * - false : コンパイラを無効にします。
445
- * - true : コンパイラを有効にします。
446
- * - "build-only" : 開発中のコンパイラをスキップして起動時間を短縮します。
471
+ * - false: コンパイラを無効にします。
472
+ * - true: コンパイラを有効にします。
473
+ * - "build-only": 開発中のコンパイラをスキップし、起動速度を上げます。
447
474
  *
448
- * デフォルト : false
475
+ * デフォルト: false
449
476
  */
450
477
  enabled: true,
451
478
 
452
479
  /**
453
- * 出力ファイルのパスを定義します。 `outputDir` を置き換えます。
480
+ * 出力ファイルのパスを定義します。`outputDir` を置き換えます。
454
481
  *
455
- * - `./` で始まるパスは、コンポーネントディレクトリを基準に解決されます。
456
- * - `/` で始まるパスは、プロジェクトのルート (`baseDir`) を基準に解決されます。
482
+ * - `./` パスはコンポーネントディレクトリを基準に解決されます。
483
+ * - `/` パスはプロジェクトルート (`baseDir`) を基準に解決されます。
457
484
  *
458
- * - パスに `{{locale}}` 変数を含めると、言語ごとに分離された辞書の生成が有効になります。
485
+ * - パスに `{{locale}}` 変数を含めると、言語ごとに個別の辞書が作成されます。
459
486
  *
460
487
  * 例:
461
488
  * ```ts
462
489
  * {
463
- * // コンポーネントの隣に多言語対応の .content.ts ファイルを作成
490
+ * // コンポーネントの隣に多言語の .content.ts ファイルを作成
464
491
  * output: ({ fileName, extension }) => `./${fileName}${extension}`,
465
492
  *
466
- * // output: './{{fileName}}{{extension}}', // 文字列テンプレートを使用した同等の記述
493
+ * // output: './{{fileName}}{{extension}}', // テンプレート文字列を使用した同等の設定
467
494
  * }
468
495
  * ```
469
496
  *
470
497
  * ```ts
471
498
  * {
472
- * // プロジェクトのルートに言語ごとに集約された JSON ファイルを作成
499
+ * // プロジェクトルートに言語ごとの一元化された JSON を作成
473
500
  * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
474
501
  *
475
- * // output: '/locales/{{locale}}/{{key}}.content.json', // 文字列テンプレートを使用した同等の記述
502
+ * // output: '/locales/{{locale}}/{{key}}.content.json', // テンプレート文字列を使用した同等の設定
476
503
  * }
477
504
  * ```
478
505
  *
479
506
  * 変数リスト:
480
507
  * - `fileName`: ファイル名。
481
- * - `key`: コンテンツのキー。
482
- * - `locale`: コンテンツのロケール。
508
+ * - `key`: コンテンツキー。
509
+ * - `locale`: コンテンツロケール。
483
510
  * - `extension`: ファイル拡張子。
484
511
  * - `componentFileName`: コンポーネントファイル名。
485
- * - `componentExtension`: コンポーネント拡張子。
486
- * - `format`: 辞書の形式。
487
- * - `componentFormat`: コンポーネント辞書の形式。
488
- * - `componentDirPath`: コンポーネントのディレクトリパス。
512
+ * - `componentExtension`: コンポーネントファイル拡張子。
513
+ * - `format`: 辞書形式。
514
+ * - `componentFormat`: コンポーネント辞書形式。
515
+ * - `componentDirPath`: コンポーネントディレクトリパス。
489
516
  */
490
517
  output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
491
518
 
492
519
  /**
493
- * 変換後にコンポーネントを保存するかどうかを示します。
494
- * これにより、コンパイラを1回だけ実行してアプリを変換し、その後削除することができます。
520
+ * コンポーネントを変換した後に保存するかどうか。
521
+ * これにより、アプリケーションを変換するためにコンパイラを一度だけ実行し、その後削除することができます。
495
522
  */
496
523
  saveComponents: false,
497
524
 
498
525
  /**
499
- * 生成されたファイルにコンテンツのみを挿入します。
526
+ * 生成されたファイルにコンテンツのみを挿入します。i18next または ICU MessageFormat 形式の言語ごとの JSON 出力に役立ちます。
500
527
  */
501
528
  noMetadata: false,
502
529
 
503
530
  /**
504
- * 辞書キーのプレフィックス
531
+ * 辞書キープレフィックス
505
532
  */
506
- dictionaryKeyPrefix: "", // すべての辞書キーにプレフィックスを設定
533
+ dictionaryKeyPrefix: "", // 抽出された辞書キーにオプションのプレフィックスを追加
507
534
  },
508
535
 
509
536
  /**
510
- * Custom schemas to validate the dictionaries content.
537
+ * 辞書コンテンツを検証するためのカスタムスキーマ。
511
538
  */
512
539
  schemas: {
513
540
  "my-schema": z.object({
@@ -516,7 +543,7 @@ const config: IntlayerConfig = {
516
543
  },
517
544
 
518
545
  /**
519
- * Plugins configuration.
546
+ * プラグイン設定。
520
547
  */
521
548
  plugins: [],
522
549
  };
@@ -524,598 +551,372 @@ const config: IntlayerConfig = {
524
551
  export default config;
525
552
  ````
526
553
 
554
+ ---
555
+
527
556
  ## 設定リファレンス
528
557
 
529
- 以下のセクションでは、Intlayerで利用可能なさまざまな設定項目について説明します。
558
+ 以下のセクションでは、Intlayer で利用可能なさまざまな設定項目について説明します。
530
559
 
531
560
  ---
532
561
 
533
- ### 国際化設定
534
-
535
- 国際化に関連する設定を定義します。利用可能なロケールやアプリケーションのデフォルトロケールを含みます。
536
-
537
- #### プロパティ
538
-
539
- - **locales**:
540
- - _型_: `string[]`
541
- - _デフォルト_: `['en']`
542
- - _説明_: アプリケーションでサポートされているロケールのリスト。
543
- - _例_: `['en', 'fr', 'es']`
544
-
545
- - **requiredLocales**:
546
- - _型_: `string[]`
547
- - _デフォルト_: `[]`
548
- - _説明_: アプリケーションで必須とされるロケールのリスト。
549
- - _例_: `[]`
550
- - _注意_: 空の場合、`strict` モードではすべてのロケールが必須となります。
551
- - _注意_: 必須のロケールは `locales` フィールドにも定義されていることを確認してください。
552
- - **strictMode**:
553
- - _型_: `string`
554
- - _デフォルト_: `inclusive`
555
- - _説明_: TypeScriptを使用して国際化コンテンツの強力な実装を保証します。
556
- - _注意_: "strict" に設定すると、翻訳関数 `t` は宣言されたすべてのロケールが定義されていることを要求します。ロケールが1つでも欠けているか、設定に宣言されていないロケールがある場合はエラーをスローします。
557
- - _注意_: "inclusive" に設定すると、翻訳関数 `t` は宣言されたすべてのロケールが定義されていることを要求します。ロケールが1つでも欠けている場合は警告を出します。ただし、設定に宣言されていないが存在するロケールは許容します。
558
- - _注意_: "loose" に設定すると、翻訳関数 `t` は存在する任意のロケールを受け入れます。
559
-
560
- - **defaultLocale**:
561
- - _タイプ_: `string`
562
- - _デフォルト_: `'en'`
563
- - _説明_: 要求されたロケールが見つからない場合にフォールバックとして使用されるデフォルトのロケール。
564
- - _例_: `'en'`
565
- - _注意_: URL、クッキー、またはヘッダーでロケールが指定されていない場合に、どのロケールを使用するかを決定するために使用されます。
562
+ ### 国際化設定 (Internationalization Configuration)
566
563
 
567
- ---
564
+ 利用可能なロケールやアプリケーションのデフォルトロケールなど、国際化に関する設定を定義します。
568
565
 
569
- ### エディター設定
570
-
571
- 統合エディターに関連する設定を定義します。サーバーポートやアクティブ状態などが含まれます。
572
-
573
- #### プロパティ
574
-
575
- - **applicationURL**:
576
- - _タイプ_: `string`
577
- - _デフォルト_: `http://localhost:3000`
578
- - _説明_: アプリケーションのURL。セキュリティ上の理由からエディターのオリジンを制限するために使用されます。
579
- - _例_:
580
- - `'http://localhost:3000'`
581
- - `'https://example.com'`
582
- - `process.env.INTLAYER_EDITOR_URL`
583
- - _注意_: アプリケーションのURL。セキュリティ上の理由からエディターのオリジンを制限するために使用されます。`'*'`に設定すると、どのオリジンからでもエディターにアクセス可能になります。
584
-
585
- - **port**:
586
- - _タイプ_: `number`
587
- - _デフォルト_: `8000`
588
- - _説明_: ビジュアルエディターサーバーが使用するポート。
589
-
590
- - **editorURL**:
591
- - _タイプ_: `string`
592
- - _デフォルト_: `'http://localhost:8000'`
593
- - _説明_: エディターサーバーのURL。セキュリティ上の理由からエディターのオリジンを制限するために使用されます。
594
- - `'http://localhost:3000'`
595
- - `'https://example.com'`
596
- - `process.env.INTLAYER_EDITOR_URL`
597
- - _注_: アプリケーションからアクセスするエディターサーバーのURL。セキュリティ上の理由から、アプリケーションとやり取りできるオリジンを制限するために使用されます。`'*'`に設定すると、エディターは任意のオリジンからアクセス可能になります。ポートを変更した場合やエディターが異なるドメインでホストされている場合に設定する必要があります。
598
-
599
- - **cmsURL**:
600
- - _型_: `string`
601
- - _デフォルト_: `'https://intlayer.org'`
602
- - _説明_: Intlayer CMSのURL。
603
- - _例_: `'https://intlayer.org'`
604
- - _注_: Intlayer CMSのURL。
605
-
606
- - **backendURL**:
607
- - _型_: `string`
608
- - _デフォルト_: `https://back.intlayer.org`
609
- - _説明_: バックエンドサーバーのURL。
610
- - _例_: `http://localhost:4000`
611
-
612
- - **enabled**:
613
- - _型_: `boolean`
614
- - _デフォルト_: `true`
615
- - _説明_: アプリケーションがビジュアルエディターと連携するかどうかを示します。
616
- - _例_: `process.env.NODE_ENV !== 'production'`
617
- - _注意_: true の場合、エディターはアプリケーションと連携可能です。false の場合、エディターはアプリケーションと連携できません。いずれの場合も、エディターはビジュアルエディターによってのみ有効化されます。特定の環境でエディターを無効にすることは、セキュリティを強化する方法の一つです。
618
-
619
- - **clientId**:
620
- - _タイプ_: `string` | `undefined`
621
- - _デフォルト_: `undefined`
622
- - _説明_: clientId と clientSecret は、intlayer パッケージが oAuth2 認証を使用してバックエンドと認証するために使用されます。アクセストークンは、プロジェクトに関連するユーザーを認証するために使用されます。アクセストークンを取得するには、https://app.intlayer.org/project にアクセスしてアカウントを作成してください。
623
- - _例_: `true`
624
- - _注意_: 重要: clientId と clientSecret は秘密にしておく必要があり、公開しないでください。環境変数などの安全な場所に保管することをお勧めします。
625
-
626
- - **clientSecret**:
627
- - _タイプ_: `string` | `undefined`
628
- - _デフォルト_: `undefined`
629
- - _説明_: clientId と clientSecret は、intlayer パッケージが oAuth2 認証を使用してバックエンドと認証するために使用されます。アクセストークンは、プロジェクトに関連するユーザーを認証するために使用されます。アクセストークンを取得するには、https://app.intlayer.org/project にアクセスしてアカウントを作成してください。
630
- - _例_: `true`
631
- - _注意_: 重要: clientId と clientSecret は秘密にしておく必要があり、公開しないでください。環境変数などの安全な場所に保管することを推奨します。
632
-
633
- - **dictionaryPriorityStrategy**:
634
- - _タイプ_: `string`
635
- - _デフォルト_: `'local_first'`
636
- - _説明_: ローカル辞書と遠隔辞書の両方が存在する場合に、どちらを優先するかの戦略です。`'distant_first'` に設定すると、アプリケーションは遠隔辞書をローカル辞書より優先します。`'local_first'` に設定すると、アプリケーションはローカル辞書を遠隔辞書より優先します。
637
- - _例_: `'distant_first'`
638
-
639
- - **liveSync**:
640
- - _型_: `boolean`
641
- - _デフォルト_: `false`
642
- - _説明_: CMS / ビジュアルエディター / バックエンドで変更が検出された際に、アプリケーションサーバーがコンテンツをホットリロードするかどうかを示します。
643
- - _例_: `true`
644
- - _注意_: 例えば、新しい辞書が追加または更新された場合、アプリケーションはページに表示するコンテンツを更新します。
645
- - _注記_: ライブ同期はアプリケーションのコンテンツを別のサーバーに外部化する必要があります。これはアプリケーションのパフォーマンスにわずかな影響を与える可能性があります。これを制限するために、アプリケーションとライブ同期サーバーを同じマシン上にホストすることを推奨します。また、ライブ同期と `optimize` の組み合わせはライブ同期サーバーへのリクエスト数を大幅に増加させる可能性があります。インフラストラクチャに応じて、両方のオプションおよびその組み合わせをテストすることを推奨します。
646
-
647
- - **liveSyncPort**:
648
- - _タイプ_: `number`
649
- - _デフォルト_: `4000`
650
- - _説明_: ライブ同期サーバーのポート番号。
651
- - _例_: `4000`
652
- - _注記_: ライブ同期サーバーのポート番号。
653
-
654
- - **liveSyncURL**:
655
- - _タイプ_: `string`
656
- - _デフォルト_: `'http://localhost:{liveSyncPort}'`
657
- - _説明_: ライブシンクサーバーのURL。
658
- - _例_: `'https://example.com'`
659
- - _注意_: デフォルトではlocalhostを指しますが、リモートのライブシンクサーバーの場合は任意のURLに変更可能です。
660
-
661
- ### ミドルウェア設定
662
-
663
- ミドルウェアの動作を制御する設定で、アプリケーションがクッキー、ヘッダー、ロケール管理のためのURLプレフィックスをどのように扱うかを含みます。
664
-
665
- #### プロパティ
666
-
667
- - **headerName**:
668
- - _型_: `string`
669
- - _デフォルト_: `'x-intlayer-locale'`
670
- - _説明_: ロケールを判定するために使用されるHTTPヘッダーの名前。
671
- - _例_: `'x-custom-locale'`
672
- - _注意_: APIベースのロケール判定に便利です。
673
-
674
- - **cookieName**:
675
- - _型_: `string`
676
- - _デフォルト_: `'intlayer-locale'`
677
- - _説明_: ロケールを保存するために使用されるクッキーの名前。
678
- - _例_: `'custom-locale'`
679
- - _注意_: セッション間でロケールを保持するために使用されます。
680
-
681
- - **prefixDefault**:
682
- - _タイプ_: `boolean`
683
- - _デフォルト_: `false`
684
- - _説明_: デフォルトのロケールをURLに含めるかどうか。
685
- - _例_: `true`
686
- - _注意_:
687
- - `true` かつ `defaultLocale = 'en'` の場合: パスは `/en/dashboard` または `/fr/dashboard`
688
- - `false` かつ `defaultLocale = 'en'` の場合: パスは `/dashboard` または `/fr/dashboard`
689
-
690
- - **basePath**:
691
- - _タイプ_: `string`
692
- - _デフォルト_: `''`
693
- - _説明_: アプリケーションのURLのベースパス。
694
- - _例_: `'/my-app'`
695
- - _注意_:
696
- - アプリケーションが `https://example.com/my-app` にホストされている場合
697
- - ベースパスは `'/my-app'`
698
- - URLは `https://example.com/my-app/en` となります
699
- - ベースパスが設定されていない場合、URLは `https://example.com/en` となります
700
-
701
- - **rewrite**:
702
- - _タイプ_: `Record<string, StrictModeLocaleMap<string>>`
703
- - _デフォルト_: `undefined`
704
- - _説明_: 特定のパスのデフォルトルーティングモードを上書きするカスタムURL書き換えルール。標準のルーティング動作とは異なる言語固有のパスを定義できます。`[param]` 構文を使用した動的ルートパラメータをサポートします。
705
- - _例_:
706
- ```typescript
707
- routing: {
708
- mode: "prefix-no-default", // フォールバック戦略
709
- rewrite: nextjsRewrite({
710
- "/[locale]/about": {
711
- en: "/[locale]/about",
712
- fr: "/[locale]/a-propos",
713
- },
714
- "/[locale]/product/[slug]": {
715
- en: "/[locale]/product/[slug]",
716
- fr: "/[locale]/produit/[slug]",
717
- },
718
- "/[locale]/blog/[category]/[id]": {
719
- en: "/[locale]/blog/[category]/[id]",
720
- fr: "/[locale]/journal/[category]/[id]",
721
- },
722
- }),
723
- }
724
- ```
725
- - _注意_: 書き換えルールはデフォルトの `mode` 動作よりも優先されます。パスが書き換えルールに一致する場合、標準の言語プレフィックスの代わりに書き換え設定のローカライズされたパスが使用されます。
726
- - _注意_: 動的ルートパラメータは角括弧表記(例:`[slug]`、`[id]`)を使用してサポートされます。パラメータ値はURLから自動的に抽出され、書き換えられたパスに補間されます。
727
- - _注意_: Next.js と Vite アプリケーションで動作します。ミドルウェア/プロキシは、内部ルート構造に一致するように受信リクエストを自動的に書き換えます。
728
- - _注意_: `getLocalizedUrl()` でURLを生成する場合、提供されたパスに一致する場合、書き換えルールが自動的に適用されます。
729
- - _参照_: 詳細については、[カスタムURL書き換え](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/custom_url_rewrites.md)を参照してください。
730
-
731
- - **serverSetCookie**:
732
- - _タイプ_: `string`
733
- - _デフォルト_: `'always'`
734
- - _説明_: サーバー側でロケールクッキーを設定するルール。
735
- - _オプション_: `'always'`, `'never'`
736
- - _例_: `'never'`
737
- - _注意_: ロケールクッキーをすべてのリクエストで設定するか、まったく設定しないかを制御します。
738
-
739
- - **noPrefix**:
740
- - _タイプ_: `boolean`
741
- - _デフォルト_: `false`
742
- - _説明_: URLからロケールのプレフィックスを省略するかどうか。
743
- - _例_: `true`
744
- - _注意_:
745
- - `true` の場合: URLにプレフィックスはありません
746
- - `false` の場合: URLにプレフィックスがあります
747
- - `basePath = '/my-app'` の例:
748
- - `noPrefix = false` の場合: URLは `https://example.com/my-app/en`
749
- - `noPrefix = true` の場合: URLは `https://example.com`
566
+ | フィールド | 型 | 説明 | 例 | 備考 |
567
+ | ----------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
568
+ | `locales` | `string[]` | アプリケーションでサポートされるロケールのリスト。デフォルト: `[Locales.ENGLISH]` | `['en', 'fr', 'es']` | |
569
+ | `requiredLocales` | `string[]` | アプリケーションにおける必須ロケールのリスト。デフォルト: `[]` | `[]` | 空の場合、`strict` モードではすべてのロケールが必須になります。必須ロケールが `locales` フィールドでも定義されていることを確認してください。 |
570
+ | `strictMode` | `string` | TypeScript を使用した堅牢な国際化コンテンツの実装を保証します。デフォルト: `inclusive` | | `"strict"` の場合: `t` 関数は宣言されたすべてのロケールが定義されていることを要求します。欠落しているか未宣言の場合はエラーをスローします。 `"inclusive"` の場合: ロケールの欠落を警告しますが、既存の未宣言ロケールを受け入れます。 `"loose"` の場合: 既存の任意のロケールを受け入れます。 |
571
+ | `defaultLocale` | `string` | リクエストされたロケールが見つからない場合にフォールバックとして使用されるデフォルトロケール。デフォルト: `Locales.ENGLISH` | `'en'` | URL、クッキー、またはヘッダーでロケールが指定されていない場合にロケールを決定するために使用されます。 |
750
572
 
751
573
  ---
752
574
 
753
- ### コンテンツ設定
754
-
755
- アプリケーション内のコンテンツ処理に関連する設定。ディレクトリ名、ファイル拡張子、および派生設定を含みます。
756
-
757
- #### プロパティ
758
-
759
- - **autoFill**:
760
- - _型_: `boolean | string | FilePathPattern | { [key in Locales]?: string }`
761
- - _デフォルト_: `undefined`
762
- - _説明_: コンテンツをAIを使って自動的にどのように埋めるかを示します。`intlayer.config.ts`ファイルでグローバルに宣言することができます。
763
- - _例_: true
764
- - _例_: `'./{{fileName}}.content.json'`
765
- - _例_: `{ fr: './{{fileName}}.fr.content.json', es: './{{fileName}}.es.content.json' }`
766
- - _注意_: 自動埋め設定は以下のいずれかです:
767
- - boolean: すべてのロケールで自動埋めを有効にする
768
- - string: 単一ファイルのパスまたは変数を含むテンプレート
769
- - object: ロケールごとのファイルパス
770
-
771
- - **watch**:
772
- - _型_: `boolean`
773
- - _デフォルト_: `process.env.NODE_ENV === 'development'`
774
- - _説明_: Intlayerがアプリ内のコンテンツ宣言ファイルの変更を監視し、関連する辞書を再構築するかどうかを示します。
775
-
776
- - **fileExtensions**:
777
- - _型_: `string[]`
778
- - _デフォルト_: `['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']`
779
- - _説明_: 辞書を構築する際に探すファイル拡張子。
780
- - _例_: `['.data.ts', '.data.js', '.data.json']`
781
- - _注意_: ファイル拡張子をカスタマイズすることで競合を回避できます。
782
-
783
- - **dictionaryOutput**:
784
- - _タイプ_: `string[]`
785
- - _デフォルト_: `['intlayer']`
786
- - _説明_: 使用する辞書出力のタイプ。例:`'intlayer'` または `'i18next'`。
787
-
788
- - **contentDir**:
789
- - _タイプ_: `string[]`
790
- - _デフォルト_: `['.']`
791
- - _例_: `['src', '../../ui-library', require.resolve("@my-package/content")]`
792
- - _説明_: コンテンツ定義ファイル(`.content.*`)が保存されているディレクトリパス。
793
- - _注意_: これは辞書を再構築するためにコンテンツファイルを監視するために使用されます。
794
-
795
- - **codeDir**:
796
- - _タイプ_: `string[]`
797
- - _デフォルト_: `['.']`
798
- - _例_: `['src', '../../ui-library']`
799
- - _説明_: コードが保存されているディレクトリパス(ベースディレクトリからの相対パス)。
800
- - _注意_: これはコードファイルを変換(プルーン、最適化)するために監視するために使用されます。これを `contentDir` から分離しておくことで、コンテンツファイルの不要なスキャンを避けることでビルドパフォーマンスを向上させることができます。
801
-
802
- - **dictionariesDir**:
803
- - _タイプ_: `string`
804
- - _デフォルト_: `'.intlayer/dictionaries'`
805
- - _説明_: 中間結果または出力結果を保存するためのディレクトリパス。
806
-
807
- - **moduleAugmentationDir**:
808
- - _タイプ_: `string`
809
- - _デフォルト_: `'.intlayer/types'`
810
- - _説明_: モジュール拡張用のディレクトリで、IDEの補完や型チェックを向上させるためのもの。
811
- - _例_: `'intlayer-types'`
812
- - _注意_: これを必ず `tsconfig.json` に含めてください。
813
-
814
- - **unmergedDictionariesDir**:
815
- - _タイプ_: `string`
816
- - _デフォルト_: `'.intlayer/unmerged_dictionary'`
817
- - _説明_: マージされていない辞書を保存するためのディレクトリ。
818
- - _例_: `'translations'`
819
-
820
- - **dictionariesDir**:
821
- - _タイプ_: `string`
822
- - _デフォルト_: `'.intlayer/dictionary'`
823
- - _説明_: ローカリゼーション辞書を格納するディレクトリ。
824
- - _例_: `'translations'`
825
-
826
- - **i18nextResourcesDir**:
827
- - _タイプ_: `string`
828
- - _デフォルト_: `'i18next_dictionary'`
829
- - _説明_: i18n辞書を格納するディレクトリ。
830
- - _例_: `'translations'`
831
- - _注意_: このディレクトリがi18nextの出力タイプ用に設定されていることを確認してください。
832
-
833
- - **typesDir**:
834
- - _タイプ_: `string`
835
- - _デフォルト_: `'types'`
836
- - _説明_: 辞書の型を格納するディレクトリ。
837
- - _例_: `'intlayer-types'`
838
-
839
- - **mainDir**:
840
- - _タイプ_: `string`
841
- - _デフォルト_: `'main'`
842
- - _説明_: メインアプリケーションファイルが格納されるディレクトリ。
843
- - _例_: `'intlayer-main'`
844
-
845
- - **excludedPath**:
846
- - _タイプ_: `string[]`
847
- - _デフォルト_: `['node_modules']`
848
- - _説明_: コンテンツ検索から除外するディレクトリ。
849
- - _注意_: この設定はまだ使用されていませんが、将来的に実装予定です。
575
+ ### エディター設定 (Editor Configuration)
576
+
577
+ サーバーポートやアクティビティ状態など、統合エディターに関連する設定を定義します。
578
+
579
+ | フィールド | 型 | 説明 | 例 | 備考 |
580
+ | ---------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
581
+ | `applicationURL` | `string` | アプリケーションの URL。デフォルト: `''` | `'http://localhost:3000'`, `'https://example.com'`, `process.env.INTLAYER_EDITOR_URL` | セキュリティ上の理由からエディターのオリジンを制限するために使用されます。 `'*'` に設定すると、任意のオリジンからエディターにアクセスできます。 |
582
+ | `port` | `number` | ビジュアルエディターサーバーで使用されるポート。デフォルト: `8000` | | |
583
+ | `editorURL` | `string` | エディターサーバーの URL。デフォルト: `'http://localhost:8000'` | `'http://localhost:3000'`, `'https://example.com'`, `process.env.INTLAYER_EDITOR_URL` | アプリケーションと対話できるオリジンを制限するために使用されます。 `'*'` に設定すると、任意のオリジンからアクセス可能です。ポートを変更する場合や、エディターが別のドメインでホストされている場合は、設定する必要があります。 |
584
+ | `cmsURL` | `string` | Intlayer CMS の URL。デフォルト: `'https://intlayer.org'` | `'https://intlayer.org'` | |
585
+ | `backendURL` | `string` | バックエンドサーバーの URL。デフォルト: `https://back.intlayer.org` | `http://localhost:4000` | |
586
+ | `enabled` | `boolean` | アプリがビジュアルエディターと対話するかどうかを指定します。デフォルト: `true` | `process.env.NODE_ENV !== 'production'` | `false` の場合、エディターはアプリと対話できません。特定の環境で無効にすることでセキュリティを強化できます。 |
587
+ | `clientId` | `string &#124; undefined` | oAuth2 を使用してバックエンドで認証できるようにします。アクセストークンを取得するには、[intlayer.org/project](https://app.intlayer.org/project) にアクセスしてください。デフォルト: `undefined` | | 秘密に保管し、環境変数に保存してください。 |
588
+ | `clientSecret` | `string &#124; undefined` | oAuth2 を使用してバックエンドで認証できるようにします。アクセストークンを取得するには、[intlayer.org/project](https://app.intlayer.org/project) にアクセスしてください。デフォルト: `undefined` | | 秘密に保管し、環境変数に保存してください。 |
589
+ | `dictionaryPriorityStrategy` | `string` | ローカル辞書とリモート辞書の両方が存在する場合の辞書の優先順位付け戦略。デフォルト: `'local_first'` | `'distant_first'` | `'distant_first'`: ローカルよりもリモートを優先します。 `'local_first'`: リモートよりもローカルを優先します。 |
590
+ | `liveSync` | `boolean` | CMS / ビジュアルエディター / バックエンドで変更が検出されたときに、アプリサーバーがコンテンツをホットリロードするかどうかを指定します。デフォルト: `true` | `true` | 辞書が追加または更新されると、アプリはページコンテンツを更新します。ライブ同期はコンテンツを別のサーバーにアウトソーシングするため、パフォーマンスにわずかな影響を与える可能性があります。両方を同じマシンでホストすることをお勧めします。 |
591
+ | `liveSyncPort` | `number` | ライブ同期サーバーのポート。デフォルト: `4000` | `4000` | |
592
+ | `liveSyncURL` | `string` | ライブ同期サーバーの URL。デフォルト: `'http://localhost:{liveSyncPort}'` | `'https://example.com'` | デフォルトでは localhost を指しますが、リモートのライブ同期サーバーに変更可能です。 |
593
+
594
+ ### ルーティング設定 (Routing Configuration)
595
+
596
+ URL 構造、ロケールストレージ、ミドルウェア処理など、ルーティングの動作を制御する設定。
597
+
598
+ | フィールド | 型 | 説明 | 例 | 備考 |
599
+ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
600
+ | `mode` | `'prefix-no-default' &#124; 'prefix-all' &#124; 'no-prefix' &#124; 'search-params'` | ロケール処理のための URL ルーティングモード。デフォルト: `'prefix-no-default'` | `'prefix-no-default'`: `/dashboard` (en) または `/fr/dashboard` (fr)。 `'prefix-all'`: `/en/dashboard`。 `'no-prefix'`: 他の方法でロケールが処理される。 `'search-params'`: `/dashboard?locale=fr` | クッキーやロケールストレージの管理には影響しません。 |
601
+ | `storage` | `false &#124; 'cookie' &#124; 'localStorage' &#124; 'sessionStorage' &#124; 'header' &#124; CookiesAttributes &#124; StorageAttributes &#124; Array` | クライアントにロケールを保存するための構成。デフォルト: `['cookie', 'header']` | `'localStorage'`, `[{ type: 'cookie', name: 'custom-locale', secure: true }]` | 下記の「ストレージオプション」の表を参照してください。 |
602
+ | `basePath` | `string` | アプリケーション URL のベースパス。デフォルト: `''` | `'/my-app'` | アプリが `https://example.com/my-app` にある場合、basePath は `'/my-app'` となり、URL は `https://example.com/my-app/en` のようになります。 |
603
+ | `rewrite` | `Record<string, StrictModeLocaleMap<string>>` | 特定のパスに対してデフォルトのルーティングモードを上書きするカスタム URL リライトルール。動的パラメータ `[param]` をサポートします。デフォルト: `undefined` | 下記の例を参照 | リライトルールは `mode` よりも優先されます。Next.js および Vite で動作します。 `getLocalizedUrl()` は一致するルールを自動的に適用します。 [カスタム URL リライト](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/custom_url_rewrites.md) を参照してください。 |
604
+
605
+ **`rewrite` の例**:
606
+
607
+ ```typescript
608
+ routing: {
609
+ mode: "prefix-no-default", // フォールバック戦略
610
+ rewrite: nextjsRewrite({
611
+ "/about": {
612
+ en: "/about",
613
+ fr: "/a-propos",
614
+ },
615
+ "/product/[slug]": {
616
+ en: "/product/[slug]",
617
+ fr: "/produit/[slug]",
618
+ },
619
+ "/blog/[category]/[id]": {
620
+ en: "/blog/[category]/[id]",
621
+ fr: "/journal/[category]/[id]",
622
+ },
623
+ }),
624
+ }
625
+ ```
626
+
627
+ #### ストレージオプション (Storage Options)
628
+
629
+ | 値 | 説明 | 備考 |
630
+ | ------------------ | -------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
631
+ | `'cookie'` | クッキーにロケールを保存します。クライアント側とサーバー側の両方からアクセス可能です。 | GDPR 準拠のため、適切なユーザーの同意が得られていることを確認してください。 `CookiesAttributes` でカスタマイズ可能です (`{ type: 'cookie', name: 'custom-locale', secure: true, httpOnly: false }`)。 |
632
+ | `'localStorage'` | ブラウザにロケールを保存します。有効期限はありません。クライアント側のみ。 | 明示的にクリアされない限り期限切れになりません。 Intlayer プロキシはアクセスできません。 `StorageAttributes` でカスタマイズ可能です (`{ type: 'localStorage', name: 'custom-locale' }`)。 |
633
+ | `'sessionStorage'` | ページセッションの間、ロケールを保存します。クライアント側のみ。 | タブまたはウィンドウを閉じるとクリアされます。 Intlayer プロキシはアクセスできません。 `StorageAttributes` でカスタマイズ可能です (`{ type: 'sessionStorage', name: 'custom-locale' }`)。 |
634
+ | `'header'` | HTTP ヘッダーを介してロケールを保存または送信します。サーバー側のみ。 | API 呼び出しに役立ちます。クライアント側からはアクセスできません。 `StorageAttributes` でカスタマイズ可能です (`{ type: 'header', name: 'custom-locale' }`)。 |
635
+
636
+ #### クッキー属性 (Cookie Attributes)
637
+
638
+ クッキーによるストレージを使用する場合、追加のクッキー属性を設定できます。
639
+
640
+ | フィールド | 型 | 説明 |
641
+ | ---------- | ------------------------------------- | --------------------------------------------- |
642
+ | `name` | `string` | クッキー名。デフォルト: `'INTLAYER_LOCALE'` |
643
+ | `domain` | `string` | クッキーのドメイン。デフォルト: `undefined` |
644
+ | `path` | `string` | クッキーのパス。デフォルト: `undefined` |
645
+ | `secure` | `boolean` | HTTPS を必須にします。デフォルト: `undefined` |
646
+ | `httpOnly` | `boolean` | HTTP-only フラグ。デフォルト: `undefined` |
647
+ | `sameSite` | `'strict' &#124; 'lax' &#124; 'none'` | SameSite ポリシー。 |
648
+ | `expires` | `Date &#124; number` | 有効期限または日数。デフォルト: `undefined` |
649
+
650
+ #### ロケールストレージ属性 (Locale Storage Attributes)
651
+
652
+ localStorage または sessionStorage を使用する場合:
653
+
654
+ | フィールド | 型 | 説明 |
655
+ | ---------- | ---------------------------------------- | ----------------------------------------------------- |
656
+ | `type` | `'localStorage' &#124; 'sessionStorage'` | ストレージの種類。 |
657
+ | `name` | `string` | ストレージキーの名前。デフォルト: `'INTLAYER_LOCALE'` |
658
+
659
+ #### 設定例
660
+
661
+ 新しい v7 ルーティング構造の一般的な設定例をいくつか示します。
662
+
663
+ **基本設定 (デフォルト)**:
664
+
665
+ ```typescript
666
+ import { Locales, type IntlayerConfig } from "intlayer";
667
+ // intlayer.config.ts
668
+ const config: IntlayerConfig = {
669
+ internationalization: {
670
+ locales: ["en", "fr", "es"],
671
+ defaultLocale: "en",
672
+ },
673
+ routing: {
674
+ mode: "prefix-no-default",
675
+ storage: "localStorage",
676
+ basePath: "",
677
+ },
678
+ };
679
+
680
+ export default config;
681
+ ```
682
+
683
+ **GDPR 準拠の設定**:
684
+
685
+ ```typescript
686
+ import { Locales, type IntlayerConfig } from "intlayer";
687
+ // intlayer.config.ts
688
+ const config: IntlayerConfig = {
689
+ internationalization: {
690
+ locales: ["en", "fr", "es"],
691
+ defaultLocale: "en",
692
+ },
693
+ routing: {
694
+ mode: "prefix-no-default",
695
+ storage: [
696
+ {
697
+ type: "localStorage",
698
+ name: "user-locale",
699
+ },
700
+ {
701
+ type: "cookie",
702
+ name: "user-locale",
703
+ secure: true,
704
+ sameSite: "strict",
705
+ httpOnly: false,
706
+ },
707
+ ],
708
+ basePath: "",
709
+ },
710
+ };
711
+
712
+ export default config;
713
+ ```
714
+
715
+ **検索パラメータモード (Search Parameters Mode)**:
716
+
717
+ ```typescript
718
+ import { Locales, type IntlayerConfig } from "intlayer";
719
+ // intlayer.config.ts
720
+ const config: IntlayerConfig = {
721
+ internationalization: {
722
+ locales: ["en", "fr", "es"],
723
+ defaultLocale: "en",
724
+ },
725
+ routing: {
726
+ mode: "search-params",
727
+ storage: "localStorage",
728
+ basePath: "",
729
+ },
730
+ };
731
+
732
+ export default config;
733
+ ```
734
+
735
+ **カスタムストレージを使用したプレフィックスなしモード (No Prefix Mode)**:
736
+
737
+ ```typescript
738
+ import { Locales, type IntlayerConfig } from "intlayer";
739
+ // intlayer.config.ts
740
+ const config: IntlayerConfig = {
741
+ internationalization: {
742
+ locales: ["en", "fr", "es"],
743
+ defaultLocale: "en",
744
+ },
745
+ routing: {
746
+ mode: "no-prefix",
747
+ storage: {
748
+ type: "sessionStorage",
749
+ name: "app-locale",
750
+ },
751
+ basePath: "/my-app",
752
+ },
753
+ };
754
+
755
+ export default config;
756
+ ```
757
+
758
+ **動的パスを使用したカスタム URL リライト**:
759
+
760
+ ```typescript
761
+ // intlayer.config.ts
762
+ import { nextjsRewrite } from "intlayer/routing";
763
+
764
+ const config: IntlayerConfig = {
765
+ internationalization: {
766
+ locales: ["en", "fr"],
767
+ defaultLocale: "en",
768
+ },
769
+ routing: {
770
+ mode: "prefix-no-default", // リライトされないパスのフォールバック
771
+ storage: "cookie",
772
+ rewrite: nextjsRewrite({
773
+ "/about": {
774
+ en: "/about",
775
+ fr: "/a-propos",
776
+ },
777
+ "/product/[slug]": {
778
+ en: "/product/[slug]",
779
+ fr: "/produit/[slug]",
780
+ },
781
+ "/blog/[category]/[id]": {
782
+ en: "/blog/[category]/[id]",
783
+ fr: "/journal/[category]/[id]",
784
+ },
785
+ }),
786
+ },
787
+ };
788
+
789
+ export default config;
790
+ ```
850
791
 
851
792
  ---
852
793
 
853
- ### システム設定
794
+ ### コンテンツ設定 (Content Configuration)
854
795
 
855
- Intlayerの内部パスと出力結果に関連する設定。これらの設定は通常内部的なものであり、ユーザーが変更する必要はありません。
796
+ アプリケーション内でのコンテンツの処理に関する設定 (ディレクトリ名、ファイル拡張子、派生設定)。
856
797
 
857
- #### プロパティ
798
+ | フィールド | 型 | 説明 | 例 | 備考 |
799
+ | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------- |
800
+ | `watch` | `boolean` | Intlayer が辞書を再構築するためにコンテンツ宣言ファイルの変更を監視するかどうかを指定します。デフォルト: `process.env.NODE_ENV === 'development'` | | |
801
+ | `fileExtensions` | `string[]` | コンテンツ宣言ファイルをスキャンするために使用されるファイル拡張子。デフォルト: `['.content.ts', '.content.js', '.content.mjs', '.content.cjs', '.content.json', '.content.json5', '.content.jsonc']` | `['.content.ts', '.content.js']` | |
802
+ | `contentDir` | `string[]` | コンテンツ宣言ファイルが配置されているディレクトリへのパス。デフォルト: `['.']` | `['src/content']` | |
803
+ | `codeDir` | `string[]` | アプリケーションのソースコードファイルが配置されているディレクトリへのパス。デフォルト: `['.']` | `['src']` | ビルドを最適化し、コード変換とホットリロードが必要なファイルにのみ適用されるようにするために使用されます。 |
804
+ | `excludedPath` | `string[]` | コンテンツスキャンから除外されるパス。デフォルト: `['node_modules', '.intlayer', '.next', 'dist', 'build']` | `['src/styles']` | |
805
+ | `formatCommand` | `string` | 新しく作成または更新されたコンテンツファイルをフォーマットするために実行されるコマンド。デフォルト: `undefined` | `'npx prettier --write "{{file}}"'` | コンテンツ抽出時やビジュアルエディターを介して使用されます。 |
858
806
 
859
- - **baseDir**:
860
- - _タイプ_: `string`
861
- - _デフォルト_: `process.cwd()`
862
- - _説明_: プロジェクトのベースディレクトリ。
863
- - _例_: `'/path/to/project'`
864
- - _注意_: これはすべてのIntlayer関連ディレクトリを解決するために使用されます。
807
+ ---
865
808
 
866
- ### 辞書設定
809
+ ### 辞書設定 (Dictionary Configuration)
867
810
 
868
- 自動入力の動作やコンテンツ生成を含む、辞書操作を制御する設定。
811
+ 自動入力動作やコンテンツ生成など、辞書操作を制御する設定。
869
812
 
870
- この辞書設定には、主に2つの目的があります:
813
+ この辞書設定には、主に 2 つの目的があります:
871
814
 
872
- 1. **デフォルト値**: コンテンツ宣言ファイルを作成する際のデフォルト値を定義
873
- 2. **フォールバック動作**: 特定のフィールドが定義されていない場合のフォールバック値を提供し、辞書操作の動作をグローバルに定義できるようにする
815
+ 1. **デフォルト値**: コンテンツ宣言ファイルを作成する際のデフォルト値を定義します。
816
+ 2. **フォールバック動作**: 特定のフィールドが定義されていない場合にフォールバック値を提供し、辞書操作の動作をグローバルに定義できるようにします。
874
817
 
875
818
  コンテンツ宣言ファイルと設定値の適用方法の詳細については、[コンテンツファイルのドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/content_file.md)を参照してください。
876
819
 
877
- #### プロパティ
820
+ | フィールド | 型 | 説明 | 例 | 備考 |
821
+ | --------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
822
+ | `fill` | `boolean &#124; FilePathPattern &#124; Partial<Record<Locale, boolean &#124; FilePathPattern>>` | 自動入力(AI 翻訳)出力ファイルの生成方法を制御します。デフォルト: `true` | 下記の例を参照 | `true`: デフォルトパス(ソースと同じファイル)。 `false`: 無効。文字列/関数テンプレートはロケールごとにファイルを生成します。ロケールごとのオブジェクト:各ロケールが独自のパターンにマップされます。 `false` はそのロケールをスキップします。 `{{locale}}` を含めると、ロケールごとの生成がトリガーされます。辞書レベルの `fill` は、常にこのグローバル設定よりも優先されます。 |
823
+ | `importMode` | `'static' &#124; 'dynamic' &#124; 'fetch'` | 辞書のインポート方法を制御します。デフォルト: `'static'` | `'dynamic'` | `'static'`: 静的にインポートされます。 `'dynamic'`: Suspense を使用して動的にインポートされます。 `'fetch'`: Live Sync API を介して動的に取得されます。 `getIntlayer`, `getDictionary`, `useDictionary` などには影響しません。 |
824
+ | `location` | `'local' &#124; 'remote' &#124; 'hybrid' &#124; string` | 辞書の保存場所。デフォルト: `'local'` | `'remote'` | `'local'`: ファイルシステム。 `'remote'`: Intlayer CMS。 `'hybrid'`: 両方。 |
825
+ | `contentAutoTransformation` | `boolean` | コンテンツファイルを自動的に変換するかどうか (例: Markdown から HTML)。デフォルト: `false` | `true` | @intlayer/markdown を介して Markdown フィールドを処理するのに役立ちます。 |
826
+
827
+ **`fill` の例**:
828
+
829
+ ```ts
830
+ dictionary: {
831
+ fill: {
832
+ en: '/locales/en/{{key}}.content.json',
833
+ fr: ({ key }) => `/locales/fr/${key}.content.json`,
834
+ es: false,
835
+ }
836
+ }
837
+ ```
838
+
839
+ ---
840
+
841
+ ### AI 設定 (AI Configuration)
878
842
 
879
- - **fill**
880
- - **description**
881
- - **locale**
882
- - **location**
883
- - **priority**
884
- - **live**
885
- - **schema**
886
- - **title**
887
- - **tags**
888
- - **version**
843
+ 翻訳構築などの Intlayer の AI 搭載機能の設定を定義します。
844
+
845
+ | フィールド | 型 | 説明 | 例 | 備考 |
846
+ | -------------------- | ---------------------- | --------------------------------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------- |
847
+ | `provider` | `string` | 使用する AI プロバイダー。 | `'openai'`, `'anthropic'`, `'googlevertex'` | |
848
+ | `model` | `string` | 使用する AI モデル。 | `'gpt-4o'`, `'claude-3-5-sonnet-20240620'` | |
849
+ | `apiKey` | `string` | 選択したプロバイダーの API キー。 | `process.env.OPENAI_API_KEY` | |
850
+ | `applicationContext` | `string` | AI 翻訳の精度を向上させるためのアプリに関する追加コンテキスト。 | `'子供向けの学習プラットフォーム。'` | |
851
+ | `baseURL` | `string` | API 呼び出し用のオプションのベース URL。 | | プロキシやローカル AI デプロイメントを使用している場合に役立ちます。 |
852
+ | `dataSerialization` | `'json' &#124; 'toon'` | AI にデータを送信する方法を定義します。デフォルト: `'json'` | `'json'` | `'json'`: より堅牢で正確。 `'toon'`: トークンの消費は少ないですが、安定性に欠ける場合があります。 |
889
853
 
890
854
  ---
891
855
 
892
- ### ロガー設定
893
-
894
- ロガーを制御する設定で、使用するプレフィックスも含みます。
895
-
896
- #### プロパティ
897
-
898
- - **mode**:
899
- - _タイプ_: `string`
900
- - _デフォルト_: `default`
901
- - _説明_: ロガーのモードを示します。
902
- - _オプション_: `default`, `verbose`, `disabled`
903
- - _例_: `default`
904
- - _注意_: ロガーのモードです。verboseモードはより多くの情報をログに記録しますが、デバッグ目的で使用されます。disabledモードはロガーを無効にします。
905
-
906
- - **prefix**:
907
- - _タイプ_: `string`
908
- - _デフォルト_: `'[intlayer] '`
909
- - _説明_: ロガーのプレフィックス。
910
- - _例_: `'[my custom prefix] '`
911
- - _注_: ロガーのプレフィックス。
912
-
913
- ### AI構成
914
-
915
- IntlayerのAI機能を制御する設定で、プロバイダー、モデル、APIキーを含みます。
916
-
917
- この設定は、アクセスキーを使用して[Intlayerダッシュボード](https://app.intlayer.org/project)に登録している場合はオプションです。Intlayerは、最も効率的でコスト効果の高いAIソリューションを自動的に管理します。デフォルトのオプションを使用することで、Intlayerが継続的に最適なモデルを使用するように更新されるため、長期的な保守性が向上します。
918
-
919
- 独自のAPIキーや特定のモデルを使用したい場合は、カスタムAI構成を定義できます。
920
- このAI構成は、Intlayer環境全体でグローバルに使用されます。CLIコマンドはこれらの設定をコマンド(例:`fill`)のデフォルトとして使用し、SDK、ビジュアルエディター、CMSでも同様です。特定のユースケースに対しては、コマンドパラメータを使ってこれらのデフォルト値を上書きすることができます。
921
-
922
- Intlayerは、柔軟性と選択肢を高めるために複数のAIプロバイダーをサポートしています。現在サポートされているプロバイダーは以下の通りです:
923
-
924
- - **OpenAI**(デフォルト)
925
- - **Anthropic Claude**
926
- - **Mistral AI**
927
- - **DeepSeek**
928
- - **Google Gemini**
929
- - **Meta Llama**
930
- - **Ollama**
931
- - **OpenRouter**
932
- - **Alibaba Cloud**
933
- - **Fireworks**
934
- - **Hugging Face**
935
- - **Groq**
936
- - **Amazon Bedrock**
937
- - **Google AI Studio**
938
- - **Google Vertex**
939
- - **Together.ai**
940
- - **ollama**
941
-
942
- #### プロパティ
943
-
944
- - **provider**:
945
- - _タイプ_: `string`
946
- - _デフォルト_: `'openai'`
947
- - _説明_: IntlayerのAI機能に使用するプロバイダー。
948
- - _オプション_: `'openai'`, `'anthropic'`, `'mistral'`, `'deepseek'`, `'gemini'`, `'ollama'`, `'openrouter'`, `'alibaba'`, `'fireworks'`, `'groq'`, `'huggingface'`, `'bedrock'`, `'googleaistudio'`, `'googlevertex'`, `'togetherai'`
949
- - _例_: `'anthropic'`
950
- - _注意_: プロバイダーによっては異なるAPIキーが必要であり、料金体系も異なる場合があります。
951
-
952
- - **model**:
953
- - _タイプ_: `string`
954
- - _デフォルト_: なし
955
- - _説明_: IntlayerのAI機能で使用するモデル。
956
- - _例_: `'gpt-4o-2024-11-20'`
957
- - _注意_: 使用するモデルはプロバイダーによって異なります。
958
-
959
- - **temperature**:
960
- - _タイプ_: `number`
961
- - _デフォルト_: なし
962
- - _説明_: AIの応答のランダム性を制御する温度パラメータ。
963
- - _例_: `0.1`
964
- - _注意_: 温度が高いほど、AIの応答はより創造的で予測不可能になります。
965
-
966
- - **apiKey**:
967
- - _タイプ_: `string`
968
- - _デフォルト_: なし
969
- - _説明_: 選択したプロバイダーのAPIキー。
970
- - _例_: `process.env.OPENAI_API_KEY`
971
- - _注意_: 重要: APIキーは秘密にしておく必要があり、公開しないでください。環境変数などの安全な場所に保管することを必ず行ってください。
972
-
973
- - **applicationContext**:
974
- - _タイプ_: `string`
975
- - _デフォルト_: なし
976
- - _説明_: AIモデルに対してアプリケーションの追加コンテキストを提供し、より正確で文脈に適した翻訳を生成するのに役立ちます。これには、アプリのドメイン、ターゲットユーザー、トーン、特定の用語などの情報が含まれます。
977
-
978
- - **baseURL**:
979
- - _タイプ_: `string`
980
- - _デフォルト_: なし
981
- - _説明_: AI APIのベースURL。
982
- - _例_: `'https://api.openai.com/v1'`
983
- - _注意_: ローカルまたはカスタムのAI APIエンドポイントを指すために使用できます。
984
-
985
- - **dataSerialization**:
986
- - _型_: `'json' | 'toon'`
987
- - _デフォルト_: `'json'`
988
- - _説明_: IntlayerのAI機能に使用するデータシリアライズ形式。
989
- - _例_: `'toon'`
990
- - _注_: `json`: 標準的で信頼性が高い。より多くのトークンを使用します。`toon`: トークン消費が少ないが、JSONほど一貫性がない。
991
-
992
- ### ビルド設定
993
-
994
- Intlayerがアプリケーションの国際化をどのように最適化しビルドするかを制御する設定。
995
-
996
- ビルドオプションは `@intlayer/babel` と `@intlayer/swc` プラグインに適用されます。
997
-
998
- > 開発モードでは、Intlayer は辞書を静的にインポートして、開発体験を簡素化します。
999
-
1000
- > 最適化された場合、Intlayer は辞書の呼び出しを置き換えてチャンク分割を最適化し、最終バンドルには実際に使用されている辞書のみがインポートされるようにします。
1001
-
1002
- #### プロパティ
1003
-
1004
- - **mode**:
1005
- - _型_: `'auto' | 'manual'`
1006
- - _デフォルト_: `'auto'`
1007
- - _説明_: ビルドのモードを制御します。
1008
- - _例_: `'manual'`
1009
- - _注意_: 'auto'の場合、アプリケーションがビルドされると自動的にビルドが有効になります。
1010
- - _注意_: 'manual'の場合、ビルドコマンドが実行されたときにのみビルドが設定されます。
1011
- - _注意_: 辞書のビルドを無効にするために使用できます。たとえば、Node.js環境での実行を避ける必要がある場合などです。
1012
-
1013
- - **checkTypes**:
1014
- - _タイプ_: `boolean`
1015
- - _デフォルト_: `false`
1016
- - _説明_: ビルドがTypeScriptの型をチェックし、エラーをログに記録するかどうかを示します。
1017
- - _注_: これにより、ビルドが遅くなる可能性があります。
1018
-
1019
- - **optimize**:
1020
- - _型_: `boolean`
1021
- - _デフォルト_: `process.env.NODE_ENV === 'production'`
1022
- - _説明_: ビルドを最適化するかどうかを制御します。
1023
- - _例_: `true`
1024
- - _注意_: 有効にすると、Intlayer は辞書のすべての呼び出しを置き換えてチャンク分割を最適化します。これにより、最終バンドルは使用されている辞書のみをインポートします。すべてのインポートは辞書の読み込み時の非同期処理を避けるために静的インポートのまま維持されます。
1025
- - _注意_: Intlayerは、`useIntlayer`のすべての呼び出しを`importMode`オプションで定義されたモードに置き換え、`getIntlayer`を`getDictionary`に置き換えます。
1026
- - _注意_: このオプションは`@intlayer/babel`および`@intlayer/swc`プラグインに依存しています。
1027
- - _注意_: `useIntlayer`の呼び出し内で、すべてのキーが静的に宣言されていることを確認してください。例: `useIntlayer('navbar')`。
1028
-
1029
- - **outputFormat**:
1030
- - _型_: `'esm' | 'cjs'`
1031
- - _デフォルト_: `'esm'`
1032
- - _説明_: 辞書の出力形式を制御します。
1033
- - _例_: `'cjs'`
1034
- - _注意_: 辞書の出力形式。
1035
-
1036
- - **traversePattern**:
1037
- - _型_: `string[]`
1038
- - _デフォルト_: `['**/*.{js,ts,mjs,cjs,jsx,tsx}', '!**/node_modules/**']`
1039
- - _説明_: 最適化中にどのファイルを走査するかを定義するパターンです。
1040
- - _例_: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**/node_modules/**']`
1041
- - _注意_: 最適化を関連するコードファイルに限定し、ビルドパフォーマンスを向上させるために使用します。
1042
- - _注意_: `optimize` が無効の場合、このオプションは無視されます。
1043
- - _注意_: グロブパターンを使用してください。
856
+ ### ビルド設定 (Build Configuration)
857
+
858
+ Intlayer のビルドプロセスと最適化に関する設定。
859
+
860
+ | フィールド | 型 | 説明 | 例 | 備考 |
861
+ | -------------- | ------------------------ | ---------------------------------------------------------------------------------------------------- | --- | ---- |
862
+ | `mode` | `'auto' &#124; 'manual'` | アプリのプリビルドステップ中に Intlayer を自動的に実行するかどうかを指定します。デフォルト: `'auto'` | | |
863
+ | `optimize` | `boolean` | コンパイルされた辞書を実行時用に最適化するかどうかを指定します。デフォルト: 本番環境では `true` | | |
864
+ | `outputFormat` | `('cjs' &#124; 'esm')[]` | 生成された辞書ファイルの出力形式。デフォルト: `['cjs', 'esm']` | | |
865
+ | `checkTypes` | `boolean` | Intlayer が生成されたファイルの型をチェックするかどうかを指定します。デフォルト: `false` | | |
1044
866
 
1045
867
  ---
1046
868
 
1047
- ### コンパイラ設定
1048
-
1049
- コンポーネントから直接辞書を抽出する Intlayer コンパイラを制御する設定。
1050
-
1051
- #### プロパティ
1052
-
1053
- - **enabled**:
1054
- - _型_: `boolean | 'build-only'`
1055
- - _デフォルト_: `true`
1056
- - _説明_: 辞書を抽出するためにコンパイラを有効にするかどうかを示します。
1057
- - _例_: `'build-only'`
1058
- - _注意_: `'build-only'` に設定すると、開発モード中にコンパイラをスキップして起動時間を短縮します。ビルドコマンドでのみ実行されます。
1059
-
1060
- - **dictionaryKeyPrefix**:
1061
- - _型_: `string`
1062
- - _デフォルト_: `''`
1063
- - _説明_: 抽出された辞書キーのプレフィックス。
1064
- - _例_: `'my-key-'`
1065
- - _注意_: 辞書が抽出される際、キーはファイル名に基づいて生成されます。このプレフィックスは、競合を防ぐために生成されたキーに追加されます。
1066
-
1067
- - **saveComponents**:
1068
- - _型_: `boolean`
1069
- - _デフォルト_: `false`
1070
- - _説明_: 変換後にコンポーネントを保存するかどうかを示します。
1071
- - _注意_: true の場合、コンパイラは元のファイルを変換後のファイルで置き換えます。これにより、コンパイラを一度だけ実行してアプリケーションを変換し、その後コンパイラを削除することができます。
1072
-
1073
- - **transformPattern**:
1074
- - _型_: `string | string[]`
1075
- - _デフォルト_: `['**/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}', '!**/node_modules/**']`
1076
- - _説明_: 最適化中に走査されるファイルを定義するパターン。
1077
- - _例_: `['src/**/*.{ts,tsx}', '!**/node_modules/**']`
1078
- - _注意_: 最適化を関連するコードファイルに限定し、ビルドパフォーマンスを向上させるために使用します。
1079
-
1080
- - **excludePattern**:
1081
- - __: `string | string[]`
1082
- - _デフォルト_: `['**/node_modules/**']`
1083
- - _説明_: 最適化中に除外されるファイルを定義するパターン。
1084
- - _例_: `['**/node_modules/**', '!**/node_modules/react/**']`
1085
-
1086
- - **output**:
1087
- - _型_: `FilePathPattern`
1088
- - _デフォルト_: `undefined`
1089
- - _説明_: 出力ファイルのパスを定義します。 `outputDir` を置き換えます。 文字列テンプレートまたは関数を通じて動的変数をサポートします。 サポートされている変数: `{{fileName}}`, `{{key}}`, `{{locale}}`, `{{extension}}`, `{{componentFileName}}`, `{{componentExtension}}`, `{{format}}`, `{{componentFormat}}`, および `{{componentDirPath}}`。
1090
- - _注_: `./` で始まるパスは、コンポーネントディレクトリを基準に解決されます。 `/` で始まるパスは、プロジェクトのルート (`baseDir`) を基準に解決されます。
1091
- - _注_: パスに `{{locale}}` 変数を含めると、ロケールごとに分離された辞書の生成が有効になります。
1092
- - _例_:
1093
- - **コンポーネントの隣に多言語ファイルを作成**:
1094
- - 文字列: `'./{{fileName}}{{extension}}'`
1095
- - 関数: `({ fileName, extension }) => \`./${fileName}${extension}\``
1096
-
1097
- - **ロケールごとに集約された JSON を出力**:
1098
- - 文字列: `'/locales/{{locale}}/{{key}}.content.json'`
1099
- - 関数: `({ key, locale }) => \`/locales/${locale}/${key}.content.json\``
1100
-
1101
- - **noMetadata**:
1102
- - _タイプ_: `boolean`
1103
- - _デフォルト_: `false`
1104
- - _説明_: メタデータをファイルに保存するかどうかを示します。trueの場合、コンパイラーは辞書のメタデータ(キー、コンテンツラッパー)を保存しません。
1105
- - _注_: `loadJSON`プラグインを使用する場合に便利です。ロケールごとの i18next または ICU MessageFormat JSON 出力に有用です。
1106
- - _例_:
1107
- `true`の場合:
1108
- ```json
1109
- {
1110
- "key": "value"
1111
- }
1112
- ```
1113
- `false`の場合:
1114
- ```json
1115
- {
1116
- "key": "value",
1117
- "content": {
1118
- "key": "value"
1119
- }
1120
- }
1121
- ```
869
+ ### システム設定 (System Configuration)
870
+
871
+ これらは高度なユースケースおよび Intlayer の内部構成用の設定です。
872
+
873
+ | フィールド | 型 | 説明 | デフォルト |
874
+ | ------------------------- | -------- | -------------------------------------------- | --------------------------------- |
875
+ | `dictionariesDir` | `string` | コンパイルされた辞書のディレクトリ。 | `'.intlayer/dictionary'` |
876
+ | `moduleAugmentationDir` | `string` | TypeScript モジュール拡張ディレクトリ。 | `'.intlayer/types'` |
877
+ | `unmergedDictionariesDir` | `string` | マージされていない辞書のディレクトリ。 | `'.intlayer/unmerged_dictionary'` |
878
+ | `typesDir` | `string` | 生成された型のディレクトリ。 | `'.intlayer/types'` |
879
+ | `mainDir` | `string` | メインの Intlayer ファイルディレクトリ。 | `'.intlayer/main'` |
880
+ | `configDir` | `string` | コンパイルされた設定ファイルのディレクトリ。 | `'.intlayer/config'` |
881
+ | `cacheDir` | `string` | キャッシュファイルのディレクトリ。 | `'.intlayer/cache'` |
882
+
883
+ ---
884
+
885
+ ### コンパイラ設定 (Compiler Configuration)
886
+
887
+ Intlayer コンパイラ (`intlayer compiler`) の設定。
888
+
889
+ | フィールド | 型 | 説明 | デフォルト |
890
+ | --------------------- | ------------------------ | -------------------------------------------------------------------------------- | ---------- |
891
+ | `enabled` | `boolean` | コンパイラがアクティブかどうかを指定します。 | `false` |
892
+ | `output` | `string &#124; Function` | 抽出された辞書の出力パス。 | |
893
+ | `saveComponents` | `boolean` | オリジナルのソースファイルを変換後のバージョンで上書きするかどうかを指定します。 | `false` |
894
+ | `noMetadata` | `boolean` | `true` の場合、コンパイラは生成されたファイルにメタデータを含めません。 | `false` |
895
+ | `dictionaryKeyPrefix` | `string` | オプションの辞書キープレフィックス。 | `''` |
896
+
897
+ ---
898
+
899
+ ### ロガー設定 (Logger Configuration)
900
+
901
+ Intlayer のログ出力をカスタマイズするための設定。
902
+
903
+ | フィールド | | 説明 | デフォルト |
904
+ | ---------- | ---------------------------------------------- | -------------------------------- | -------------- |
905
+ | `mode` | `'default' &#124; 'verbose' &#124; 'disabled'` | ロギングモード。 | `'default'` |
906
+ | `prefix` | `string` | ログメッセージのプレフィックス。 | `'[intlayer]'` |
907
+
908
+ ---
909
+
910
+ ### カスタムスキーマ (Custom Schemas)
911
+
912
+ | フィールド | 型 | 説明 |
913
+ | ---------- | --------------------------- | ------------------------------------------------------- |
914
+ | `schemas` | `Record<string, ZodSchema>` | 辞書の構造を検証するための Zod スキーマを定義できます。 |
915
+
916
+ ---
917
+
918
+ ### プラグイン (Plugins)
919
+
920
+ | フィールド | 型 | 説明 |
921
+ | ---------- | ------------------ | ---------------------------------------- |
922
+ | `plugins` | `IntlayerPlugin[]` | 有効にする Intlayer プラグインのリスト。 |