@intlayer/docs 8.4.6 → 8.4.7
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/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +1 -3
- package/docs/en/configuration.md +115 -137
- package/docs/es/configuration.md +14 -6
- package/docs/fr/configuration.md +14 -6
- package/package.json +6 -6
- package/docs/ar/configuration.md +0 -922
- package/docs/bn/configuration.md +0 -922
- package/docs/de/configuration.md +0 -922
- package/docs/en-GB/configuration.md +0 -922
- package/docs/hi/configuration.md +0 -922
- package/docs/id/configuration.md +0 -922
- package/docs/it/configuration.md +0 -923
- package/docs/ja/configuration.md +0 -922
- package/docs/ko/configuration.md +0 -922
- package/docs/pl/configuration.md +0 -922
- package/docs/pt/configuration.md +0 -922
- package/docs/ru/configuration.md +0 -943
- package/docs/tr/configuration.md +0 -922
- package/docs/uk/configuration.md +0 -922
- package/docs/ur/configuration.md +0 -922
- package/docs/vi/configuration.md +0 -922
- package/docs/zh/configuration.md +0 -922
package/docs/ja/configuration.md
DELETED
|
@@ -1,922 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
createdAt: 2024-08-13
|
|
3
|
-
updatedAt: 2026-03-20
|
|
4
|
-
title: 設定 (Configuration)
|
|
5
|
-
description: アプリケーションにIntlayerを設定する方法を学びます。ニーズに合わせてIntlayerをカスタマイズするためのさまざまな設定とオプションを理解してください。
|
|
6
|
-
keywords:
|
|
7
|
-
- 設定
|
|
8
|
-
- セッティング
|
|
9
|
-
- カスタマイズ
|
|
10
|
-
- Intlayer
|
|
11
|
-
- オプション
|
|
12
|
-
slugs:
|
|
13
|
-
- doc
|
|
14
|
-
- concept
|
|
15
|
-
- configuration
|
|
16
|
-
history:
|
|
17
|
-
- version: 8.4.0
|
|
18
|
-
date: 2026-03-20
|
|
19
|
-
changes: 'compiler.output' と 'dictionary.fill' に対するロケールごとのオブジェクト表記を追加
|
|
20
|
-
- version: 8.3.0
|
|
21
|
-
date: 2026-03-11
|
|
22
|
-
changes: 'baseDir' を 'content' 設定から 'system' 設定に移動
|
|
23
|
-
- version: 8.2.0
|
|
24
|
-
date: 2026-03-09
|
|
25
|
-
changes: コンパイラオプションを更新し、'output' と 'noMetadata' のサポートを追加
|
|
26
|
-
- version: 8.1.7
|
|
27
|
-
date: 2026-02-25
|
|
28
|
-
changes: コンパイラオプションを更新
|
|
29
|
-
- version: 8.1.5
|
|
30
|
-
date: 2026-02-23
|
|
31
|
-
changes: コンパイラオプション 'build-only' とディクショナリプレフィックスを追加
|
|
32
|
-
- version: 8.0.6
|
|
33
|
-
date: 2026-02-12
|
|
34
|
-
changes: Open Router, Alibaba, Amazon, Google Vertex Bedrock, Fireworks, Groq, Hugging Face, Together.ai プロバイダーのサポートを追加
|
|
35
|
-
- version: 8.0.5
|
|
36
|
-
date: 2026-02-06
|
|
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` 設定に移動。
|
|
44
|
-
- version: 8.0.0
|
|
45
|
-
date: 2026-01-22
|
|
46
|
-
changes: ルーティング設定に `rewrite` オプションを追加
|
|
47
|
-
- version: 8.0.0
|
|
48
|
-
date: 2026-01-18
|
|
49
|
-
changes: システム設定をコンテンツ設定から分離。内部パスを `system` プロパティに移動。コンテンツファイルとコード変換を分離するために `codeDir` を追加。
|
|
50
|
-
- version: 8.0.0
|
|
51
|
-
date: 2026-01-18
|
|
52
|
-
changes: ディクショナリオプション `location` と `schema` を追加
|
|
53
|
-
- version: 7.5.1
|
|
54
|
-
date: 2026-01-10
|
|
55
|
-
changes: JSON5 および JSONC ファイル形式のサポートを追加
|
|
56
|
-
- version: 7.5.0
|
|
57
|
-
date: 2025-12-17
|
|
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` オプションを追加
|
|
74
|
-
- version: 6.0.0
|
|
75
|
-
date: 2025-09-21
|
|
76
|
-
changes: `dictionaryOutput` フィールドと `i18nextResourcesDir` フィールドを削除
|
|
77
|
-
- version: 6.0.0
|
|
78
|
-
date: 2025-09-16
|
|
79
|
-
changes: `live` インポートモードを追加
|
|
80
|
-
- version: 6.0.0
|
|
81
|
-
date: 2025-09-04
|
|
82
|
-
changes: `hotReload` フィールドを `liveSync` に置き換え、`liveSyncPort` および `liveSyncURL` フィールドを追加
|
|
83
|
-
- version: 5.6.1
|
|
84
|
-
date: 2025-07-25
|
|
85
|
-
changes: `activateDynamicImport` を `importMode` オプションに置き換え
|
|
86
|
-
- version: 5.6.0
|
|
87
|
-
date: 2025-07-13
|
|
88
|
-
changes: デフォルトの contentDir を `['src']` から `['.']` に変更
|
|
89
|
-
- version: 5.5.11
|
|
90
|
-
date: 2025-06-29
|
|
91
|
-
changes: `docs` コマンドを追加
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
# Intlayer 設定ドキュメント
|
|
95
|
-
|
|
96
|
-
## 概要
|
|
97
|
-
|
|
98
|
-
Intlayer 設定ファイルを使用すると、国際化 (internationalization)、ミドルウェア、コンテンツ処理など、プラグインのさまざまな側面をカスタマイズできます。このドキュメントでは、設定内の各プロパティについて詳しく説明します。
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## 目次
|
|
103
|
-
|
|
104
|
-
<TOC/>
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
## サポートされている設定ファイル形式
|
|
109
|
-
|
|
110
|
-
Intlayer は、JSON、JS、MJS、TS などの設定ファイル形式を受け入れます。
|
|
111
|
-
|
|
112
|
-
- `intlayer.config.ts`
|
|
113
|
-
- `intlayer.config.js`
|
|
114
|
-
- `intlayer.config.json`
|
|
115
|
-
- `intlayer.config.json5`
|
|
116
|
-
- `intlayer.config.jsonc`
|
|
117
|
-
- `intlayer.config.cjs`
|
|
118
|
-
- `intlayer.config.mjs`
|
|
119
|
-
- `.intlayerrc`
|
|
120
|
-
|
|
121
|
-
---
|
|
122
|
-
|
|
123
|
-
## 設定ファイルの例
|
|
124
|
-
|
|
125
|
-
````typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
126
|
-
import { Locales, type IntlayerConfig } from "intlayer";
|
|
127
|
-
import { nextjsRewrite } from "intlayer/routing";
|
|
128
|
-
import { z } from "zod";
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* すべての利用可能なオプションを表示する Intlayer 設定ファイルの例。
|
|
132
|
-
*/
|
|
133
|
-
const config: IntlayerConfig = {
|
|
134
|
-
/**
|
|
135
|
-
* 国際化設定の構成。
|
|
136
|
-
*/
|
|
137
|
-
internationalization: {
|
|
138
|
-
/**
|
|
139
|
-
* アプリケーションでサポートされるロケール (locales) のリスト。
|
|
140
|
-
* デフォルト: [Locales.ENGLISH]
|
|
141
|
-
*/
|
|
142
|
-
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* 各辞書で定義する必要がある必須ロケールのリスト。
|
|
146
|
-
* 空の場合、`strict` モードではすべてのロケールが必須になります。
|
|
147
|
-
* デフォルト: []
|
|
148
|
-
*/
|
|
149
|
-
requiredLocales: [Locales.ENGLISH],
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* 国際化されたコンテンツの厳格さのレベル。
|
|
153
|
-
* - "strict": 宣言されたロケールが欠落しているか、未宣言の場合はエラー。
|
|
154
|
-
* - "inclusive": 宣言されたロケールが欠落している場合は警告。
|
|
155
|
-
* - "loose": 既存のロケールを受け入れる。
|
|
156
|
-
* デフォルト: "inclusive"
|
|
157
|
-
*/
|
|
158
|
-
strictMode: "inclusive",
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* リクエストされたロケールが見つからない場合にフォールバックとして使用されるデフォルトロケール。
|
|
162
|
-
* デフォルト: Locales.ENGLISH
|
|
163
|
-
*/
|
|
164
|
-
defaultLocale: Locales.ENGLISH,
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* 辞書操作とフォールバック動作を制御する設定。
|
|
169
|
-
*/
|
|
170
|
-
dictionary: {
|
|
171
|
-
/**
|
|
172
|
-
* 辞書のインポート方法を制御します。
|
|
173
|
-
* - "static": ビルド時に静的にインポート。
|
|
174
|
-
* - "dynamic": Suspense を使用して動的にインポート。
|
|
175
|
-
* - "fetch": Live Sync API を介して動的に取得。
|
|
176
|
-
* デフォルト: "static"
|
|
177
|
-
*/
|
|
178
|
-
importMode: "static",
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* AI を使用して欠落している翻訳を自動的に埋める戦略。
|
|
182
|
-
* ブール値または埋められたコンテンツを保存するためのパスパターンを指定できます。
|
|
183
|
-
* デフォルト: true
|
|
184
|
-
*/
|
|
185
|
-
fill: true,
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* 辞書ファイルの物理的な場所。
|
|
189
|
-
* - "local": ローカルファイルシステムに保存。
|
|
190
|
-
* - "remote": Intlayer CMS に保存。
|
|
191
|
-
* - "hybrid": ローカルと Intlayer CMS の両方に保存。
|
|
192
|
-
* - "plugin" (または任意のカスタム文字列): プラグインまたはカスタムソースによって提供。
|
|
193
|
-
* デフォルト: "local"
|
|
194
|
-
*/
|
|
195
|
-
location: "local",
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* コンテンツを自動的に変換するかどうか (例: Markdown から HTML)。
|
|
199
|
-
* デフォルト: false
|
|
200
|
-
*/
|
|
201
|
-
contentAutoTransformation: false,
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* ルーティングとミドルウェアの設定。
|
|
206
|
-
*/
|
|
207
|
-
routing: {
|
|
208
|
-
/**
|
|
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"
|
|
215
|
-
*/
|
|
216
|
-
mode: "prefix-no-default",
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* ユーザーが選択したロケールを保存する場所。
|
|
220
|
-
* オプション: 'cookie', 'localStorage', 'sessionStorage', 'header', またはこれらの配列。
|
|
221
|
-
* デフォルト: ['cookie', 'header']
|
|
222
|
-
*/
|
|
223
|
-
storage: ["cookie", "header"],
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* アプリケーション URL のベースパス。
|
|
227
|
-
* デフォルト: ""
|
|
228
|
-
*/
|
|
229
|
-
basePath: "",
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* ロケールごとの特定のパスに対するカスタム URL リライトルール。
|
|
233
|
-
*/
|
|
234
|
-
rewrite: nextjsRewrite({
|
|
235
|
-
"/[locale]/about": {
|
|
236
|
-
en: "/[locale]/about",
|
|
237
|
-
fr: "/[locale]/a-propos",
|
|
238
|
-
},
|
|
239
|
-
}),
|
|
240
|
-
},
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* コンテンツファイルの検索と処理に関する設定。
|
|
244
|
-
*/
|
|
245
|
-
content: {
|
|
246
|
-
/**
|
|
247
|
-
* 辞書をスキャンするためのファイル拡張子。
|
|
248
|
-
* デフォルト: ['.content.ts', '.content.js', '.content.json' など]
|
|
249
|
-
*/
|
|
250
|
-
fileExtensions: [".content.ts", ".content.js", ".content.json"],
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* .content ファイルが配置されているディレクトリ。
|
|
254
|
-
* デフォルト: ["."]
|
|
255
|
-
*/
|
|
256
|
-
contentDir: ["src"],
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* ソースコードが配置されている場所。
|
|
260
|
-
* ビルドの最適化とコード変換に使用されます。
|
|
261
|
-
* デフォルト: ["."]
|
|
262
|
-
*/
|
|
263
|
-
codeDir: ["src"],
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* スキャンから除外されるパターン。
|
|
267
|
-
* デフォルト: ['node_modules', '.intlayer' など]
|
|
268
|
-
*/
|
|
269
|
-
excludedPath: ["node_modules"],
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* 開発中に変更を監視し、辞書を再構築するかどうか。
|
|
273
|
-
* デフォルト: 開発中は true
|
|
274
|
-
*/
|
|
275
|
-
watch: true,
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* 新しく作成または更新された .content ファイルをフォーマットするために使用されるコマンド。
|
|
279
|
-
*/
|
|
280
|
-
formatCommand: 'npx prettier --write "{{file}}"',
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* ビジュアルエディターの設定。
|
|
285
|
-
*/
|
|
286
|
-
editor: {
|
|
287
|
-
/**
|
|
288
|
-
* ビジュアルエディターが有効かどうか。
|
|
289
|
-
* デフォルト: false
|
|
290
|
-
*/
|
|
291
|
-
enabled: true,
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* オリジン検証のためのアプリケーションの URL。
|
|
295
|
-
* デフォルト: ""
|
|
296
|
-
*/
|
|
297
|
-
applicationURL: "http://localhost:3000",
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* ローカルエディターサーバーのポート。
|
|
301
|
-
* デフォルト: 8000
|
|
302
|
-
*/
|
|
303
|
-
port: 8000,
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* エディターの公開 URL。
|
|
307
|
-
* デフォルト: "http://localhost:8000"
|
|
308
|
-
*/
|
|
309
|
-
editorURL: "http://localhost:8000",
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* Intlayer CMS の URL。
|
|
313
|
-
* デフォルト: "https://app.intlayer.org"
|
|
314
|
-
*/
|
|
315
|
-
cmsURL: "https://app.intlayer.org",
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* バックエンド API の URL。
|
|
319
|
-
* デフォルト: "https://back.intlayer.org"
|
|
320
|
-
*/
|
|
321
|
-
backendURL: "https://back.intlayer.org",
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* リアルタイムコンテンツ同期を有効にするかどうか。
|
|
325
|
-
* デフォルト: false
|
|
326
|
-
*/
|
|
327
|
-
liveSync: true,
|
|
328
|
-
},
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* AI ベースの翻訳および構築設定。
|
|
332
|
-
*/
|
|
333
|
-
ai: {
|
|
334
|
-
/**
|
|
335
|
-
* 使用する AI プロバイダー。
|
|
336
|
-
* オプション: 'openai', 'anthropic', 'mistral', 'deepseek', 'gemini', 'ollama', 'openrouter', 'alibaba', 'fireworks', 'groq', 'huggingface', 'bedrock', 'googlevertex', 'togetherai'
|
|
337
|
-
* デフォルト: 'openai'
|
|
338
|
-
*/
|
|
339
|
-
provider: "openai",
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* 使用する選択されたプロバイダーのモデル。
|
|
343
|
-
*/
|
|
344
|
-
model: "gpt-4o",
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* プロバイダーの API キー。
|
|
348
|
-
*/
|
|
349
|
-
apiKey: process.env.OPENAI_API_KEY,
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* 翻訳を生成する際に AI を導くためのグローバルコンテキスト。
|
|
353
|
-
*/
|
|
354
|
-
applicationContext: "これは旅行予約アプリケーションです。",
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* AI API のベース URL。
|
|
358
|
-
*/
|
|
359
|
-
baseURL: "http://localhost:3000",
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* データシリアル化 (Data Serialization)
|
|
363
|
-
*
|
|
364
|
-
* オプション:
|
|
365
|
-
* - "json": デフォルト、堅牢、より多くのトークンを消費します。
|
|
366
|
-
* - "toon": トークンの消費が少なく、JSON ほど一貫性がない場合があります。
|
|
367
|
-
*
|
|
368
|
-
* デフォルト: "json"
|
|
369
|
-
*/
|
|
370
|
-
dataSerialization: "json",
|
|
371
|
-
},
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* ビルドと最適化の設定。
|
|
375
|
-
*/
|
|
376
|
-
build: {
|
|
377
|
-
/**
|
|
378
|
-
* ビルド実行モード。
|
|
379
|
-
* - "auto": アプリケーションのビルド中に自動的にビルド。
|
|
380
|
-
* - "manual": 明示的なビルドコマンドが必要。
|
|
381
|
-
* デフォルト: "auto"
|
|
382
|
-
*/
|
|
383
|
-
mode: "auto",
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* 未使用の辞書を削除して、最終的なバンドルを最適化するかどうか。
|
|
387
|
-
* デフォルト: 本番環境では true
|
|
388
|
-
*/
|
|
389
|
-
optimize: true,
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* 生成された辞書ファイルの出力形式。
|
|
393
|
-
* デフォルト: ['cjs', 'esm']
|
|
394
|
-
*/
|
|
395
|
-
outputFormat: ["cjs", "esm"],
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* ビルドが TypeScript の型をチェックするかどうかを指定します。
|
|
399
|
-
* デフォルト: false
|
|
400
|
-
*/
|
|
401
|
-
checkTypes: false,
|
|
402
|
-
},
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* ロガー設定。
|
|
406
|
-
*/
|
|
407
|
-
log: {
|
|
408
|
-
/**
|
|
409
|
-
* ログレベル。
|
|
410
|
-
* - "default": 標準的なロギング。
|
|
411
|
-
* - "verbose": 詳細なデバッグロギング。
|
|
412
|
-
* - "disabled": ロギングを無効化。
|
|
413
|
-
* デフォルト: "default"
|
|
414
|
-
*/
|
|
415
|
-
mode: "default",
|
|
416
|
-
|
|
417
|
-
/**
|
|
418
|
-
* すべてのログメッセージのプレフィックス。
|
|
419
|
-
* デフォルト: "[intlayer]"
|
|
420
|
-
*/
|
|
421
|
-
prefix: "[intlayer]",
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* システム設定 (高度な使用向け)
|
|
426
|
-
*/
|
|
427
|
-
system: {
|
|
428
|
-
/**
|
|
429
|
-
* ローカライズされた辞書を保存するためのディレクトリ。
|
|
430
|
-
*/
|
|
431
|
-
dictionariesDir: ".intlayer/dictionary",
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* TypeScript モジュール拡張用のディレクトリ。
|
|
435
|
-
*/
|
|
436
|
-
moduleAugmentationDir: ".intlayer/types",
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* マージされていない辞書を保存するためのディレクトリ。
|
|
440
|
-
*/
|
|
441
|
-
unmergedDictionariesDir: ".intlayer/unmerged_dictionary",
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* 辞書の型を保存するためのディレクトリ。
|
|
445
|
-
*/
|
|
446
|
-
typesDir: ".intlayer/types",
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* メインアプリケーションファイルが保存されるディレクトリ。
|
|
450
|
-
*/
|
|
451
|
-
mainDir: ".intlayer/main",
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* 設定ファイルが保存されるディレクトリ。
|
|
455
|
-
*/
|
|
456
|
-
configDir: ".intlayer/config",
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* キャッシュファイルが保存されるディレクトリ。
|
|
460
|
-
*/
|
|
461
|
-
cacheDir: ".intlayer/cache",
|
|
462
|
-
},
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* コンパイラ設定 (高度な使用向け)
|
|
466
|
-
*/
|
|
467
|
-
compiler: {
|
|
468
|
-
/**
|
|
469
|
-
* コンパイラを有効にするかどうかを指定します。
|
|
470
|
-
*
|
|
471
|
-
* - false: コンパイラを無効にします。
|
|
472
|
-
* - true: コンパイラを有効にします。
|
|
473
|
-
* - "build-only": 開発中のコンパイラをスキップし、起動速度を上げます。
|
|
474
|
-
*
|
|
475
|
-
* デフォルト: false
|
|
476
|
-
*/
|
|
477
|
-
enabled: true,
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* 出力ファイルのパスを定義します。`outputDir` を置き換えます。
|
|
481
|
-
*
|
|
482
|
-
* - `./` パスはコンポーネントディレクトリを基準に解決されます。
|
|
483
|
-
* - `/` パスはプロジェクトルート (`baseDir`) を基準に解決されます。
|
|
484
|
-
*
|
|
485
|
-
* - パスに `{{locale}}` 変数を含めると、言語ごとに個別の辞書が作成されます。
|
|
486
|
-
*
|
|
487
|
-
* 例:
|
|
488
|
-
* ```ts
|
|
489
|
-
* {
|
|
490
|
-
* // コンポーネントの隣に多言語の .content.ts ファイルを作成
|
|
491
|
-
* output: ({ fileName, extension }) => `./${fileName}${extension}`,
|
|
492
|
-
*
|
|
493
|
-
* // output: './{{fileName}}{{extension}}', // テンプレート文字列を使用した同等の設定
|
|
494
|
-
* }
|
|
495
|
-
* ```
|
|
496
|
-
*
|
|
497
|
-
* ```ts
|
|
498
|
-
* {
|
|
499
|
-
* // プロジェクトルートに言語ごとの一元化された JSON を作成
|
|
500
|
-
* output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
|
|
501
|
-
*
|
|
502
|
-
* // output: '/locales/{{locale}}/{{key}}.content.json', // テンプレート文字列を使用した同等の設定
|
|
503
|
-
* }
|
|
504
|
-
* ```
|
|
505
|
-
*
|
|
506
|
-
* 変数リスト:
|
|
507
|
-
* - `fileName`: ファイル名。
|
|
508
|
-
* - `key`: コンテンツキー。
|
|
509
|
-
* - `locale`: コンテンツロケール。
|
|
510
|
-
* - `extension`: ファイル拡張子。
|
|
511
|
-
* - `componentFileName`: コンポーネントファイル名。
|
|
512
|
-
* - `componentExtension`: コンポーネントファイル拡張子。
|
|
513
|
-
* - `format`: 辞書形式。
|
|
514
|
-
* - `componentFormat`: コンポーネント辞書形式。
|
|
515
|
-
* - `componentDirPath`: コンポーネントディレクトリパス。
|
|
516
|
-
*/
|
|
517
|
-
output: ({ locale, key }) => `compiler/${locale}/${key}.json`,
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* コンポーネントを変換した後に保存するかどうか。
|
|
521
|
-
* これにより、アプリケーションを変換するためにコンパイラを一度だけ実行し、その後削除することができます。
|
|
522
|
-
*/
|
|
523
|
-
saveComponents: false,
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
* 生成されたファイルにコンテンツのみを挿入します。i18next または ICU MessageFormat 形式の言語ごとの JSON 出力に役立ちます。
|
|
527
|
-
*/
|
|
528
|
-
noMetadata: false,
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* 辞書キープレフィックス
|
|
532
|
-
*/
|
|
533
|
-
dictionaryKeyPrefix: "", // 抽出された辞書キーにオプションのプレフィックスを追加
|
|
534
|
-
},
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* 辞書コンテンツを検証するためのカスタムスキーマ。
|
|
538
|
-
*/
|
|
539
|
-
schemas: {
|
|
540
|
-
"my-schema": z.object({
|
|
541
|
-
title: z.string(),
|
|
542
|
-
}),
|
|
543
|
-
},
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* プラグイン設定。
|
|
547
|
-
*/
|
|
548
|
-
plugins: [],
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
export default config;
|
|
552
|
-
````
|
|
553
|
-
|
|
554
|
-
---
|
|
555
|
-
|
|
556
|
-
## 設定リファレンス
|
|
557
|
-
|
|
558
|
-
以下のセクションでは、Intlayer で利用可能なさまざまな設定項目について説明します。
|
|
559
|
-
|
|
560
|
-
---
|
|
561
|
-
|
|
562
|
-
### 国際化設定 (Internationalization Configuration)
|
|
563
|
-
|
|
564
|
-
利用可能なロケールやアプリケーションのデフォルトロケールなど、国際化に関する設定を定義します。
|
|
565
|
-
|
|
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、クッキー、またはヘッダーでロケールが指定されていない場合にロケールを決定するために使用されます。 |
|
|
572
|
-
|
|
573
|
-
---
|
|
574
|
-
|
|
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 | undefined` | oAuth2 を使用してバックエンドで認証できるようにします。アクセストークンを取得するには、[intlayer.org/project](https://app.intlayer.org/project) にアクセスしてください。デフォルト: `undefined` | | 秘密に保管し、環境変数に保存してください。 |
|
|
588
|
-
| `clientSecret` | `string | 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' | 'prefix-all' | 'no-prefix' | '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 | 'cookie' | 'localStorage' | 'sessionStorage' | 'header' | CookiesAttributes | StorageAttributes | 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' | 'lax' | 'none'` | SameSite ポリシー。 |
|
|
648
|
-
| `expires` | `Date | number` | 有効期限または日数。デフォルト: `undefined` |
|
|
649
|
-
|
|
650
|
-
#### ロケールストレージ属性 (Locale Storage Attributes)
|
|
651
|
-
|
|
652
|
-
localStorage または sessionStorage を使用する場合:
|
|
653
|
-
|
|
654
|
-
| フィールド | 型 | 説明 |
|
|
655
|
-
| ---------- | ---------------------------------------- | ----------------------------------------------------- |
|
|
656
|
-
| `type` | `'localStorage' | '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
|
-
```
|
|
791
|
-
|
|
792
|
-
---
|
|
793
|
-
|
|
794
|
-
### コンテンツ設定 (Content Configuration)
|
|
795
|
-
|
|
796
|
-
アプリケーション内でのコンテンツの処理に関する設定 (ディレクトリ名、ファイル拡張子、派生設定)。
|
|
797
|
-
|
|
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}}"'` | コンテンツ抽出時やビジュアルエディターを介して使用されます。 |
|
|
806
|
-
|
|
807
|
-
---
|
|
808
|
-
|
|
809
|
-
### 辞書設定 (Dictionary Configuration)
|
|
810
|
-
|
|
811
|
-
自動入力動作やコンテンツ生成など、辞書操作を制御する設定。
|
|
812
|
-
|
|
813
|
-
この辞書設定には、主に 2 つの目的があります:
|
|
814
|
-
|
|
815
|
-
1. **デフォルト値**: コンテンツ宣言ファイルを作成する際のデフォルト値を定義します。
|
|
816
|
-
2. **フォールバック動作**: 特定のフィールドが定義されていない場合にフォールバック値を提供し、辞書操作の動作をグローバルに定義できるようにします。
|
|
817
|
-
|
|
818
|
-
コンテンツ宣言ファイルと設定値の適用方法の詳細については、[コンテンツファイルのドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/content_file.md)を参照してください。
|
|
819
|
-
|
|
820
|
-
| フィールド | 型 | 説明 | 例 | 備考 |
|
|
821
|
-
| --------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
822
|
-
| `fill` | `boolean | FilePathPattern | Partial<Record<Locale, boolean | FilePathPattern>>` | 自動入力(AI 翻訳)出力ファイルの生成方法を制御します。デフォルト: `true` | 下記の例を参照 | `true`: デフォルトパス(ソースと同じファイル)。 `false`: 無効。文字列/関数テンプレートはロケールごとにファイルを生成します。ロケールごとのオブジェクト:各ロケールが独自のパターンにマップされます。 `false` はそのロケールをスキップします。 `{{locale}}` を含めると、ロケールごとの生成がトリガーされます。辞書レベルの `fill` は、常にこのグローバル設定よりも優先されます。 |
|
|
823
|
-
| `importMode` | `'static' | 'dynamic' | 'fetch'` | 辞書のインポート方法を制御します。デフォルト: `'static'` | `'dynamic'` | `'static'`: 静的にインポートされます。 `'dynamic'`: Suspense を使用して動的にインポートされます。 `'fetch'`: Live Sync API を介して動的に取得されます。 `getIntlayer`, `getDictionary`, `useDictionary` などには影響しません。 |
|
|
824
|
-
| `location` | `'local' | 'remote' | 'hybrid' | 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)
|
|
842
|
-
|
|
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' | 'toon'` | AI にデータを送信する方法を定義します。デフォルト: `'json'` | `'json'` | `'json'`: より堅牢で正確。 `'toon'`: トークンの消費は少ないですが、安定性に欠ける場合があります。 |
|
|
853
|
-
|
|
854
|
-
---
|
|
855
|
-
|
|
856
|
-
### ビルド設定 (Build Configuration)
|
|
857
|
-
|
|
858
|
-
Intlayer のビルドプロセスと最適化に関する設定。
|
|
859
|
-
|
|
860
|
-
| フィールド | 型 | 説明 | 例 | 備考 |
|
|
861
|
-
| -------------- | ------------------------ | ---------------------------------------------------------------------------------------------------- | --- | ---- |
|
|
862
|
-
| `mode` | `'auto' | 'manual'` | アプリのプリビルドステップ中に Intlayer を自動的に実行するかどうかを指定します。デフォルト: `'auto'` | | |
|
|
863
|
-
| `optimize` | `boolean` | コンパイルされた辞書を実行時用に最適化するかどうかを指定します。デフォルト: 本番環境では `true` | | |
|
|
864
|
-
| `outputFormat` | `('cjs' | 'esm')[]` | 生成された辞書ファイルの出力形式。デフォルト: `['cjs', 'esm']` | | |
|
|
865
|
-
| `checkTypes` | `boolean` | Intlayer が生成されたファイルの型をチェックするかどうかを指定します。デフォルト: `false` | | |
|
|
866
|
-
|
|
867
|
-
---
|
|
868
|
-
|
|
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 | 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' | 'verbose' | '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 プラグインのリスト。 |
|