@intlayer/docs 9.3.0 → 9.3.2

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 (217) hide show
  1. package/README.md +24 -24
  2. package/blog/ar/rag_powered_documentation_assistant.md +1 -1
  3. package/blog/pl/rag_powered_documentation_assistant.md +1 -1
  4. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
  5. package/dist/cjs/authors2.cjs +0 -1
  6. package/dist/cjs/common.cjs.map +1 -1
  7. package/dist/cjs/generated/blog.entry.cjs +4 -2
  8. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  9. package/dist/cjs/generated/docs.entry.cjs +24 -2
  10. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  11. package/dist/cjs/generated/frequentQuestions.entry.cjs +4 -2
  12. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  13. package/dist/cjs/generated/legal.entry.cjs +4 -2
  14. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  15. package/dist/esm/generated/blog.entry.mjs +4 -2
  16. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  17. package/dist/esm/generated/docs.entry.mjs +24 -2
  18. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  19. package/dist/esm/generated/frequentQuestions.entry.mjs +4 -2
  20. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  21. package/dist/esm/generated/legal.entry.mjs +4 -2
  22. package/dist/esm/generated/legal.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/configuration.md +10 -10
  26. package/docs/ar/eslint.md +336 -0
  27. package/docs/ar/interest_of_intlayer.md +24 -22
  28. package/docs/ar/intlayer_with_express.md +1 -1
  29. package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +1 -1
  30. package/docs/ar/intlayer_with_svelte_kit.md +1 -1
  31. package/docs/ar/intlayer_with_tanstack+solid.md +5 -3
  32. package/docs/ar/intlayer_with_tanstack.md +5 -3
  33. package/docs/ar/lsp.md +114 -175
  34. package/docs/ar/readme.md +25 -25
  35. package/docs/bn/configuration.md +10 -10
  36. package/docs/bn/eslint.md +336 -0
  37. package/docs/bn/interest_of_intlayer.md +24 -22
  38. package/docs/cs/configuration.md +10 -10
  39. package/docs/cs/eslint.md +336 -0
  40. package/docs/cs/interest_of_intlayer.md +24 -22
  41. package/docs/de/configuration.md +10 -10
  42. package/docs/de/eslint.md +336 -0
  43. package/docs/de/interest_of_intlayer.md +24 -22
  44. package/docs/de/intlayer_with_svelte_kit.md +1 -1
  45. package/docs/de/intlayer_with_tanstack+solid.md +5 -3
  46. package/docs/de/intlayer_with_tanstack.md +5 -3
  47. package/docs/de/lsp.md +111 -172
  48. package/docs/de/readme.md +24 -24
  49. package/docs/en/configuration.md +10 -10
  50. package/docs/en/eslint.md +336 -0
  51. package/docs/en/interest_of_intlayer.md +24 -22
  52. package/docs/en/intlayer_with_svelte_kit.md +1 -1
  53. package/docs/en/intlayer_with_tanstack+solid.md +5 -3
  54. package/docs/en/intlayer_with_tanstack.md +5 -3
  55. package/docs/en/lsp.md +109 -170
  56. package/docs/en/readme.md +24 -24
  57. package/docs/en-GB/configuration.md +10 -10
  58. package/docs/en-GB/eslint.md +336 -0
  59. package/docs/en-GB/interest_of_intlayer.md +24 -22
  60. package/docs/en-GB/intlayer_with_create_react_app.md +32 -35
  61. package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +1 -1
  62. package/docs/en-GB/intlayer_with_svelte_kit.md +1 -1
  63. package/docs/en-GB/intlayer_with_tanstack+solid.md +5 -3
  64. package/docs/en-GB/intlayer_with_tanstack.md +5 -3
  65. package/docs/en-GB/lsp.md +109 -170
  66. package/docs/en-GB/readme.md +24 -24
  67. package/docs/es/configuration.md +10 -10
  68. package/docs/es/eslint.md +336 -0
  69. package/docs/es/interest_of_intlayer.md +24 -22
  70. package/docs/es/intlayer_with_svelte_kit.md +1 -1
  71. package/docs/es/intlayer_with_tanstack+solid.md +5 -3
  72. package/docs/es/intlayer_with_tanstack.md +5 -3
  73. package/docs/es/lsp.md +114 -175
  74. package/docs/es/readme.md +24 -24
  75. package/docs/fr/configuration.md +10 -10
  76. package/docs/fr/eslint.md +336 -0
  77. package/docs/fr/interest_of_intlayer.md +24 -22
  78. package/docs/fr/intlayer_with_svelte_kit.md +1 -1
  79. package/docs/fr/intlayer_with_tanstack+solid.md +5 -3
  80. package/docs/fr/intlayer_with_tanstack.md +5 -3
  81. package/docs/fr/lsp.md +110 -171
  82. package/docs/fr/readme.md +24 -24
  83. package/docs/hi/configuration.md +10 -10
  84. package/docs/hi/eslint.md +336 -0
  85. package/docs/hi/interest_of_intlayer.md +24 -22
  86. package/docs/hi/intlayer_with_express.md +1 -1
  87. package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +1 -1
  88. package/docs/hi/intlayer_with_svelte_kit.md +1 -1
  89. package/docs/hi/intlayer_with_tanstack+solid.md +5 -3
  90. package/docs/hi/intlayer_with_tanstack.md +5 -3
  91. package/docs/hi/intlayer_with_vite+svelte.md +2 -2
  92. package/docs/hi/lsp.md +113 -174
  93. package/docs/hi/readme.md +24 -24
  94. package/docs/id/configuration.md +10 -10
  95. package/docs/id/eslint.md +336 -0
  96. package/docs/id/interest_of_intlayer.md +24 -22
  97. package/docs/id/intlayer_with_svelte_kit.md +1 -1
  98. package/docs/id/intlayer_with_tanstack+solid.md +5 -3
  99. package/docs/id/intlayer_with_tanstack.md +5 -3
  100. package/docs/id/lsp.md +113 -174
  101. package/docs/id/readme.md +24 -24
  102. package/docs/it/configuration.md +10 -10
  103. package/docs/it/eslint.md +336 -0
  104. package/docs/it/interest_of_intlayer.md +24 -22
  105. package/docs/it/intlayer_with_svelte_kit.md +1 -1
  106. package/docs/it/intlayer_with_tanstack+solid.md +5 -3
  107. package/docs/it/intlayer_with_tanstack.md +5 -3
  108. package/docs/it/lsp.md +115 -176
  109. package/docs/it/readme.md +24 -24
  110. package/docs/ja/configuration.md +10 -10
  111. package/docs/ja/eslint.md +336 -0
  112. package/docs/ja/interest_of_intlayer.md +24 -22
  113. package/docs/ja/intlayer_with_react_router_v7.md +1 -146
  114. package/docs/ja/intlayer_with_tanstack+solid.md +5 -3
  115. package/docs/ja/intlayer_with_tanstack.md +5 -3
  116. package/docs/ja/intlayer_with_vite+react.md +5 -1
  117. package/docs/ja/lsp.md +113 -174
  118. package/docs/ja/readme.md +24 -24
  119. package/docs/ko/configuration.md +10 -10
  120. package/docs/ko/eslint.md +336 -0
  121. package/docs/ko/interest_of_intlayer.md +24 -22
  122. package/docs/ko/intlayer_with_lynx+react.md +4 -0
  123. package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +1 -1
  124. package/docs/ko/intlayer_with_storybook.md +5 -5
  125. package/docs/ko/intlayer_with_svelte_kit.md +1 -1
  126. package/docs/ko/intlayer_with_tanstack+solid.md +5 -3
  127. package/docs/ko/intlayer_with_tanstack.md +5 -3
  128. package/docs/ko/lsp.md +112 -173
  129. package/docs/ko/readme.md +24 -24
  130. package/docs/nl/configuration.md +10 -10
  131. package/docs/nl/eslint.md +336 -0
  132. package/docs/nl/interest_of_intlayer.md +24 -22
  133. package/docs/pl/configuration.md +10 -10
  134. package/docs/pl/eslint.md +336 -0
  135. package/docs/pl/interest_of_intlayer.md +4 -2
  136. package/docs/pl/intlayer_with_astro.md +1 -114
  137. package/docs/pl/intlayer_with_svelte_kit.md +1 -1
  138. package/docs/pl/intlayer_with_tanstack+solid.md +5 -3
  139. package/docs/pl/intlayer_with_tanstack.md +5 -3
  140. package/docs/pl/lsp.md +115 -176
  141. package/docs/pl/migration_from_i18next_to_intlayer.md +4 -0
  142. package/docs/pl/migration_from_next-i18next_to_intlayer.md +8 -4
  143. package/docs/pl/migration_from_next-intl_to_intlayer.md +11 -5
  144. package/docs/pl/migration_from_nuxtjs_i18n_to_intlayer.md +8 -4
  145. package/docs/pl/migration_from_react-i18next_to_intlayer.md +8 -4
  146. package/docs/pl/migration_from_vue-i18n_to_intlayer.md +4 -0
  147. package/docs/pl/readme.md +24 -24
  148. package/docs/pt/configuration.md +10 -10
  149. package/docs/pt/eslint.md +336 -0
  150. package/docs/pt/interest_of_intlayer.md +24 -22
  151. package/docs/pt/intlayer_with_astro.md +1 -114
  152. package/docs/pt/intlayer_with_svelte_kit.md +1 -1
  153. package/docs/pt/intlayer_with_tanstack+solid.md +5 -3
  154. package/docs/pt/intlayer_with_tanstack.md +5 -3
  155. package/docs/pt/lsp.md +113 -174
  156. package/docs/pt/readme.md +24 -24
  157. package/docs/ru/configuration.md +10 -10
  158. package/docs/ru/eslint.md +336 -0
  159. package/docs/ru/interest_of_intlayer.md +24 -22
  160. package/docs/ru/intlayer_with_nextjs_14.md +1 -1
  161. package/docs/ru/intlayer_with_nextjs_15.md +1 -1
  162. package/docs/ru/intlayer_with_svelte_kit.md +1 -1
  163. package/docs/ru/intlayer_with_tanstack+solid.md +5 -3
  164. package/docs/ru/intlayer_with_tanstack.md +5 -3
  165. package/docs/ru/lsp.md +112 -173
  166. package/docs/ru/readme.md +24 -24
  167. package/docs/tr/configuration.md +10 -10
  168. package/docs/tr/eslint.md +336 -0
  169. package/docs/tr/interest_of_intlayer.md +24 -22
  170. package/docs/tr/intlayer_with_svelte_kit.md +1 -1
  171. package/docs/tr/intlayer_with_tanstack+solid.md +5 -3
  172. package/docs/tr/intlayer_with_tanstack.md +5 -3
  173. package/docs/tr/lsp.md +113 -174
  174. package/docs/tr/readme.md +24 -24
  175. package/docs/uk/configuration.md +10 -10
  176. package/docs/uk/eslint.md +336 -0
  177. package/docs/uk/interest_of_intlayer.md +4 -2
  178. package/docs/uk/intlayer_with_svelte_kit.md +1 -1
  179. package/docs/uk/intlayer_with_tanstack+solid.md +5 -3
  180. package/docs/uk/intlayer_with_tanstack.md +5 -3
  181. package/docs/uk/lsp.md +113 -174
  182. package/docs/uk/packages/angular-intlayer/exports.md +2 -2
  183. package/docs/uk/per_locale_file.md +1 -1
  184. package/docs/uk/readme.md +24 -24
  185. package/docs/ur/configuration.md +10 -10
  186. package/docs/ur/eslint.md +336 -0
  187. package/docs/ur/interest_of_intlayer.md +24 -22
  188. package/docs/vi/configuration.md +10 -10
  189. package/docs/vi/eslint.md +336 -0
  190. package/docs/vi/interest_of_intlayer.md +24 -22
  191. package/docs/vi/intlayer_with_svelte_kit.md +1 -1
  192. package/docs/vi/intlayer_with_tanstack+solid.md +5 -3
  193. package/docs/vi/intlayer_with_tanstack.md +5 -3
  194. package/docs/vi/lsp.md +115 -176
  195. package/docs/vi/readme.md +24 -24
  196. package/docs/zh/configuration.md +10 -10
  197. package/docs/zh/eslint.md +336 -0
  198. package/docs/zh/interest_of_intlayer.md +24 -22
  199. package/docs/zh/intlayer_with_create_react_app.md +4 -0
  200. package/docs/zh/intlayer_with_lynx+react.md +4 -0
  201. package/docs/zh/intlayer_with_nextjs_14.md +0 -2
  202. package/docs/zh/intlayer_with_nextjs_15.md +0 -2
  203. package/docs/zh/intlayer_with_nextjs_page_router.md +0 -2
  204. package/docs/zh/intlayer_with_nuxt.md +1 -1
  205. package/docs/zh/intlayer_with_react_router_v7.md +4 -0
  206. package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +4 -0
  207. package/docs/zh/intlayer_with_solid_start.md +1 -1
  208. package/docs/zh/intlayer_with_svelte_kit.md +1 -1
  209. package/docs/zh/intlayer_with_tanstack+solid.md +5 -3
  210. package/docs/zh/intlayer_with_tanstack.md +5 -3
  211. package/docs/zh/intlayer_with_vite+vue.md +0 -2
  212. package/docs/zh/lsp.md +113 -174
  213. package/docs/zh/readme.md +21 -21
  214. package/docs/zh-TW/eslint.md +336 -0
  215. package/docs/zh-TW/interest_of_intlayer.md +24 -22
  216. package/package.json +6 -6
  217. package/src/generated/docs.entry.ts +20 -0
@@ -0,0 +1,336 @@
1
+ ---
2
+ createdAt: 2026-08-12
3
+ updatedAt: 2026-08-12
4
+ title: Wtyczka ESLint | Reguły lintera dla Intlayer
5
+ description: Wykrywaj zahardkodowane ciągi znaków, wywołania dynamiczne, których kompilator Intlayer nie jest w stanie zoptymalizować, oraz nieużywaną zawartość słowników dzięki eslint-plugin-intlayer. Działa z ESLint i oxlint w React, Vue, Svelte, Angular i Astro.
6
+ keywords:
7
+ - Intlayer
8
+ - ESLint
9
+ - oxlint
10
+ - Linting
11
+ - i18n
12
+ - Internacjonalizacja
13
+ - no-raw-text
14
+ - Zahardkodowane ciągi znaków
15
+ - Nieużywane tłumaczenia
16
+ - Martwa zawartość
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: "Inicjalna historia"
28
+ author: aymericzip
29
+ ---
30
+
31
+ # Wtyczka ESLint x OXLint
32
+
33
+ `eslint-plugin-intlayer` wychwytuje rodzaje błędów i18n, których TypeScript nie jest w stanie wykryć:
34
+
35
+ 1. **Zahardkodowany tekst**, który nigdy nie trafił do słownika.
36
+ 2. **Dynamiczne wywołania**, które przechodzą sprawdzanie typów i działają, ale których kompilator Intlayer nie potrafi zoptymalizować.
37
+ 3. **Martwa zawartość (Dead content)** — słowniki i pola, których nic w projekcie nie odczytuje (opcjonalne).
38
+
39
+ Nieznane klucze słowników, nieznane ścieżki pól oraz brakujące ustawienia regionalne stanowią już błędy kompilacji, więc wtyczka ich nie powiela.
40
+
41
+ ## Instalacja
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
+ Wymaga ESLint w wersji 9 lub nowszej (flat config).
56
+
57
+ ## Użycie
58
+
59
+ Wtyczka działa zarówno w ESLint, jak i [oxlint](https://oxc.rs) — te same reguły, te same opcje.
60
+
61
+ <Tabs defaultTab="eslint">
62
+ <Tab label="ESLint" value="eslint">
63
+
64
+ ```javascript fileName="eslint.config.mjs" codeFormat="esm"
65
+ import intlayer from "eslint-plugin-intlayer";
66
+
67
+ export default [...intlayer.configs.recommended];
68
+ ```
69
+
70
+ Lub włączaj reguły pojedynczo:
71
+
72
+ ```javascript fileName="eslint.config.mjs" codeFormat="esm"
73
+ import intlayer from "eslint-plugin-intlayer";
74
+
75
+ export default [
76
+ {
77
+ plugins: { intlayer },
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
+ Dwa zastrzeżenia: obsługa wtyczek JS w oxlint jest w fazie alfa, a oxlint nie obsługuje niestandardowych parserów — pliki `.vue`, `.svelte`, `.astro` oraz szablony Angular nie są tam sprawdzane. Uruchamiaj oxlint na plikach JS/TS/JSX, a ESLint pozostaw dla reszty.
105
+
106
+ Reguła `no-unused-content` została celowo pominięta powyżej: wymaga ona katalogu roboczego i ścieżki do sprawdzanego pliku z kontekstu reguły, czego mostek wtyczek JS w fazie alfa nie gwarantuje. Uruchamiaj ją pod ESLintem.
107
+
108
+ </Tab>
109
+ </Tabs>
110
+
111
+ ### Konfiguracje
112
+
113
+ | Konfiguracja | `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 (+ literały poza JSX) | error | error | error | off |
117
+ | `contract-only` | off | error | error | off | off |
118
+
119
+ `recommended` celowo utrzymuje `no-raw-text` na poziomie `warn`: uruchomienie jej na istniejącej bazie kodu ujawnia wszystkie nieprzetłumaczone ciągi znaków naraz, co nie powinno blokować procesu budowania od pierwszego dnia.
120
+
121
+ `enforce-adapter-import` jest domyślnie wyłączona — włącz ją jawnie, jeśli tego potrzebujesz.
122
+
123
+ `no-unused-content` jest wyłączona w każdej konfiguracji, w tym `strict`. Jest to jedyna reguła, która odczytuje konfigurację Intlayer i przeszukuje pliki źródłowe na dysku, więc jej włączenie powinno być świadomym wyborem, a nie domyślnym zachowaniem zestawu.
124
+
125
+ ## Reguły
126
+
127
+ ### `no-raw-text`
128
+
129
+ Zgłasza tekst widoczny dla użytkownika, który nie jest zadeklarowany w słowniku. Używa tej samej metody detekcji co `intlayer extract`, dzięki czemu nazwy marek, klasy CSS i identyfikatory techniczne są ignorowane.
130
+
131
+ ```jsx
132
+ // ✗ Zgłoszone
133
+ <h1>Welcome to our documentation</h1>
134
+ <input placeholder="Enter your email address" />
135
+
136
+ // ✓ Prawidłowo
137
+ const { title } = useIntlayer("home");
138
+ <h1>{title}</h1>
139
+ ```
140
+
141
+ Pliki deklaracji zawartości (`*.content.ts`, …) są pomijane.
142
+
143
+ Aby naprawić cały plik naraz, uruchom `npx intlayer extract`, a kompilator automatycznie przeniesie ciągi znaków do słownika.
144
+
145
+ **Opcje**
146
+
147
+ ```javascript fileName="eslint.config.mjs" codeFormat="esm"
148
+ {
149
+ "intlayer/no-raw-text": [
150
+ "warn",
151
+ {
152
+ // Atrybuty, których wartością jest tekst widoczny dla użytkownika.
153
+ // Domyślnie: title, placeholder, alt, aria-label, label
154
+ attributes: ["title", "placeholder", "alt", "aria-label", "label"],
155
+
156
+ // Elementy, których zawartość nigdy nie jest tekstem widocznym dla użytkownika.
157
+ // Domyślnie: code, pre, script, style
158
+ ignoreElements: ["code", "pre", "script", "style"],
159
+
160
+ // Wyrażenia regularne dla tekstu, który nigdy nie powinien być zgłaszany.
161
+ ignorePatterns: ["^Powered by"],
162
+
163
+ // Zgłaszaj także literały łańcuchowe poza markupem. Domyślnie: false
164
+ includeStringLiterals: false,
165
+ },
166
+ ],
167
+ }
168
+ ```
169
+
170
+ ### `static-dictionary-key`
171
+
172
+ Wymaga, aby klucz słownika był literałem łańcuchowym.
173
+
174
+ Kompilator może wstępnie załadować słownik tylko wtedy, gdy może bezpośrednio odczytać klucz w miejscu wywołania. W przypadku obliczanego klucza optymalizacja jest po cichu pomijana i zamiast tego dołączane są wszystkie słowniki.
175
+
176
+ ```typescript
177
+ // ✗ Zgłoszone
178
+ useIntlayer(dictionaryKey);
179
+ useIntlayer(`home-${suffix}`);
180
+ getTranslations({ namespace: page });
181
+
182
+ // ✗ Zmienna nadal nie jest literałem
183
+ const key = "home";
184
+ useIntlayer(key);
185
+
186
+ // ✓ Prawidłowo
187
+ useIntlayer("home");
188
+ getTranslations({ namespace: "home" });
189
+ ```
190
+
191
+ Dotyczy to `useIntlayer`, `getIntlayer` oraz każdego adaptera kompatybilności (`useTranslation`, `useTranslations`, `formatMessage`, `<FormattedMessage id>`, `<Trans i18nKey>`, …).
192
+
193
+ ### `no-dynamic-field-access`
194
+
195
+ Wymaga, aby pole odczytywane ze słownika było znane statycznie.
196
+
197
+ Kompilator usuwa pola, których użycia nie zarejestruje. Dostęp dynamiczny jest dla niego niewidoczny, więc odczyt może zwrócić `undefined` w czasie wykonywania.
198
+
199
+ ```typescript
200
+ // ✗ Zgłoszone
201
+ const content = useIntlayer("home");
202
+ content[fieldName];
203
+
204
+ const t = useTranslations("home");
205
+ t(messageKey);
206
+
207
+ // ✓ Prawidłowo
208
+ content.title;
209
+ content["title"];
210
+ content.items[0];
211
+ t("hero.title");
212
+ ```
213
+
214
+ ### `enforce-adapter-import`
215
+
216
+ Preferuje adapter kompatybilności `@intlayer/*` zamiast oryginalnego pakietu. Oryginalny pakiet rozwiązuje się do Intlayer tylko wtedy, gdy skonfigurowany jest alias bundlera; adapter działa zawsze. Możliwość automatycznej naprawy za pomocą `--fix`.
217
+
218
+ ```typescript
219
+ // ✗ Zgłoszone
220
+ import { useTranslation } from "react-i18next";
221
+ import { getTranslations } from "next-intl/server";
222
+
223
+ // ✓ Prawidłowo
224
+ import { useTranslation } from "@intlayer/react-i18next";
225
+ import { getTranslations } from "@intlayer/next-intl/server";
226
+ ```
227
+
228
+ ### `no-unused-content`
229
+
230
+ **Domyślnie wyłączona.** Zgłasza zawartość, której nic w projekcie nie odczytuje, oraz klucze słowników zadeklarowane w więcej niż jednym miejscu.
231
+
232
+ ```typescript fileName="src/home.content.ts"
233
+ export default {
234
+ key: "home", // ✗ Zgłaszane, gdy żadne wywołanie w projekcie nie odpytuje o "home"
235
+ content: {
236
+ title: t({ pl: "Tytuł", en: "Title" }),
237
+
238
+ // ✗ Zgłaszane, gdy nic nie odczytuje `hero`
239
+ hero: {
240
+ subtitle: t({ pl: "Podtytuł", en: "Subtitle" }),
241
+ },
242
+ },
243
+ };
244
+ ```
245
+
246
+ W przeciwieństwie do innych reguł, ta nie jest w stanie ocenić sytuacji wyłącznie na podstawie sprawdzanego pliku — pole jest nieużywane tylko w kontekście całego projektu. Przy pierwszej deklaracji zawartości podczas działania lintera wczytuje konfigurację Intlayer, skanuje pliki źródłowe wskazane przez tę konfigurację (`build.traversePattern`, `compiler.transformPattern`) i uruchamia ten sam analizator użycia, który zasila `@intlayer/lsp` oraz przekreślenie „nieużywane” w rozszerzeniu VS Code. Wynik jest buforowany przez `cacheTtl` milisekund, więc skanowanie odbywa się raz na uruchomienie, a nie dla każdego pliku.
247
+
248
+ **Opcje**
249
+
250
+ ```javascript fileName="eslint.config.mjs" codeFormat="esm"
251
+ {
252
+ "intlayer/no-unused-content": [
253
+ "warn",
254
+ {
255
+ // Zgłaszaj klucze słowników, do których nic się nie odwołuje. Domyślnie: true
256
+ reportUnusedDictionaries: true,
257
+
258
+ // Zgłaszaj pola zawartości, których nic nie odczytuje. Domyślnie: true
259
+ reportUnusedFields: true,
260
+
261
+ // Zgłaszaj klucze zadeklarowane w więcej niż jednym miejscu. Domyślnie: true
262
+ reportDuplicateKeys: true,
263
+
264
+ // Wyrażenia regularne dla ścieżek pól, które nigdy nie powinny być zgłaszane.
265
+ ignoreFields: ["^meta"],
266
+
267
+ // Katalog główny projektu, od którego zaczyna się skanowanie. Domyślnie: katalog roboczy ESLint
268
+ baseDir: process.cwd(),
269
+
270
+ // Czas ponownego użycia skanu projektu (w ms). Domyślnie: 30000
271
+ cacheTtl: 30000,
272
+ },
273
+ ],
274
+ }
275
+ ```
276
+
277
+ Zmniejsz `cacheTtl`, gdy korzystasz z lintera działającego jako serwer edytora i chcesz szybciej widzieć zmiany; ustaw `baseDir`, gdy jedno uruchomienie lintera obejmuje kilka projektów Intlayer w monorepo.
278
+
279
+ > **Preferuje brak zgłoszenia w razie wątpliwości.** Fałszywy alarm w tym miejscu mógłby usunąć potrzebne tłumaczenie, dlatego nic nie jest zgłaszane, gdy słownik jest używany w sposób, którego analiza nie potrafi prześledzić: przekazanie całego obiektu zawartości, powiązana z niego funkcja tłumacząca (`const t = useTranslations("home")`), deklaracja dostępna przez bezpośredni import (`useDictionary(myDictionary)`), `nest()` z innego słownika lub lista pól, która stała się niepełna przez operator spread. Komponenty jednoplikowe (`.vue`, `.svelte`, `.astro`) są traktowane jako używające każdego pola wymienionych słowników, ponieważ ich bloki skryptów nie są tu parsowane.
280
+
281
+ `reportDuplicateKeys` odczytuje niescalone słowniki, które proces budowania zapisuje w `.intlayer/`, więc zachowuje milczenie do momentu, aż projekt zostanie zbudowany przynajmniej raz. Dwie deklaracje dzielące ten sam klucz są scalane, co jest poprawnym wzorcem — raport istnieje, ponieważ pole zdefiniowane po obu stronach po cichu zachowuje tylko jedną z dwóch wartości.
282
+
283
+ Analizator jest ładowany z `@intlayer/lsp`, który jest dystrybuowany jako ESM. Reguła wymaga zatem wersji Node obsługującej `require()` dla modułów ES — Node 20.19+ lub 22.12+. Na starszych wersjach reguła nic nie zgłasza, zamiast powodować błąd działania lintera.
284
+
285
+ ## Frameworki
286
+
287
+ Każda reguła działa we wszystkich integracjach Intlayer, w tym wewnątrz szablonów Vue, Svelte i Angular. Wystarczy wskazać ESLintowi, który parser obsługuje dany typ pliku.
288
+
289
+ | Framework | Pliki | 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
+ | Szablony Angular | `.component.html` | `@angular-eslint/template-parser` |
297
+ | Astro | `.astro` | `astro-eslint-parser` |
298
+
299
+ ```javascript fileName="eslint.config.mjs" codeFormat="esm"
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
+ Instaluj tylko te parsery, których wymaga Twój projekt.
335
+
336
+ > **Znane ograniczenie.** W szablonach Vue i Angular wyrażenie takie jak `{{ content[key] }}` nie jest sprawdzane przez `no-dynamic-field-access`. Odczyty dynamiczne zapisane w bloku script są wykrywane w normalny sposób.
@@ -207,7 +207,7 @@ export const ComponentExample = () => {
207
207
  Takie podejście pozwala na:
208
208
 
209
209
  1. **Zwiększenie szybkości programowania**
210
- - Pliki `.content.{{ts|mjs|cjs|json}}` mogą być tworzone przy użyciu rozszerzenia VSCode
210
+ - Pliki `.content.{ts|js|mjs|cjs|json|tsx|jsx|md|mdx|yaml|yml}` mogą być tworzone przy użyciu rozszerzenia VSCode
211
211
  - Narzędzia do automatycznego uzupełniania AI w Twoim IDE (takie jak GitHub Copilot) mogą pomóc w deklarowaniu treści, ograniczając kopiowanie/wklejanie
212
212
 
213
213
  2. **Uporządkowanie bazy kodu**
@@ -250,7 +250,7 @@ Takie podejście pozwala na:
250
250
  | ![Feature](https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true) | **Tłumaczenie wspomagane przez AI**<br><br>Przetłumacz swoją witrynę na 231 języków jednym kliknięciem, korzystając z zaawansowanych narzędzi tłumaczeniowych Intlayer opartych na sztucznej inteligencji, korzystając z własnego dostawcy AI/klucza API. <br><br> - [Integracja CI/CD](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Autouzupełnianie](https://intlayer.org/doc/concept/auto-fill) |
251
251
  | ![Feature](https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true) | **Integracja z serwerem MCP**<br><br>Udostępnia serwer MCP (Model Context Protocol) do automatyzacji IDE, umożliwiając bezproblemowe zarządzanie treścią i przepływy pracy i18n bezpośrednio w środowisku programistycznym. <br><br> - [Serwer MCP](https://github.com/aymericzip/intlayer/blob/main/docs/pl/mcp_server.md) |
252
252
  | ![Feature](https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true) | **Rozszerzenie VSCode**<br><br>Intlayer udostępnia rozszerzenie do VSCode, które pomaga zarządzać treścią i tłumaczeniami, budować słowniki, tłumaczyć zawartość i nie tylko. <br><br> - [Rozszerzenie VSCode](https://intlayer.org/doc/vs-code-extension) |
253
- | ![Feature](https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true) | **Interoperacyjność**<br><br>Umożliwia interoperacyjność z react-i18next, next-i18next, next-intl i react-intl. <br><br> - [Intlayer i react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer i next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer i next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) |
253
+ | ![Feature](https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true) | **Interoperacyjność**<br><br>Umożliwia interoperacyjność z react-i18next, next-i18next, next-intl i react-intl. <br><br> - [Intlayer i react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer i next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer i next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Adaptery kompatybilności Intlayer](https://intlayer.org/doc/compatibility) |
254
254
  | Testowanie brakujących tłumaczeń (CLI/CI) | ✅ CLI: npx intlayer content test (audyt przyjazny dla CI) |
255
255
 
256
256
  ## Porównanie Intlayer z innymi rozwiązaniami
@@ -290,3 +290,5 @@ Gwiazdki na GitHubie są silnym wskaźnikiem popularności projektu, zaufania sp
290
290
  `intlayer` może również pomóc w zarządzaniu przestrzeniami nazw `react-intl`, `react-i18next`, `next-intl`, `next-i18next` i `vue-i18n`.
291
291
 
292
292
  Używając `intlayer`, możesz zadeklarować treść w formacie swojej ulubionej biblioteki i18n, a intlayer wygeneruje przestrzenie nazw w wybranej przez Ciebie lokalizacji (przykład: `/messages/{{locale}}/{{namespace}}.json`).
293
+
294
+ Jeśli chcesz nadal korzystać z API swojej obecnej biblioteki i18n, `intlayer` udostępnia również **adaptery kompatybilności (compat adapters)**: pakiety wystawiające dokładnie to samo API co `react-i18next`, `next-intl`, `react-intl`, `vue-i18n` i inne, ale zasilane słownikami Intlayer. Dzięki temu możesz migrować stopniowo, bez przepisywania kodu. Zobacz [dokumentację adapterów kompatybilności](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/compat/index.md).
@@ -300,120 +300,7 @@ Integracja z Astro dodaje oprogramowanie pośredniczące Vite, które pomaga w r
300
300
 
301
301
  </Step>
302
302
 
303
- <Step number={7} title="Kontynuuj korzystanie ze swojego ulubionego frameworka">
304
-
305
- Kontynuuj budowanie swojej aplikacji, korzystając z wybranego frameworka.
306
-
307
- - Intlayer + React: [Intlayer z React](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_vite+react.md)
308
- - Intlayer + Vue: [Intlayer z Vue](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_vite+vue.md)
309
- - Intlayer + Svelte: [Intlayer z Svelte](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_vite+svelte.md)
310
- - Intlayer + Solid: [Intlayer z Solid](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_vite+solid.md)
311
- - Intlayer + Preact: [Intlayer z Preact](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/intlayer_with_vite+preact.md)
312
- </Step>
313
-
314
- <Step number={17} title="Wyodrębnij zawartość swoich komponentów" isOptional={true}>
315
-
316
- Jeśli masz istniejącą bazę kodu, transformacja tysięcy plików może być czasochłonna.
317
-
318
- Aby ułatwić ten proces, Intlayer proponuje [kompilator](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/compiler.md) / [ekstraktor](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pl/cli/extract.md), aby przetransformować komponenty i wyodrębnić zawartość.
319
-
320
- Aby go skonfigurować, możesz dodać sekcję `compiler` w pliku `intlayer.config.ts`:
321
-
322
- ```typescript fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
323
- import { type IntlayerConfig } from "intlayer";
324
-
325
- const config: IntlayerConfig = {
326
- // ... Reszta Twojej konfiguracji
327
- compiler: {
328
- /**
329
- * Wskazuje, czy kompilator powinien być włączony.
330
- */
331
- enabled: true,
332
-
333
- /**
334
- * Definiuje ścieżkę plików wyjściowych
335
- */
336
- output: ({ fileName, extension }) => `./${fileName}${extension}`,
337
-
338
- /**
339
- * Wskazuje, czy komponenty powinny zostać zapisane po transformacji. W ten sposób kompilator można uruchomić tylko raz, aby przetransformować aplikację, a następnie go usunąć.
340
- */
341
- saveComponents: false,
342
-
343
- /**
344
- * Prefiks klucza słownika
345
- */
346
- dictionaryKeyPrefix: "",
347
- },
348
- };
349
-
350
- export default config;
351
- ```
352
-
353
- <Tabs>
354
- <Tab value='Polecenie wyodrębniania'>
355
-
356
- Uruchom ekstraktor, aby przetransformować komponenty i wyodrębnić zawartość
357
-
358
- ```bash packageManager="npm"
359
- npx intlayer extract
360
- ```
361
-
362
- ```bash packageManager="pnpm"
363
- pnpm intlayer extract
364
- ```
365
-
366
- ```bash packageManager="yarn"
367
- yarn intlayer extract
368
- ```
369
-
370
- ```bash packageManager="bun"
371
- bun x intlayer extract
372
- ```
373
-
374
- </Tab>
375
- <Tab value='Kompilator Babel'>
376
-
377
- > Since v9, the `intlayerCompiler` is included in the `intlayer` plugin. So you don't need to add it manually.
378
-
379
- Zaktualizuj `vite.config.ts`, aby dołączyć wtyczkę `intlayerCompiler`:
380
-
381
- ```ts fileName="vite.config.ts"
382
- import { defineConfig } from "vite";
383
- import { intlayer, intlayerCompiler } from "vite-intlayer";
384
-
385
- export default defineConfig({
386
- plugins: [
387
- intlayer(),
388
- intlayerCompiler(), // Adds the compiler plugin
389
- ],
390
- });
391
- ```
392
-
393
- ```bash packageManager="npm"
394
- npm run build # Lub npm run dev
395
- ```
396
-
397
- ```bash packageManager="pnpm"
398
- pnpm run build # Or pnpm run dev
399
- ```
400
-
401
- ```bash packageManager="yarn"
402
- yarn build # Or yarn dev
403
- ```
404
-
405
- ```bash packageManager="bun"
406
- bun run build # Or bun run dev
407
- ```
408
-
409
- </Tab>
410
- </Tabs>
411
-
412
- ---
413
-
414
- </Step>
415
-
416
- </Steps>
303
+ <Step number={8} title="Sitemap i Robots.txt">
417
304
 
418
305
  #### Mapa witryny
419
306
 
@@ -387,7 +387,7 @@ export const getLocale = (event: RequestEvent): Locale => {
387
387
  };
388
388
  ```
389
389
 
390
- > `getLocaleFromStorage` sprawdzi lokalizację na podstawie nagłówka lub ciasteczka w zależności od Twojej konfiguracji. Zobacz [Konfiguracja](https://intlayer.org/doc/configuration) po więcej szczegółów.
390
+ > `getLocaleFromStorage` sprawdzi lokalizację na podstawie nagłówka lub ciasteczka w zależności od Twojej konfiguracji. Zobacz [Konfiguracja](https://intlayer.org/doc/concept/configuration) po więcej szczegółów.
391
391
 
392
392
  > Funkcja `localeDetector` przetworzy nagłówek `Accept-Language` i zwróci najlepsze dopasowanie.
393
393
 
@@ -236,19 +236,21 @@ import {
236
236
  HeadContent,
237
237
  Scripts,
238
238
  createRootRouteWithContext,
239
+ getRouteApi,
239
240
  } from "@tanstack/solid-router";
240
241
  import { HydrationScript } from "solid-js/web";
241
242
  import { Suspense, type ParentComponent } from "solid-js";
242
243
  import { IntlayerProvider } from "solid-intlayer";
243
244
  import { defaultLocale, getHTMLTextDir } from "intlayer";
244
- import { Route as LocaleRoute } from "./{-$locale}/route";
245
+
246
+ const localeRoute = getRouteApi("/{-$locale}");
245
247
 
246
248
  export const Route = createRootRouteWithContext()({
247
249
  shellComponent: RootComponent,
248
250
  });
249
251
 
250
252
  const RootComponent: ParentComponent = (props) => {
251
- const params = LocaleRoute.useParams();
253
+ const params = localeRoute.useParams();
252
254
  const locale = params()?.locale ?? defaultLocale;
253
255
 
254
256
  return (
@@ -533,7 +535,7 @@ Jak pokazano w Kroku 5, możesz zarządzać atrybutami `lang` oraz `dir` tagu `h
533
535
 
534
536
  ```tsx fileName="src/routes/__root.tsx"
535
537
  const RootComponent: ParentComponent = (props) => {
536
- const params = LocaleRoute.useParams();
538
+ const params = localeRoute.useParams();
537
539
  const locale = params()?.locale ?? defaultLocale;
538
540
 
539
541
  return (
@@ -253,13 +253,15 @@ Skonfiguruj swój główny układ, aby wspierać internacjonalizację, używają
253
253
  ```tsx fileName="src/routes/__root.tsx"
254
254
  import {
255
255
  createRootRouteWithContext,
256
+ getRouteApi,
256
257
  HeadContent,
257
258
  Scripts,
258
259
  } from "@tanstack/react-router";
259
260
  import { defaultLocale, getHTMLTextDir } from "intlayer";
260
261
  import { type ReactNode } from "react";
261
262
  import { IntlayerProvider } from "react-intlayer";
262
- import { Route as LocaleRoute } from "./{-$locale}/route";
263
+
264
+ const localeRoute = getRouteApi("/{-$locale}");
263
265
 
264
266
  export const Route = createRootRouteWithContext<{}>()({
265
267
  head: () => ({
@@ -281,7 +283,7 @@ export const Route = createRootRouteWithContext<{}>()({
281
283
  });
282
284
 
283
285
  function RootDocument({ children }: { children: ReactNode }) {
284
- const params = LocaleRoute.useParams();
286
+ const params = localeRoute.useParams();
285
287
  const locale = params?.locale ?? defaultLocale;
286
288
 
287
289
  return (
@@ -614,7 +616,7 @@ Jak pokazano w Kroku 5, możesz zarządzać atrybutami `lang` i `dir` tagu `html
614
616
 
615
617
  ```tsx fileName="src/routes/__root.tsx"
616
618
  function RootDocument({ children }: { children: ReactNode }) {
617
- const params = LocaleRoute.useParams();
619
+ const params = localeRoute.useParams();
618
620
  const locale = params?.locale ?? defaultLocale;
619
621
 
620
622
  return (