@intlayer/docs 9.3.1 → 9.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/blog/ar/nextjs-multilingual-seo-comparison.md +10 -10
  2. package/blog/de/nextjs-multilingual-seo-comparison.md +9 -9
  3. package/blog/en/nextjs-multilingual-seo-comparison.md +10 -10
  4. package/blog/en-GB/nextjs-multilingual-seo-comparison.md +10 -10
  5. package/blog/es/nextjs-multilingual-seo-comparison.md +10 -10
  6. package/blog/fr/nextjs-multilingual-seo-comparison.md +10 -10
  7. package/blog/hi/nextjs-multilingual-seo-comparison.md +10 -10
  8. package/blog/id/nextjs-multilingual-seo-comparison.md +10 -10
  9. package/blog/it/nextjs-multilingual-seo-comparison.md +10 -10
  10. package/blog/ja/nextjs-multilingual-seo-comparison.md +9 -9
  11. package/blog/ko/nextjs-multilingual-seo-comparison.md +9 -9
  12. package/blog/pl/nextjs-multilingual-seo-comparison.md +10 -10
  13. package/blog/pt/nextjs-multilingual-seo-comparison.md +9 -9
  14. package/blog/ru/nextjs-multilingual-seo-comparison.md +9 -9
  15. package/blog/tr/nextjs-multilingual-seo-comparison.md +9 -9
  16. package/blog/uk/nextjs-multilingual-seo-comparison.md +10 -10
  17. package/blog/vi/nextjs-multilingual-seo-comparison.md +10 -10
  18. package/blog/zh/nextjs-multilingual-seo-comparison.md +10 -10
  19. package/dist/cjs/generated/docs.entry.cjs +20 -0
  20. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  21. package/dist/esm/generated/docs.entry.mjs +20 -0
  22. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  23. package/dist/types/generated/docs.entry.d.ts +1 -0
  24. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  25. package/docs/ar/bundle_optimization.md +1 -1
  26. package/docs/ar/configuration.md +32 -9
  27. package/docs/ar/dictionary/content_file.md +0 -22
  28. package/docs/ar/dictionary/function_fetching.md +23 -0
  29. package/docs/ar/eslint.md +336 -0
  30. package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +1 -1
  31. package/docs/bn/configuration.md +34 -9
  32. package/docs/bn/eslint.md +336 -0
  33. package/docs/cs/bundle_optimization.md +1 -1
  34. package/docs/cs/configuration.md +33 -9
  35. package/docs/cs/eslint.md +336 -0
  36. package/docs/de/bundle_optimization.md +1 -1
  37. package/docs/de/configuration.md +34 -9
  38. package/docs/de/dictionary/content_file.md +0 -22
  39. package/docs/de/dictionary/function_fetching.md +23 -0
  40. package/docs/de/eslint.md +336 -0
  41. package/docs/en/bundle_optimization.md +1 -1
  42. package/docs/en/configuration.md +34 -9
  43. package/docs/en/dictionary/content_file.md +0 -22
  44. package/docs/en/dictionary/function_fetching.md +23 -0
  45. package/docs/en/eslint.md +336 -0
  46. package/docs/en/packages/intlayer/getLocalizedPath.md +70 -19
  47. package/docs/en-GB/configuration.md +33 -9
  48. package/docs/en-GB/dictionary/content_file.md +0 -22
  49. package/docs/en-GB/dictionary/function_fetching.md +23 -0
  50. package/docs/en-GB/eslint.md +336 -0
  51. package/docs/en-GB/intlayer_with_create_react_app.md +32 -35
  52. package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +1 -1
  53. package/docs/es/bundle_optimization.md +1 -1
  54. package/docs/es/configuration.md +35 -9
  55. package/docs/es/dictionary/content_file.md +0 -22
  56. package/docs/es/dictionary/function_fetching.md +23 -0
  57. package/docs/es/eslint.md +336 -0
  58. package/docs/fr/bundle_optimization.md +1 -1
  59. package/docs/fr/configuration.md +35 -9
  60. package/docs/fr/dictionary/content_file.md +0 -22
  61. package/docs/fr/dictionary/function_fetching.md +23 -0
  62. package/docs/fr/eslint.md +336 -0
  63. package/docs/hi/configuration.md +35 -9
  64. package/docs/hi/dictionary/content_file.md +0 -22
  65. package/docs/hi/dictionary/function_fetching.md +23 -0
  66. package/docs/hi/eslint.md +336 -0
  67. package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +1 -1
  68. package/docs/hi/intlayer_with_vite+svelte.md +2 -2
  69. package/docs/id/configuration.md +35 -9
  70. package/docs/id/dictionary/content_file.md +0 -22
  71. package/docs/id/dictionary/function_fetching.md +23 -0
  72. package/docs/id/eslint.md +336 -0
  73. package/docs/it/bundle_optimization.md +1 -1
  74. package/docs/it/configuration.md +35 -9
  75. package/docs/it/dictionary/content_file.md +0 -22
  76. package/docs/it/dictionary/function_fetching.md +23 -0
  77. package/docs/it/eslint.md +336 -0
  78. package/docs/ja/configuration.md +30 -9
  79. package/docs/ja/dictionary/content_file.md +0 -22
  80. package/docs/ja/dictionary/function_fetching.md +23 -0
  81. package/docs/ja/eslint.md +336 -0
  82. package/docs/ja/intlayer_with_react_router_v7.md +1 -146
  83. package/docs/ja/intlayer_with_vite+react.md +5 -1
  84. package/docs/ko/configuration.md +31 -9
  85. package/docs/ko/dictionary/content_file.md +0 -22
  86. package/docs/ko/dictionary/function_fetching.md +23 -0
  87. package/docs/ko/eslint.md +336 -0
  88. package/docs/ko/intlayer_with_lynx+react.md +4 -0
  89. package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +1 -1
  90. package/docs/ko/intlayer_with_storybook.md +5 -5
  91. package/docs/nl/configuration.md +33 -9
  92. package/docs/nl/eslint.md +336 -0
  93. package/docs/pl/bundle_optimization.md +1 -1
  94. package/docs/pl/configuration.md +34 -9
  95. package/docs/pl/dictionary/content_file.md +0 -22
  96. package/docs/pl/dictionary/function_fetching.md +23 -0
  97. package/docs/pl/eslint.md +336 -0
  98. package/docs/pl/intlayer_with_astro.md +1 -114
  99. package/docs/pl/migration_from_i18next_to_intlayer.md +4 -0
  100. package/docs/pl/migration_from_next-i18next_to_intlayer.md +8 -4
  101. package/docs/pl/migration_from_next-intl_to_intlayer.md +11 -5
  102. package/docs/pl/migration_from_nuxtjs_i18n_to_intlayer.md +8 -4
  103. package/docs/pl/migration_from_react-i18next_to_intlayer.md +8 -4
  104. package/docs/pl/migration_from_vue-i18n_to_intlayer.md +4 -0
  105. package/docs/pt/bundle_optimization.md +1 -1
  106. package/docs/pt/configuration.md +34 -9
  107. package/docs/pt/dictionary/content_file.md +0 -22
  108. package/docs/pt/dictionary/function_fetching.md +23 -0
  109. package/docs/pt/eslint.md +336 -0
  110. package/docs/pt/intlayer_with_astro.md +1 -114
  111. package/docs/ru/bundle_optimization.md +1 -1
  112. package/docs/ru/configuration.md +34 -9
  113. package/docs/ru/dictionary/content_file.md +0 -22
  114. package/docs/ru/dictionary/function_fetching.md +23 -0
  115. package/docs/ru/eslint.md +336 -0
  116. package/docs/tr/bundle_optimization.md +1 -1
  117. package/docs/tr/configuration.md +33 -9
  118. package/docs/tr/dictionary/content_file.md +0 -22
  119. package/docs/tr/dictionary/function_fetching.md +23 -0
  120. package/docs/tr/eslint.md +336 -0
  121. package/docs/uk/configuration.md +35 -9
  122. package/docs/uk/dictionary/content_file.md +0 -22
  123. package/docs/uk/dictionary/function_fetching.md +23 -0
  124. package/docs/uk/eslint.md +336 -0
  125. package/docs/uk/packages/angular-intlayer/exports.md +2 -2
  126. package/docs/ur/configuration.md +35 -9
  127. package/docs/ur/eslint.md +336 -0
  128. package/docs/vi/bundle_optimization.md +1 -1
  129. package/docs/vi/configuration.md +33 -9
  130. package/docs/vi/dictionary/content_file.md +0 -22
  131. package/docs/vi/dictionary/function_fetching.md +23 -0
  132. package/docs/vi/eslint.md +336 -0
  133. package/docs/zh/bundle_optimization.md +1 -1
  134. package/docs/zh/configuration.md +29 -9
  135. package/docs/zh/dictionary/content_file.md +0 -22
  136. package/docs/zh/dictionary/function_fetching.md +23 -0
  137. package/docs/zh/eslint.md +336 -0
  138. package/docs/zh/intlayer_with_create_react_app.md +4 -0
  139. package/docs/zh/intlayer_with_lynx+react.md +4 -0
  140. package/docs/zh/intlayer_with_nextjs_14.md +0 -2
  141. package/docs/zh/intlayer_with_nextjs_15.md +0 -2
  142. package/docs/zh/intlayer_with_nextjs_page_router.md +0 -2
  143. package/docs/zh/intlayer_with_nuxt.md +1 -1
  144. package/docs/zh/intlayer_with_react_router_v7.md +4 -0
  145. package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +4 -0
  146. package/docs/zh/intlayer_with_solid_start.md +1 -1
  147. package/docs/zh/intlayer_with_vite+vue.md +0 -2
  148. package/docs/zh-TW/bundle_optimization.md +1 -1
  149. package/docs/zh-TW/eslint.md +336 -0
  150. package/package.json +7 -7
  151. package/src/generated/docs.entry.ts +20 -0
@@ -0,0 +1,336 @@
1
+ ---
2
+ createdAt: 2026-08-12
3
+ updatedAt: 2026-08-13
4
+ title: Plugin ESLint | Regole di lint per Intlayer
5
+ description: Rileva stringhe hardcoded, chiamate dinamiche che il compilatore Intlayer non può ottimizzare e contenuti di dizionario inutilizzati, con eslint-plugin-intlayer. Funziona con ESLint e oxlint, su React, Vue, Svelte, Angular e Astro.
6
+ keywords:
7
+ - Intlayer
8
+ - ESLint
9
+ - oxlint
10
+ - Linting
11
+ - i18n
12
+ - Internazionalizzazione
13
+ - no-raw-text
14
+ - Stringhe hardcoded
15
+ - Traduzioni inutilizzate
16
+ - Contenuto inutilizzato
17
+ - React
18
+ - Vue
19
+ - Svelte
20
+ - Angular
21
+ slugs:
22
+ - doc
23
+ - eslint
24
+ history:
25
+ - version: 9.3.1
26
+ date: 2026-08-12
27
+ changes: "Cronologia iniziale"
28
+ author: aymericzip
29
+ ---
30
+
31
+ # Plugin ESLint x OXLint
32
+
33
+ `eslint-plugin-intlayer` rileva i tipi di errori i18n che TypeScript non può individuare:
34
+
35
+ 1. **Testo hardcoded** che non è mai stato inserito in un dizionario.
36
+ 2. **Chiamate dinamiche** che superano il controllo dei tipi e vengono eseguite, ma che il compilatore Intlayer non può ottimizzare.
37
+ 3. **Contenuto inutilizzato (dead content)** — dizionari e campi che nessun elemento nel progetto legge (attivazione opzionale).
38
+
39
+ Le chiavi di dizionario sconosciute, i percorsi di campo sconosciuti e le impostazioni internazionali mancanti sono già errori di compilazione, quindi il plugin non li ripete.
40
+
41
+ ## Installazione
42
+
43
+ ```bash packageManager="npm"
44
+ npm install --save-dev eslint-plugin-intlayer
45
+ ```
46
+
47
+ ```bash packageManager="pnpm"
48
+ pnpm add --save-dev eslint-plugin-intlayer
49
+ ```
50
+
51
+ ```bash packageManager="yarn"
52
+ yarn add --dev eslint-plugin-intlayer
53
+ ```
54
+
55
+ Richiede ESLint 9 o versione successiva (flat config). ESLint 10 è supportato.
56
+
57
+ ## Utilizzo
58
+
59
+ Il plugin funziona sia in ESLint che in [oxlint](https://oxc.rs) — stesse regole, stesse opzioni.
60
+
61
+ <Tabs defaultTab="eslint">
62
+ <Tab label="ESLint" value="eslint">
63
+
64
+ ```javascript fileName="eslint.config.mjs"
65
+ import intlayer from "eslint-plugin-intlayer";
66
+
67
+ export default [...intlayer.configs.recommended];
68
+ ```
69
+
70
+ Oppure espandi una configurazione e imposta tu stesso le severità:
71
+
72
+ ```javascript fileName="eslint.config.mjs"
73
+ import intlayer from "eslint-plugin-intlayer";
74
+
75
+ export default [
76
+ ...intlayer.configs.recommended,
77
+ {
78
+ rules: {
79
+ "intlayer/no-raw-text": "warn",
80
+ "intlayer/static-dictionary-key": "error",
81
+ "intlayer/no-dynamic-field-access": "error",
82
+ "intlayer/enforce-adapter-import": "warn",
83
+ "intlayer/no-unused-content": "warn",
84
+ },
85
+ },
86
+ ];
87
+ ```
88
+
89
+ </Tab>
90
+ <Tab label="oxlint" value="oxlint">
91
+
92
+ ```json fileName=".oxlintrc.json"
93
+ {
94
+ "jsPlugins": ["eslint-plugin-intlayer"],
95
+ "rules": {
96
+ "intlayer/no-raw-text": "warn",
97
+ "intlayer/static-dictionary-key": "error",
98
+ "intlayer/no-dynamic-field-access": "error",
99
+ "intlayer/enforce-adapter-import": "warn"
100
+ }
101
+ }
102
+ ```
103
+
104
+ Due precisazioni: il supporto ai plugin JS in oxlint è ancora in versione alfa e oxlint non supporta parser personalizzati — quindi i file `.vue`, `.svelte`, `.astro` e i template Angular non vengono analizzati lì. Esegui oxlint sui tuoi file JS/TS/JSX e mantieni ESLint per il resto.
105
+
106
+ `no-unused-content` è intenzionalmente esclusa sopra: necessita della directory di lavoro e del percorso del file analizzato dal contesto della regola, cosa che il bridge alfa del plugin JS non garantisce. Eseguila sotto ESLint.
107
+
108
+ </Tab>
109
+ </Tabs>
110
+
111
+ ### Configurazioni
112
+
113
+ | Configurazione | `no-raw-text` | `static-dictionary-key` | `no-dynamic-field-access` | `enforce-adapter-import` | `no-unused-content` |
114
+ | --------------- | --------------------------------- | ----------------------- | ------------------------- | ------------------------ | ------------------- |
115
+ | `recommended` | warn | error | error | off | off |
116
+ | `strict` | error (+ letterali esterni a JSX) | error | error | error | off |
117
+ | `contract-only` | off | error | error | off | off |
118
+
119
+ `recommended` mantiene deliberatamente `no-raw-text` su `warn`: applicarla a una base di codice esistente fa emergere tutte le stringhe non tradotte contemporaneamente, il che non dovrebbe interrompere la build dal primo giorno.
120
+
121
+ `enforce-adapter-import` è disabilitata per impostazione predefinita — attivala esplicitamente se lo desideri.
122
+
123
+ `no-unused-content` è disattivata in ogni configurazione, inclusa `strict`. È l'unica regola che legge la configurazione di Intlayer ed esamina i file sorgente dal disco, pertanto la sua attivazione dovrebbe essere una scelta deliberata anziché un'impostazione predefinita.
124
+
125
+ ## Regole
126
+
127
+ ### `no-raw-text`
128
+
129
+ Segnala il testo rivolto all'utente che non è dichiarato in un dizionario. Utilizza lo stesso rilevamento di `intlayer extract`, pertanto i nomi di brand, le classi CSS e gli identificatori tecnici vengono ignorati.
130
+
131
+ ```jsx
132
+ // ✗ Segnalato
133
+ <h1>Welcome to our documentation</h1>
134
+ <input placeholder="Enter your email address" />
135
+
136
+ // ✓ Corretto
137
+ const { title } = useIntlayer("home");
138
+ <h1>{title}</h1>
139
+ ```
140
+
141
+ I file di dichiarazione del contenuto (`*.content.ts`, …) vengono ignorati.
142
+
143
+ Per correggere un intero file in una volta, esegui `npx intlayer extract` e lascia che il compilatore sposti le stringhe in un dizionario al posto tuo.
144
+
145
+ **Opzioni**
146
+
147
+ ```javascript fileName="eslint.config.mjs"
148
+ {
149
+ "intlayer/no-raw-text": [
150
+ "warn",
151
+ {
152
+ // Attributi il cui valore è testo rivolto all'utente.
153
+ // Predefinito: title, placeholder, alt, aria-label, label
154
+ attributes: ["title", "placeholder", "alt", "aria-label", "label"],
155
+
156
+ // Elementi il cui contenuto non è mai testo rivolto all'utente.
157
+ // Predefinito: code, pre, script, style
158
+ ignoreElements: ["code", "pre", "script", "style"],
159
+
160
+ // Espressioni regolari per il testo da non segnalare mai.
161
+ ignorePatterns: ["^Powered by"],
162
+
163
+ // Segnala anche i letterali di stringa fuori dal markup. Predefinito: false
164
+ includeStringLiterals: false,
165
+ },
166
+ ],
167
+ }
168
+ ```
169
+
170
+ ### `static-dictionary-key`
171
+
172
+ Richiede che la chiave del dizionario sia un valore letterale stringa.
173
+
174
+ Il compilatore può precaricare un dizionario solo quando può leggere la chiave direttamente nel punto di chiamata. Con una chiave calcolata, salta silenziosamente l'ottimizzazione e include invece tutti i dizionari nel bundle.
175
+
176
+ ```typescript
177
+ // ✗ Segnalato
178
+ useIntlayer(dictionaryKey);
179
+ useIntlayer(`home-${suffix}`);
180
+ getTranslations({ namespace: page });
181
+
182
+ // ✗ Una variabile non è un letterale
183
+ const key = "home";
184
+ useIntlayer(key);
185
+
186
+ // ✓ Corretto
187
+ useIntlayer("home");
188
+ getTranslations({ namespace: "home" });
189
+ ```
190
+
191
+ Questo vale per `useIntlayer`, `getIntlayer` e tutti gli adattatori di compatibilità (`useTranslation`, `useTranslations`, `formatMessage`, `<FormattedMessage id>`, `<Trans i18nKey>`, …).
192
+
193
+ ### `no-dynamic-field-access`
194
+
195
+ Richiede che il campo letto da un dizionario sia noto staticamente.
196
+
197
+ Il compilatore rimuove i campi che non vede utilizzati. Un accesso dinamico è invisibile per esso, quindi la lettura potrebbe restituire `undefined` a runtime.
198
+
199
+ ```typescript
200
+ // ✗ Segnalato
201
+ const content = useIntlayer("home");
202
+ content[fieldName];
203
+
204
+ const t = useTranslations("home");
205
+ t(messageKey);
206
+
207
+ // ✓ Corretto
208
+ content.title;
209
+ content["title"];
210
+ content.items[0];
211
+ t("hero.title");
212
+ ```
213
+
214
+ ### `enforce-adapter-import`
215
+
216
+ Preferisce l'adattatore di compatibilità `@intlayer/*` rispetto al pacchetto originale. Il pacchetto originale si risolve in Intlayer solo quando è configurato l'alias del bundler; l'adattatore lo fa sempre. Corregibile automaticamente con `--fix`.
217
+
218
+ ```typescript
219
+ // ✗ Segnalato
220
+ import { useTranslation } from "react-i18next";
221
+ import { getTranslations } from "next-intl/server";
222
+
223
+ // ✓ Corretto
224
+ import { useTranslation } from "@intlayer/react-i18next";
225
+ import { getTranslations } from "@intlayer/next-intl/server";
226
+ ```
227
+
228
+ ### `no-unused-content`
229
+
230
+ **Disattivata per impostazione predefinita.** Segnala i contenuti che nessun elemento nel progetto legge, oltre alle chiavi di dizionario dichiarate in più punti.
231
+
232
+ ```typescript fileName="src/home.content.ts"
233
+ export default {
234
+ key: "home", // ✗ Segnalato se nessun chiamante nel progetto richiede "home"
235
+ content: {
236
+ title: t({ it: "Titolo", en: "Title" }),
237
+
238
+ // ✗ Segnalato se nulla legge `hero`
239
+ hero: {
240
+ subtitle: t({ it: "Sottotitolo", en: "Subtitle" }),
241
+ },
242
+ },
243
+ };
244
+ ```
245
+
246
+ A differenza delle altre regole, questa non può rispondere solo dal file analizzato: un campo è inutilizzato solo rispetto all'intero progetto. Alla prima dichiarazione di contenuto di un'esecuzione di lint, carica la configurazione di Intlayer, analizza i file sorgente dichiarati da tale configurazione (`build.traversePattern`, `compiler.transformPattern`) ed esegue lo stesso analizzatore di utilizzo che alimenta `@intlayer/lsp` e il testo barrato "inutilizzato" nell'estensione VS Code. Il risultato viene memorizzato nella cache per `cacheTtl` millisecondi, pertanto la scansione avviene una volta per esecuzione anziché una volta per file.
247
+
248
+ **Opzioni**
249
+
250
+ ```javascript fileName="eslint.config.mjs"
251
+ {
252
+ "intlayer/no-unused-content": [
253
+ "warn",
254
+ {
255
+ // Segnala le chiavi di dizionario a cui nulla fa riferimento. Predefinito: true
256
+ reportUnusedDictionaries: true,
257
+
258
+ // Segnala i campi di contenuto che nulla legge. Predefinito: true
259
+ reportUnusedFields: true,
260
+
261
+ // Segnala le chiavi dichiarate in più posizioni. Predefinito: true
262
+ reportDuplicateKeys: true,
263
+
264
+ // Espressioni regolari per i percorsi di campo da non segnalare mai.
265
+ ignoreFields: ["^meta"],
266
+
267
+ // Directory radice del progetto da cui parte la scansione. Predefinito: directory di lavoro di ESLint
268
+ baseDir: process.cwd(),
269
+
270
+ // Durata del riutilizzo di una scansione del progetto, in ms. Predefinito: 30000
271
+ cacheTtl: 30000,
272
+ },
273
+ ],
274
+ }
275
+ ```
276
+
277
+ Riduci `cacheTtl` quando esegui il lint da un server dell'editor a lunga durata e desideri che le modifiche vengano riflesse prima; imposta `baseDir` quando una singola esecuzione di lint comprende diversi progetti Intlayer in un monorepo.
278
+
279
+ > **Predilige il silenzio.** Un falso positivo in questo caso eliminerebbe una traduzione, pertanto non viene segnalato nulla quando il dizionario viene utilizzato in un modo che l'analisi non può tracciare: l'oggetto contenuto passato nel suo insieme, una funzione di traduzione associata ad esso (`const t = useTranslations("home")`), una dichiarazione raggiunta tramite un'importazione diretta (`useDictionary(myDictionary)`), un `nest()` da un altro dizionario o un elenco di campi reso non esaustivo da uno spread. I componenti a file singolo (`.vue`, `.svelte`, `.astro`) contano come utilizzatori di ogni campo dei dizionari che menzionano, poiché i loro blocchi di script non vengono analizzati qui.
280
+
281
+ `reportDuplicateKeys` legge i dizionari non uniti che la build scrive sotto `.intlayer/`, quindi rimane inattiva finché il progetto non è stato compilato almeno una volta. Due dichiarazioni che condividono una chiave vengono unite, il che è un modello valido: la segnalazione esiste perché un campo definito su entrambi i lati mantiene silenziosamente solo uno dei due valori.
282
+
283
+ L'analizzatore viene caricato da `@intlayer/lsp`, distribuito come modulo ESM. La regola necessita pertanto di una versione di Node in grado di eseguire `require()` su un modulo ES — Node 20.19+ o 22.12+. Con versioni precedenti, non segnala nulla anziché interrompere l'esecuzione del lint.
284
+
285
+ ## Frameworks
286
+
287
+ Tutte le regole funzionano su tutte le integrazioni Intlayer, compresi i template Vue, Svelte e Angular. Devi solo indicare a ESLint quale parser legge ciascun tipo di file.
288
+
289
+ | Framework | File | Parser |
290
+ | ------------------------- | ----------------- | --------------------------------- |
291
+ | React, Preact, Solid, Lit | `.jsx` `.tsx` | `typescript-eslint` |
292
+ | Next.js | `.jsx` `.tsx` | `typescript-eslint` |
293
+ | Vue, Nuxt | `.vue` | `vue-eslint-parser` |
294
+ | Svelte, SvelteKit | `.svelte` | `svelte-eslint-parser` |
295
+ | Angular | `.ts` | `typescript-eslint` |
296
+ | Template Angular | `.component.html` | `@angular-eslint/template-parser` |
297
+ | Astro | `.astro` | `astro-eslint-parser` |
298
+
299
+ ```javascript fileName="eslint.config.mjs"
300
+ import intlayer from "eslint-plugin-intlayer";
301
+ import tseslint from "typescript-eslint";
302
+ import vueParser from "vue-eslint-parser";
303
+ import svelteParser from "svelte-eslint-parser";
304
+ import angularTemplateParser from "@angular-eslint/template-parser";
305
+
306
+ export default [
307
+ ...intlayer.configs.recommended,
308
+
309
+ {
310
+ files: ["**/*.{ts,tsx,jsx}"],
311
+ languageOptions: { parser: tseslint.parser },
312
+ },
313
+ {
314
+ files: ["**/*.vue"],
315
+ languageOptions: {
316
+ parser: vueParser,
317
+ parserOptions: { parser: tseslint.parser },
318
+ },
319
+ },
320
+ {
321
+ files: ["**/*.svelte"],
322
+ languageOptions: {
323
+ parser: svelteParser,
324
+ parserOptions: { parser: tseslint.parser },
325
+ },
326
+ },
327
+ {
328
+ files: ["**/*.component.html"],
329
+ languageOptions: { parser: angularTemplateParser },
330
+ },
331
+ ];
332
+ ```
333
+
334
+ Installa solo i parser di cui il tuo progetto ha bisogno.
335
+
336
+ > **Limitazione nota.** Nei template Vue e Angular, un'espressione come `{{ content[key] }}` non viene verificata da `no-dynamic-field-access`. Le letture dinamiche scritte nel blocco script vengono invece rilevate normalmente.
@@ -478,6 +478,25 @@ const config: IntlayerConfig = {
478
478
  */
479
479
  purge: true,
480
480
 
481
+ /**
482
+ * ロケールごとの辞書チャンクを、それを使用するコード分割境界ごとにグループ化し、遅延読み込みされるページが 1
483
+ * 回のリクエストでコンテンツを取得できるようにします。
484
+ * デフォルト: true
485
+ *
486
+ * 注意点:
487
+ * - `importMode: 'dynamic'` を使用する辞書にのみ適用されます。
488
+ */
489
+ chunkGrouping: true,
490
+
491
+ /**
492
+ * チャンクがレンダリングされてから取得するのではなく、そのチャンクを使用する辞書を一緒に読み込みます。読み取りはサスペンドせず同期的にレンダリングされるため、ナビゲーション時にローディング状態がちらつかなくなります。
493
+ * デフォルト: true
494
+ *
495
+ * 注意点:
496
+ * - 解決されたロケールのみを待つため、ページは表示する言語だけをダウンロードします。
497
+ */
498
+ dictionariesPreload: true,
499
+
481
500
  /**
482
501
  * 生成された辞書ファイルの出力形式。
483
502
  * デフォルト: ['cjs', 'esm']
@@ -1054,15 +1073,17 @@ Intlayer がアプリケーションの国際化をどのように最適化お
1054
1073
 
1055
1074
  > 最適化中、Intlayer はチャンキングを最適化するために辞書の呼び出しを置き換え、最終的なバンドルが実際に使用される辞書のみをインポートするようにします。
1056
1075
 
1057
- | フィールド | 説明 | 型 | デフォルト | 例 | 備考 |
1058
- | ----------------- | -------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1059
- | `mode` | ビルドモードを制御します。 | `'auto'` &#124; <br/> `'manual'` | `'auto'` | `'manual'` | • `'auto'`: アプリのビルド中にビルドが自動的にトリガーされます。<br/>• `'manual'`: ビルドコマンドが明示的に呼び出されたときにのみ実行されます。<br/>• 辞書のビルドを無効にするためにも使用できます (例: Node.js 環境での実行を停止する場合)。 |
1060
- | `optimize` | ビルドの最適化を行うかどうかを制御します。 | `boolean` | `undefined` | `process.env.NODE_ENV === 'production'` | • 未定義の場合、フレームワークのビルド (Vite/Next.js) 時に最適化がトリガーされます。<br/>• `true` の場合、開発モードでも強制的に最適化を行います。<br/>• `false` の場合、無効化されます。<br/>• 有効な場合、チャンキングを最適化するために辞書の呼び出しを置き換えます。<br/>• `@intlayer/babel` および `@intlayer/swc` プラグインが必要。 |
1061
- | `minify` | バンドルサイズを削減するために辞書を圧縮(Minify)する。 | `boolean` | `false` | | • 最終的なバンドルを最小化するかどうかを指定します。<br/>• デフォルト:本番環境では `true`。<br/>• `optimize` が無効な場合、このオプションは無視されます。<br/>• `editor.enabled` が真の場合、このオプションは無視されます。 |
1062
- | `purge` | 辞書内の未使用のキーを削除(Purge)する。 | `boolean` | `false` | | • 最終的なバンドルをクリーンアップするかどうかを指定します。<br/>• デフォルト:本番環境では `true`。<br/>• `optimize` が無効な場合、このオプションは無視されます。 |
1063
- | `checkTypes` | ビルド時に TypeScript の型チェックを行い、エラーを記録するかどうかを指定します。 | `boolean` | `false` | | ビルドプロセスが遅くなる可能性があります。 |
1064
- | `outputFormat` | 辞書の出力形式を制御します。 | `('esm' &#124; 'cjs')[]` | `['esm', 'cjs']` | `['cjs']` | |
1065
- | `traversePattern` | 最適化中にスキャンするファイルを定義するパターン。 | `string[]` | `['**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}', '!**/node_modules/**', '!**/dist/**', '!**/.intlayer/**', '!**/*.config.*', '!**/*.test.*', '!**/*.spec.*', '!**/*.stories.*']` | `['src/**/*.{ts,tsx}', '../ui-library/**/*.{ts,tsx}', '!**/node_modules/**']` | • ビルドパフォーマンスを向上させるために、最適化対象を関連するファイルに限定します。<br/>• `optimize` がオフの場合は無視されます。<br/>• glob パターンを使用します。 |
1076
+ | フィールド | 説明 | 型 | デフォルト | 例 | 備考 |
1077
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1078
+ | `mode` | ビルドモードを制御します。 | `'auto'` &#124; <br/> `'manual'` | `'auto'` | `'manual'` | • `'auto'`: アプリのビルド中にビルドが自動的にトリガーされます。<br/>• `'manual'`: ビルドコマンドが明示的に呼び出されたときにのみ実行されます。<br/>• 辞書のビルドを無効にするためにも使用できます (例: Node.js 環境での実行を停止する場合)。 |
1079
+ | `optimize` | ビルドの最適化を行うかどうかを制御します。 | `boolean` | `undefined` | `process.env.NODE_ENV === 'production'` | • 未定義の場合、フレームワークのビルド (Vite/Next.js) 時に最適化がトリガーされます。<br/>• `true` の場合、開発モードでも強制的に最適化を行います。<br/>• `false` の場合、無効化されます。<br/>• 有効な場合、チャンキングを最適化するために辞書の呼び出しを置き換えます。<br/>• `@intlayer/babel` および `@intlayer/swc` プラグインが必要。 |
1080
+ | `minify` | バンドルサイズを削減するために辞書を圧縮(Minify)する。 | `boolean` | `false` | | • 最終的なバンドルを最小化するかどうかを指定します。<br/>• デフォルト:本番環境では `true`。<br/>• `optimize` が無効な場合、このオプションは無視されます。<br/>• `editor.enabled` が真の場合、このオプションは無視されます。 |
1081
+ | `purge` | 辞書内の未使用のキーを削除(Purge)する。 | `boolean` | `false` | | • 最終的なバンドルをクリーンアップするかどうかを指定します。<br/>• デフォルト:本番環境では `true`。<br/>• `optimize` が無効な場合、このオプションは無視されます。 |
1082
+ | `checkTypes` | ビルド時に TypeScript の型チェックを行い、エラーを記録するかどうかを指定します。 | `boolean` | `false` | | ビルドプロセスが遅くなる可能性があります。 |
1083
+ | `chunkGrouping` | ロケールごとの辞書チャンクを、それを使用するコード分割境界ごとにグループ化するかどうかを指定します。 | `boolean` | `true` | | • グループ化しない場合、多数のコンポーネントで構成されるページは辞書ごとに 1 リクエストを発行します。<br/>• 複数の境界から到達する辞書は共有チャンクに移動するため、どのページも他ページのコンテンツを含みません。<br/>• `importMode: 'dynamic'` を使用する辞書にのみ適用されます。<br/>• クライアントビルドのみ、かつバンドル時のみ適用されます(開発時は対象外)。 |
1084
+ | `dictionariesPreload` | 辞書を、そのチャンクがレンダリングされてから取得するのではなく、使用するチャンクと一緒に読み込むかどうかを指定します。 | `boolean` | `true` | | 生成されたエントリポイントはトップレベルで閲覧ロケールを待つため、遅延読み込みされるルートはコンテンツが揃うまで読み込み完了とみなされません。<br/>• 読み取りはサスペンドせず同期的にレンダリングされるため、ナビゲーション時にローディング状態がちらつかなくなります。<br/>• 解決されたロケールのみを待つため、ページは表示する言語だけをダウンロードします。<br/>• クライアントビルドで `importMode: 'dynamic'` を使用する辞書にのみ適用されます。<br/>• トップレベル await をサポートするバンドラー(Vite、esbuild)が必要です。 |
1085
+ | `outputFormat` | 辞書の出力形式を制御します。 | `('esm' &#124; 'cjs')[]` | `['esm', 'cjs']` | `['cjs']` | |
1086
+ | `traversePattern` | 最適化中にスキャンするファイルを定義するパターン。 | `string[]` | `['**/*.{tsx,ts,js,mjs,cjs,jsx,vue,svelte,svte}', '!**/node_modules/**', '!**/dist/**', '!**/.intlayer/**', '!**/*.config.*', '!**/*.test.*', '!**/*.spec.*', '!**/*.stories.*']` | `['src/**/*.{ts,tsx}', '../ui-library/**/*.{ts,tsx}', '!**/node_modules/**']` | • ビルドパフォーマンスを向上させるために、最適化対象を関連するファイルに限定します。<br/>• `optimize` がオフの場合は無視されます。<br/>• glob パターンを使用します。 |
1066
1087
 
1067
1088
  ---
1068
1089
 
@@ -533,28 +533,6 @@ export default aboutPageMetaContent;
533
533
 
534
534
  > 詳細については、[バリアント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/variants.md)を参照してください。
535
535
 
536
- #### `meta` (`Record<string, string | number | boolean>`)
537
-
538
- 動的レコード(Dynamic Records)と組み合わせて使用されるこのフィールドは、CMSで管理されるレコードや、不透明なIDを使用して実行時に取得される任意のデータを宣言することを可能にします。辞書の同一性は、この`meta`フィールドで宣言されたキーと値の任意の組み合わせによって定義されます。
539
-
540
- **例:**
541
-
542
- ```typescript
543
- {
544
- key: "product-copy",
545
- meta: {
546
- id: "prod_abc",
547
- userId: "user_123"
548
- },
549
- content: {
550
- name: "Widget Pro",
551
- description: "The best widget."
552
- }
553
- }
554
- ```
555
-
556
- > 詳細については、[動的レコード](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dynamic_dictionaries/dynamic_content.md)を参照してください。
557
-
558
536
  ### CMSプロパティ
559
537
 
560
538
  ##### `version` (string)
@@ -89,6 +89,29 @@ JSONファイルからコンテンツを取得する方法はありません。
89
89
 
90
90
  この場合、`fakeFetch` 関数はサーバーの応答時間をシミュレートするために遅延を模倣しています。Intlayer は非同期関数を実行し、その結果を `text` キーのコンテンツとして使用します。
91
91
 
92
+ ## リモートコンテンツの取得
93
+
94
+ コンテンツのフィールドに Promise を直接指定することもできます。Intlayer は辞書のビルド時にその Promise を待機し、解決された値を埋め込みます:
95
+
96
+ ```typescript fileName="**/*.content.ts" contentDeclarationFormat={["typescript", "esm", "commonjs"]}
97
+ import type { Dictionary } from "intlayer";
98
+
99
+ const remoteContent = {
100
+ key: "remote_content",
101
+ content: {
102
+ externalContent: fetch("https://example.com").then((res) => res.json()),
103
+ },
104
+ } satisfies Dictionary;
105
+
106
+ export default remoteContent;
107
+ ```
108
+
109
+ ```plaintext fileName="**/*.content.json" contentDeclarationFormat="json"
110
+ JSONファイルからコンテンツを取得する方法はありません。代わりに.tsまたは.jsファイルを使用してください
111
+ ```
112
+
113
+ > リクエストはビルド時に実行されるため、取得したデータは辞書に埋め込まれたスナップショットです。更新するには辞書を再ビルドしてください。
114
+
92
115
  ## Reactコンポーネントで関数ベースのコンテンツを使用する
93
116
 
94
117
  Reactコンポーネントで関数ベースのコンテンツを使用するには、`react-intlayer`から`useIntlayer`をインポートし、コンテンツIDを渡してコンテンツを取得します。以下は例です: