@intlayer/docs 7.3.1 → 7.3.2-canary.1

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 (148) hide show
  1. package/README.md +0 -2
  2. package/blog/ar/compiler_vs_declarative_i18n.md +1 -2
  3. package/blog/ar/i18n_using_next-i18next.md +8 -0
  4. package/blog/ar/i18n_using_next-intl.md +7 -0
  5. package/blog/ar/intlayer_with_next-intl.md +8 -0
  6. package/blog/ar/list_i18n_technologies/frameworks/flutter.md +0 -22
  7. package/blog/de/compiler_vs_declarative_i18n.md +1 -2
  8. package/blog/de/i18n_using_next-i18next.md +8 -0
  9. package/blog/de/i18n_using_next-intl.md +7 -0
  10. package/blog/de/intlayer_with_next-intl.md +8 -0
  11. package/blog/de/list_i18n_technologies/frameworks/flutter.md +0 -22
  12. package/blog/en/compiler_vs_declarative_i18n.md +1 -2
  13. package/blog/en/i18n_using_next-i18next.md +8 -0
  14. package/blog/en/i18n_using_next-intl.md +7 -0
  15. package/blog/en/intlayer_with_next-intl.md +8 -0
  16. package/blog/en/list_i18n_technologies/frameworks/flutter.md +0 -22
  17. package/blog/en/list_i18n_technologies/frameworks/svelte.md +19 -3
  18. package/blog/en/list_i18n_technologies/frameworks/vue.md +16 -2
  19. package/blog/en-GB/compiler_vs_declarative_i18n.md +1 -2
  20. package/blog/en-GB/i18n_using_next-i18next.md +8 -0
  21. package/blog/en-GB/i18n_using_next-intl.md +7 -0
  22. package/blog/en-GB/intlayer_with_next-intl.md +8 -0
  23. package/blog/en-GB/list_i18n_technologies/frameworks/flutter.md +0 -22
  24. package/blog/es/compiler_vs_declarative_i18n.md +1 -2
  25. package/blog/es/i18n_using_next-i18next.md +8 -0
  26. package/blog/es/i18n_using_next-intl.md +7 -0
  27. package/blog/es/intlayer_with_next-intl.md +8 -0
  28. package/blog/es/list_i18n_technologies/frameworks/flutter.md +0 -22
  29. package/blog/fr/compiler_vs_declarative_i18n.md +1 -2
  30. package/blog/fr/i18n_using_next-i18next.md +8 -0
  31. package/blog/fr/i18n_using_next-intl.md +7 -0
  32. package/blog/fr/intlayer_with_next-intl.md +8 -0
  33. package/blog/fr/list_i18n_technologies/frameworks/flutter.md +0 -22
  34. package/blog/hi/compiler_vs_declarative_i18n.md +2 -3
  35. package/blog/hi/i18n_using_next-i18next.md +8 -0
  36. package/blog/hi/i18n_using_next-intl.md +7 -0
  37. package/blog/hi/intlayer_with_next-intl.md +8 -0
  38. package/blog/hi/list_i18n_technologies/frameworks/flutter.md +0 -22
  39. package/blog/id/compiler_vs_declarative_i18n.md +1 -2
  40. package/blog/id/i18n_using_next-i18next.md +8 -0
  41. package/blog/id/i18n_using_next-intl.md +7 -0
  42. package/blog/id/intlayer_with_next-intl.md +8 -0
  43. package/blog/id/list_i18n_technologies/frameworks/flutter.md +0 -22
  44. package/blog/it/compiler_vs_declarative_i18n.md +1 -2
  45. package/blog/it/i18n_using_next-i18next.md +8 -0
  46. package/blog/it/i18n_using_next-intl.md +7 -0
  47. package/blog/it/intlayer_with_next-intl.md +8 -0
  48. package/blog/it/list_i18n_technologies/frameworks/flutter.md +0 -22
  49. package/blog/ja/compiler_vs_declarative_i18n.md +1 -2
  50. package/blog/ja/i18n_using_next-i18next.md +8 -0
  51. package/blog/ja/i18n_using_next-intl.md +7 -0
  52. package/blog/ja/intlayer_with_next-intl.md +8 -0
  53. package/blog/ja/list_i18n_technologies/frameworks/flutter.md +0 -22
  54. package/blog/ko/compiler_vs_declarative_i18n.md +2 -3
  55. package/blog/ko/i18n_using_next-i18next.md +8 -0
  56. package/blog/ko/i18n_using_next-intl.md +7 -0
  57. package/blog/ko/intlayer_with_next-intl.md +8 -0
  58. package/blog/ko/list_i18n_technologies/frameworks/flutter.md +0 -22
  59. package/blog/pl/compiler_vs_declarative_i18n.md +1 -2
  60. package/blog/pl/i18n_using_next-i18next.md +8 -0
  61. package/blog/pl/i18n_using_next-intl.md +7 -0
  62. package/blog/pl/intlayer_with_next-intl.md +8 -0
  63. package/blog/pl/list_i18n_technologies/frameworks/flutter.md +0 -22
  64. package/blog/pt/compiler_vs_declarative_i18n.md +1 -2
  65. package/blog/pt/i18n_using_next-i18next.md +8 -0
  66. package/blog/pt/i18n_using_next-intl.md +7 -0
  67. package/blog/pt/intlayer_with_next-intl.md +8 -0
  68. package/blog/pt/list_i18n_technologies/frameworks/flutter.md +0 -22
  69. package/blog/ru/compiler_vs_declarative_i18n.md +1 -2
  70. package/blog/ru/i18n_using_next-i18next.md +8 -0
  71. package/blog/ru/i18n_using_next-intl.md +7 -0
  72. package/blog/ru/intlayer_with_next-intl.md +8 -0
  73. package/blog/ru/list_i18n_technologies/frameworks/flutter.md +0 -22
  74. package/blog/tr/compiler_vs_declarative_i18n.md +2 -3
  75. package/blog/tr/i18n_using_next-i18next.md +8 -0
  76. package/blog/tr/i18n_using_next-intl.md +7 -0
  77. package/blog/tr/intlayer_with_next-intl.md +8 -0
  78. package/blog/tr/list_i18n_technologies/frameworks/flutter.md +0 -22
  79. package/blog/vi/compiler_vs_declarative_i18n.md +1 -2
  80. package/blog/vi/i18n_using_next-i18next.md +8 -0
  81. package/blog/vi/i18n_using_next-intl.md +7 -0
  82. package/blog/vi/intlayer_with_next-intl.md +8 -0
  83. package/blog/vi/list_i18n_technologies/frameworks/flutter.md +0 -22
  84. package/blog/zh/compiler_vs_declarative_i18n.md +1 -2
  85. package/blog/zh/i18n_using_next-i18next.md +8 -0
  86. package/blog/zh/i18n_using_next-intl.md +7 -0
  87. package/blog/zh/intlayer_with_next-intl.md +8 -0
  88. package/blog/zh/list_i18n_technologies/frameworks/flutter.md +0 -22
  89. package/dist/cjs/generated/docs.entry.cjs +19 -0
  90. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  91. package/dist/esm/generated/docs.entry.mjs +19 -0
  92. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  93. package/dist/types/generated/docs.entry.d.ts +1 -0
  94. package/dist/types/generated/docs.entry.d.ts.map +1 -1
  95. package/docs/ar/bundle_optimization.md +6 -2
  96. package/docs/ar/compiler.md +133 -0
  97. package/docs/de/bundle_optimization.md +6 -2
  98. package/docs/de/compiler.md +133 -0
  99. package/docs/de/intlayer_with_nextjs_15.md +1 -1
  100. package/docs/de/per_locale_file.md +1 -1
  101. package/docs/en/bundle_optimization.md +6 -2
  102. package/docs/en/cli/index.md +2 -2
  103. package/docs/en/compiler.md +133 -0
  104. package/docs/en/intlayer_with_nextjs_14.md +0 -1
  105. package/docs/en-GB/bundle_optimization.md +6 -2
  106. package/docs/en-GB/compiler.md +133 -0
  107. package/docs/en-GB/packages/intlayer/getTranslation.md +1 -3
  108. package/docs/en-GB/packages/react-intlayer/t.md +1 -1
  109. package/docs/en-GB/packages/react-intlayer/useI18n.md +1 -1
  110. package/docs/es/bundle_optimization.md +6 -2
  111. package/docs/es/compiler.md +133 -0
  112. package/docs/fr/bundle_optimization.md +6 -2
  113. package/docs/fr/compiler.md +133 -0
  114. package/docs/fr/packages/react-intlayer/useI18n.md +1 -1
  115. package/docs/hi/bundle_optimization.md +6 -2
  116. package/docs/hi/compiler.md +133 -0
  117. package/docs/id/bundle_optimization.md +6 -2
  118. package/docs/id/compiler.md +133 -0
  119. package/docs/id/formatters.md +0 -1
  120. package/docs/id/intlayer_with_nextjs_14.md +1 -2
  121. package/docs/id/intlayer_with_nextjs_15.md +1 -1
  122. package/docs/it/bundle_optimization.md +6 -2
  123. package/docs/it/compiler.md +133 -0
  124. package/docs/ja/bundle_optimization.md +6 -2
  125. package/docs/ja/compiler.md +133 -0
  126. package/docs/ko/bundle_optimization.md +6 -2
  127. package/docs/ko/cli/index.md +20 -20
  128. package/docs/ko/compiler.md +133 -0
  129. package/docs/pl/bundle_optimization.md +6 -2
  130. package/docs/pl/compiler.md +133 -0
  131. package/docs/pl/formatters.md +0 -1
  132. package/docs/pl/intlayer_with_nextjs_14.md +1 -2
  133. package/docs/pl/intlayer_with_nextjs_15.md +1 -1
  134. package/docs/pt/bundle_optimization.md +6 -2
  135. package/docs/pt/compiler.md +133 -0
  136. package/docs/ru/bundle_optimization.md +6 -2
  137. package/docs/ru/compiler.md +133 -0
  138. package/docs/tr/bundle_optimization.md +6 -2
  139. package/docs/tr/compiler.md +133 -0
  140. package/docs/tr/intlayer_with_nextjs_14.md +2 -0
  141. package/docs/vi/bundle_optimization.md +6 -2
  142. package/docs/vi/compiler.md +133 -0
  143. package/docs/vi/intlayer_with_nextjs_14.md +1 -2
  144. package/docs/vi/intlayer_with_nextjs_15.md +1 -1
  145. package/docs/zh/bundle_optimization.md +6 -2
  146. package/docs/zh/compiler.md +133 -0
  147. package/package.json +10 -9
  148. package/src/generated/docs.entry.ts +19 -0
@@ -0,0 +1,133 @@
1
+ ---
2
+ createdAt: 2025-09-09
3
+ updatedAt: 2025-09-09
4
+ title: Intlayer Compiler | Automated Content Extraction for i18n
5
+ description: Automate your internationalisation process with the Intlayer Compiler. Extract content directly from your components for faster, more efficient i18n in Vite, Next.js, and more.
6
+ keywords:
7
+ - Intlayer
8
+ - Compiler
9
+ - Internationalisation
10
+ - i18n
11
+ - Automation
12
+ - Extraction
13
+ - Speed
14
+ - Vite
15
+ - Next.js
16
+ - React
17
+ - Vue
18
+ - Svelte
19
+ slugs:
20
+ - doc
21
+ - compiler
22
+ history:
23
+ - version: 7.3.1
24
+ date: 2025-11-27
25
+ changes: Release Compiler
26
+ ---
27
+
28
+ # Intlayer Compiler | Automated Content Extraction for i18n
29
+
30
+ ## What is the Intlayer Compiler?
31
+
32
+ The **Intlayer Compiler** is a powerful tool designed to automate the process of internationalisation (i18n) in your applications. It scans your source code (JSX, TSX, Vue, Svelte) for content declarations, extracts them, and automatically generates the necessary dictionary files. This allows you to keep your content co-located with your components while Intlayer handles the management and synchronisation of your dictionaries.
33
+
34
+ ## Why Use the Intlayer Compiler?
35
+
36
+ - **Automation**: Eliminates manual copy-pasting of content into dictionaries.
37
+ - **Speed**: Optimised content extraction ensuring your build process remains fast.
38
+ - **Developer Experience**: Keep content declarations right where they are used, improving maintainability.
39
+ - **Live Updates**: Supports Hot Module Replacement (HMR) for instant feedback during development.
40
+
41
+ See the [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/en/compiler_vs_declarative_i18n.md) blog post for a deeper comparison.
42
+
43
+ ## Why not use the Intlayer Compiler?
44
+
45
+ Whilst the compiler offers an excellent "just works" experience, it also introduces some trade-offs you should be aware of:
46
+
47
+ - **Heuristic ambiguity**: The compiler must guess what is user-facing content vs. application logic (e.g., `className="active"`, status codes, product IDs). In complex codebases, this can lead to false positives or missed strings that require manual annotations and exceptions.
48
+ - **Static-only extraction**: Compiler-based extraction relies on static analysis. Strings that only exist at runtime (API error codes, CMS fields, etc.) cannot be discovered or translated by the compiler alone, so you still need a complementary runtime i18n strategy.
49
+
50
+ For a deeper architectural comparison, see the blog post [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/en/compiler_vs_declarative_i18n.md).
51
+
52
+ As an alternative, to automate your i18n process whilst keeping full control of your content, Intlayer also provides an auto-extraction command `intlayer transform` (see [CLI documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/cli/transform.md)), or the `Intlayer: extract content to Dictionary` command from the Intlayer VS Code extension (see [VS Code extension documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/vs_code_extension.md)).
53
+
54
+ ## Usage
55
+
56
+ ### Vite
57
+
58
+ For Vite-based applications (React, Vue, Svelte, etc.), the easiest way to use the compiler is through the `vite-intlayer` plugin.
59
+
60
+ #### Installation
61
+
62
+ ```bash
63
+ npm install vite-intlayer
64
+ ```
65
+
66
+ #### Configuration
67
+
68
+ Update your `vite.config.ts` to include the `intlayerCompiler` plugin:
69
+
70
+ ```ts fileName="vite.config.ts"
71
+ import { defineConfig } from "vite";
72
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
73
+
74
+ export default defineConfig({
75
+ plugins: [
76
+ intlayer(),
77
+ intlayerCompiler(), // Adds the compiler plugin
78
+ ],
79
+ });
80
+ ```
81
+
82
+ #### Framework Support
83
+
84
+ The Vite plugin automatically detects and handles different file types:
85
+
86
+ - **React / JSX / TSX**: Handled natively.
87
+ - **Vue**: Requires `@intlayer/vue-compiler`.
88
+ - **Svelte**: Requires `@intlayer/svelte-compiler`.
89
+
90
+ Make sure to install the appropriate compiler package for your framework:
91
+
92
+ ```bash
93
+ # For Vue
94
+ npm install @intlayer/vue-compiler
95
+
96
+ # For Svelte
97
+ npm install @intlayer/svelte-compiler
98
+ ```
99
+
100
+ ### Next.js (Babel)
101
+
102
+ For Next.js or other Webpack-based applications using Babel, you can configure the compiler using the `@intlayer/babel` plugin.
103
+
104
+ #### Installation
105
+
106
+ ```bash
107
+ npm install @intlayer/babel
108
+ ```
109
+
110
+ #### Configuration
111
+
112
+ Update your `babel.config.js` (or `babel.config.json`) to include the extraction plugin. We provide a helper `getExtractPluginOptions` to load your Intlayer configuration automatically.
113
+
114
+ ```js fileName="babel.config.js"
115
+ const {
116
+ intlayerExtractBabelPlugin,
117
+ intlayerOptimizeBabelPlugin,
118
+ getExtractPluginOptions,
119
+ getOptimizePluginOptions,
120
+ } = require("@intlayer/babel");
121
+
122
+ module.exports = {
123
+ presets: ["next/babel"],
124
+ plugins: [
125
+ // Extract content from components into dictionaries
126
+ [intlayerExtractBabelPlugin, getExtractPluginOptions()],
127
+ // Optimize imports by replacing useIntlayer with direct dictionary imports
128
+ [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],
129
+ ],
130
+ };
131
+ ```
132
+
133
+ This configuration ensures that content declared in your components is automatically extracted and used to generate dictionaries during your build process.
@@ -20,7 +20,7 @@ slugs:
20
20
  - getTranslation
21
21
  history:
22
22
  - version: 5.5.10
23
- date: 29-06-2025
23
+ date: 2025-06-29
24
24
  changes: Initial history
25
25
  ---
26
26
 
@@ -35,13 +35,11 @@ The `getTranslationContent` function retrieves the content corresponding to a sp
35
35
  ## Parameters
36
36
 
37
37
  - `languageContent: CustomizableLanguageContent<Content>`
38
-
39
38
  - **Description**: An object containing translations for various locales. Each key represents a locale, and its value is the corresponding content.
40
39
  - **Type**: `CustomizableLanguageContent<Content>`
41
40
  - `Content` can be any type, defaulting to `string`.
42
41
 
43
42
  - `locale: Locales`
44
-
45
43
  - **Description**: The locale for which content is to be retrieved.
46
44
  - **Type**: `Locales`
47
45
 
@@ -19,7 +19,7 @@ slugs:
19
19
  - t
20
20
  history:
21
21
  - version: 5.5.10
22
- date: 29-06-2025
22
+ date: 2025-06-29
23
23
  changes: Init history
24
24
  ---
25
25
 
@@ -21,7 +21,7 @@ slugs:
21
21
  - useI18n
22
22
  history:
23
23
  - version: 6.0.0
24
- date: 29-06-2025
24
+ date: 2025-06-29
25
25
  changes: Initial writing of `useI18n` hook documentation
26
26
  ---
27
27
 
@@ -153,9 +153,13 @@ const content = useIntlayer("my-key");
153
153
  // Código optimizado (Dinámico)
154
154
  const content = useDictionaryAsync({
155
155
  en: () =>
156
- import(".intlayer/dynamic_dictionary/en.json").then((mod) => mod.default),
156
+ import(".intlayer/dynamic_dictionary/my-key/en.json").then(
157
+ (mod) => mod.default
158
+ ),
157
159
  fr: () =>
158
- import(".intlayer/dynamic_dictionary/fr.json").then((mod) => mod.default),
160
+ import(".intlayer/dynamic_dictionary/my-key/fr.json").then(
161
+ (mod) => mod.default
162
+ ),
159
163
  });
160
164
  ```
161
165
 
@@ -0,0 +1,133 @@
1
+ ---
2
+ createdAt: 2025-09-09
3
+ updatedAt: 2025-09-09
4
+ title: Intlayer Compiler | Extracción Automática de Contenido para i18n
5
+ description: Automatiza tu proceso de internacionalización con el Intlayer Compiler. Extrae contenido directamente de tus componentes para una i18n más rápida y eficiente en Vite, Next.js y más.
6
+ keywords:
7
+ - Intlayer
8
+ - Compiler
9
+ - Internacionalización
10
+ - i18n
11
+ - Automatización
12
+ - Extracción
13
+ - Velocidad
14
+ - Vite
15
+ - Next.js
16
+ - React
17
+ - Vue
18
+ - Svelte
19
+ slugs:
20
+ - doc
21
+ - compiler
22
+ history:
23
+ - version: 7.3.1
24
+ date: 2025-11-27
25
+ changes: Lanzamiento del Compiler
26
+ ---
27
+
28
+ # Intlayer Compiler | Extracción Automática de Contenido para i18n
29
+
30
+ ## ¿Qué es el Intlayer Compiler?
31
+
32
+ El **Intlayer Compiler** es una herramienta poderosa diseñada para automatizar el proceso de internacionalización (i18n) en tus aplicaciones. Escanea tu código fuente (JSX, TSX, Vue, Svelte) en busca de declaraciones de contenido, las extrae y genera automáticamente los archivos de diccionario necesarios. Esto te permite mantener tu contenido junto a tus componentes mientras Intlayer se encarga de la gestión y sincronización de tus diccionarios.
33
+
34
+ ## ¿Por qué usar el Intlayer Compiler?
35
+
36
+ - **Automatización**: Elimina el copiado manual de contenido en los diccionarios.
37
+ - **Velocidad**: Extracción de contenido optimizada que asegura que tu proceso de build siga siendo rápido.
38
+ - **Experiencia del desarrollador**: Mantén las declaraciones de contenido justo donde se usan, mejorando la mantenibilidad.
39
+ - **Actualizaciones en vivo**: Soporta Hot Module Replacement (HMR) para retroalimentación instantánea durante el desarrollo.
40
+
41
+ Consulta el artículo del blog [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/es/compiler_vs_declarative_i18n.md) para una comparación más profunda.
42
+
43
+ ## ¿Por qué no usar el Intlayer Compiler?
44
+
45
+ Si bien el compilador ofrece una excelente experiencia de "funciona sin más", también introduce algunos compromisos de los que debes ser consciente:
46
+
47
+ - **Ambigüedad heurística**: El compilador debe adivinar qué es contenido orientado al usuario frente a la lógica de la aplicación (por ejemplo, `className="active"`, códigos de estado, IDs de productos). En bases de código complejas, esto puede llevar a falsos positivos o cadenas omitidas que requieren anotaciones manuales y excepciones.
48
+ - **Extracción solo estática**: La extracción basada en compilador se basa en análisis estático. Las cadenas que solo existen en tiempo de ejecución (códigos de error de API, campos CMS, etc.) no pueden ser descubiertas o traducidas por el compilador solo, por lo que aún necesitas una estrategia i18n de tiempo de ejecución complementaria.
49
+
50
+ Para una comparación arquitectónica más profunda, consulta el artículo del blog [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/es/compiler_vs_declarative_i18n.md).
51
+
52
+ Como alternativa, para automatizar tu proceso i18n mientras mantienes el control total de tu contenido, Intlayer también proporciona un comando de auto-extracción `intlayer transform` (consulta la [documentación CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/cli/transform.md)), o el comando `Intlayer: extract content to Dictionary` de la extensión Intlayer VS Code (consulta la [documentación de la extensión VS Code](https://github.com/aymericzip/intlayer/blob/main/docs/docs/es/vs_code_extension.md)).
53
+
54
+ ## Uso
55
+
56
+ ### Vite
57
+
58
+ Para aplicaciones basadas en Vite (React, Vue, Svelte, etc.), la forma más sencilla de usar el compilador es a través del plugin `vite-intlayer`.
59
+
60
+ #### Instalación
61
+
62
+ ```bash
63
+ npm install vite-intlayer
64
+ ```
65
+
66
+ #### Configuración
67
+
68
+ Actualiza tu `vite.config.ts` para incluir el plugin `intlayerCompiler`:
69
+
70
+ ```ts fileName="vite.config.ts"
71
+ import { defineConfig } from "vite";
72
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
73
+
74
+ export default defineConfig({
75
+ plugins: [
76
+ intlayer(),
77
+ intlayerCompiler(), // Añade el plugin del compilador
78
+ ],
79
+ });
80
+ ```
81
+
82
+ #### Soporte de Framework
83
+
84
+ El plugin de Vite detecta y maneja automáticamente diferentes tipos de archivos:
85
+
86
+ - **React / JSX / TSX**: Manejado de forma nativa.
87
+ - **Vue**: Requiere `@intlayer/vue-compiler`.
88
+ - **Svelte**: Requiere `@intlayer/svelte-compiler`.
89
+
90
+ Asegúrate de instalar el paquete de compilador adecuado para tu framework:
91
+
92
+ ```bash
93
+ # Para Vue
94
+ npm install @intlayer/vue-compiler
95
+
96
+ # Para Svelte
97
+ npm install @intlayer/svelte-compiler
98
+ ```
99
+
100
+ ### Next.js (Babel)
101
+
102
+ Para Next.js u otras aplicaciones basadas en Webpack que usan Babel, puedes configurar el compilador usando el plugin `@intlayer/babel`.
103
+
104
+ #### Instalación
105
+
106
+ ```bash
107
+ npm install @intlayer/babel
108
+ ```
109
+
110
+ #### Configuración
111
+
112
+ Actualiza tu `babel.config.js` (o `babel.config.json`) para incluir el plugin de extracción. Proporcionamos un helper `getExtractPluginOptions` para cargar automáticamente tu configuración de Intlayer.
113
+
114
+ ```js fileName="babel.config.js"
115
+ const {
116
+ intlayerExtractBabelPlugin,
117
+ intlayerOptimizeBabelPlugin,
118
+ getExtractPluginOptions,
119
+ getOptimizePluginOptions,
120
+ } = require("@intlayer/babel");
121
+
122
+ module.exports = {
123
+ presets: ["next/babel"],
124
+ plugins: [
125
+ // Extract content from components into dictionaries
126
+ [intlayerExtractBabelPlugin, getExtractPluginOptions()],
127
+ // Optimize imports by replacing useIntlayer with direct dictionary imports
128
+ [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],
129
+ ],
130
+ };
131
+ ```
132
+
133
+ Esta configuración asegura que el contenido declarado en tus componentes se extraiga automáticamente y se utilice para generar diccionarios durante tu proceso de compilación.
@@ -153,9 +153,13 @@ const content = useIntlayer("my-key");
153
153
  // Code optimisé (Dynamique)
154
154
  const content = useDictionaryAsync({
155
155
  en: () =>
156
- import(".intlayer/dynamic_dictionary/en.json").then((mod) => mod.default),
156
+ import(".intlayer/dynamic_dictionary/my-key/en.json").then(
157
+ (mod) => mod.default
158
+ ),
157
159
  fr: () =>
158
- import(".intlayer/dynamic_dictionary/fr.json").then((mod) => mod.default),
160
+ import(".intlayer/dynamic_dictionary/my-key/fr.json").then(
161
+ (mod) => mod.default
162
+ ),
159
163
  });
160
164
  ```
161
165
 
@@ -0,0 +1,133 @@
1
+ ---
2
+ createdAt: 2025-09-09
3
+ updatedAt: 2025-09-09
4
+ title: Intlayer Compiler | Extraction Automatisée de Contenu pour i18n
5
+ description: Automatisez votre processus d'internationalisation avec l'Intlayer Compiler. Extrayez le contenu directement de vos composants pour une i18n plus rapide et plus efficace dans Vite, Next.js, et plus encore.
6
+ keywords:
7
+ - Intlayer
8
+ - Compiler
9
+ - Internationalisation
10
+ - i18n
11
+ - Automatisation
12
+ - Extraction
13
+ - Rapidité
14
+ - Vite
15
+ - Next.js
16
+ - React
17
+ - Vue
18
+ - Svelte
19
+ slugs:
20
+ - doc
21
+ - compiler
22
+ history:
23
+ - version: 7.3.1
24
+ date: 2025-11-27
25
+ changes: Sortie du Compiler
26
+ ---
27
+
28
+ # Intlayer Compiler | Extraction Automatisée de Contenu pour i18n
29
+
30
+ ## Qu'est-ce que l'Intlayer Compiler ?
31
+
32
+ Le **Intlayer Compiler** est un outil puissant conçu pour automatiser le processus d'internationalisation (i18n) dans vos applications. Il analyse votre code source (JSX, TSX, Vue, Svelte) à la recherche de déclarations de contenu, les extrait, et génère automatiquement les fichiers de dictionnaire nécessaires. Cela vous permet de garder votre contenu localisé avec vos composants tandis qu'Intlayer gère la gestion et la synchronisation de vos dictionnaires.
33
+
34
+ ## Pourquoi utiliser le Intlayer Compiler ?
35
+
36
+ - **Automatisation** : Élimine le copier-coller manuel du contenu dans les dictionnaires.
37
+ - **Rapidité** : Extraction de contenu optimisée garantissant que votre processus de build reste rapide.
38
+ - **Expérience développeur** : Gardez les déclarations de contenu là où elles sont utilisées, améliorant ainsi la maintenabilité.
39
+ - **Mises à jour en direct** : Prend en charge le Hot Module Replacement (HMR) pour un retour instantané pendant le développement.
40
+
41
+ Consultez l'article de blog [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/fr/compiler_vs_declarative_i18n.md) pour une comparaison plus approfondie.
42
+
43
+ ## Pourquoi ne pas utiliser l'Intlayer Compiler ?
44
+
45
+ Bien que le compilateur offre une excellente expérience "fonctionne tout seul", il introduit également certains compromis dont vous devez être conscient :
46
+
47
+ - **Ambiguïté heuristique** : Le compilateur doit deviner ce qui est du contenu destiné aux utilisateurs par rapport à la logique de l'application (par exemple, `className="active"`, codes de statut, identifiants de produits). Dans des bases de code complexes, cela peut conduire à de faux positifs ou à des chaînes manquées qui nécessitent des annotations manuelles et des exceptions.
48
+ - **Extraction statique uniquement** : L'extraction basée sur le compilateur repose sur l'analyse statique. Les chaînes qui n'existent qu'à l'exécution (codes d'erreur API, champs CMS, etc.) ne peuvent pas être découvertes ou traduites par le compilateur seul, vous avez donc toujours besoin d'une stratégie i18n d'exécution complémentaire.
49
+
50
+ Pour une comparaison architecturale plus approfondie, consultez l'article de blog [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/fr/compiler_vs_declarative_i18n.md).
51
+
52
+ Comme alternative, pour automatiser votre processus i18n tout en gardant un contrôle total de votre contenu, Intlayer fournit également une commande d'auto-extraction `intlayer transform` (voir la [documentation CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/cli/transform.md)), ou la commande `Intlayer: extract content to Dictionary` de l'extension Intlayer VS Code (voir la [documentation de l'extension VS Code](https://github.com/aymericzip/intlayer/blob/main/docs/docs/fr/vs_code_extension.md)).
53
+
54
+ ## Utilisation
55
+
56
+ ### Vite
57
+
58
+ Pour les applications basées sur Vite (React, Vue, Svelte, etc.), la manière la plus simple d'utiliser le compilateur est via le plugin `vite-intlayer`.
59
+
60
+ #### Installation
61
+
62
+ ```bash
63
+ npm install vite-intlayer
64
+ ```
65
+
66
+ #### Configuration
67
+
68
+ Mettez à jour votre `vite.config.ts` pour inclure le plugin `intlayerCompiler` :
69
+
70
+ ```ts fileName="vite.config.ts"
71
+ import { defineConfig } from "vite";
72
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
73
+
74
+ export default defineConfig({
75
+ plugins: [
76
+ intlayer(),
77
+ intlayerCompiler(), // Ajoute le plugin du compilateur
78
+ ],
79
+ });
80
+ ```
81
+
82
+ #### Support des frameworks
83
+
84
+ Le plugin Vite détecte et gère automatiquement différents types de fichiers :
85
+
86
+ - **React / JSX / TSX** : Pris en charge nativement.
87
+ - **Vue** : Nécessite `@intlayer/vue-compiler`.
88
+ - **Svelte** : Nécessite `@intlayer/svelte-compiler`.
89
+
90
+ Assurez-vous d'installer le paquet compilateur approprié pour votre framework :
91
+
92
+ ```bash
93
+ # Pour Vue
94
+ npm install @intlayer/vue-compiler
95
+
96
+ # Pour Svelte
97
+ npm install @intlayer/svelte-compiler
98
+ ```
99
+
100
+ ### Next.js (Babel)
101
+
102
+ Pour Next.js ou d'autres applications basées sur Webpack utilisant Babel, vous pouvez configurer le compilateur en utilisant le plugin `@intlayer/babel`.
103
+
104
+ #### Installation
105
+
106
+ ```bash
107
+ npm install @intlayer/babel
108
+ ```
109
+
110
+ #### Configuration
111
+
112
+ Mettez à jour votre fichier `babel.config.js` (ou `babel.config.json`) pour inclure le plugin d'extraction. Nous fournissons un helper `getExtractPluginOptions` pour charger automatiquement votre configuration Intlayer.
113
+
114
+ ```js fileName="babel.config.js"
115
+ const {
116
+ intlayerExtractBabelPlugin,
117
+ intlayerOptimizeBabelPlugin,
118
+ getExtractPluginOptions,
119
+ getOptimizePluginOptions,
120
+ } = require("@intlayer/babel");
121
+
122
+ module.exports = {
123
+ presets: ["next/babel"],
124
+ plugins: [
125
+ // Extract content from components into dictionaries
126
+ [intlayerExtractBabelPlugin, getExtractPluginOptions()],
127
+ // Optimize imports by replacing useIntlayer with direct dictionary imports
128
+ [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],
129
+ ],
130
+ };
131
+ ```
132
+
133
+ Cette configuration garantit que le contenu déclaré dans vos composants est automatiquement extrait et utilisé pour générer les dictionnaires lors de votre processus de build.
@@ -21,7 +21,7 @@ slugs:
21
21
  - useI18n
22
22
  history:
23
23
  - version: 6.0.0
24
- date: 29-06-2025
24
+ date: 2025-06-29
25
25
  changes: Rédaction initiale de la documentation du hook `useI18n`
26
26
  ---
27
27
 
@@ -153,9 +153,13 @@ const content = useIntlayer("my-key");
153
153
  // अनुकूलित कोड (डायनामिक)
154
154
  const content = useDictionaryAsync({
155
155
  en: () =>
156
- import(".intlayer/dynamic_dictionary/en.json").then((mod) => mod.default),
156
+ import(".intlayer/dynamic_dictionary/my-key/en.json").then(
157
+ (mod) => mod.default
158
+ ),
157
159
  fr: () =>
158
- import(".intlayer/dynamic_dictionary/fr.json").then((mod) => mod.default),
160
+ import(".intlayer/dynamic_dictionary/my-key/fr.json").then(
161
+ (mod) => mod.default
162
+ ),
159
163
  });
160
164
  ```
161
165
 
@@ -0,0 +1,133 @@
1
+ ---
2
+ createdAt: 2025-09-09
3
+ updatedAt: 2025-09-09
4
+ title: Intlayer Compiler | i18n के लिए स्वचालित सामग्री निष्कर्षण
5
+ description: Intlayer Compiler के साथ अपने अंतरराष्ट्रीयकरण प्रक्रिया को स्वचालित करें। Vite, Next.js, और अन्य में तेज़, अधिक कुशल i18n के लिए सीधे अपने कंपोनेंट्स से सामग्री निकालें।
6
+ keywords:
7
+ - Intlayer
8
+ - Compiler
9
+ - Internationalization
10
+ - i18n
11
+ - Automation
12
+ - Extraction
13
+ - Speed
14
+ - Vite
15
+ - Next.js
16
+ - React
17
+ - Vue
18
+ - Svelte
19
+ slugs:
20
+ - doc
21
+ - compiler
22
+ history:
23
+ - version: 7.3.1
24
+ date: 2025-11-27
25
+ changes: Release Compiler
26
+ ---
27
+
28
+ # Intlayer Compiler | i18n के लिए स्वचालित सामग्री निष्कर्षण
29
+
30
+ ## Intlayer Compiler क्या है?
31
+
32
+ **Intlayer Compiler** एक शक्तिशाली उपकरण है जिसे आपके एप्लिकेशन में अंतरराष्ट्रीयकरण (i18n) की प्रक्रिया को स्वचालित करने के लिए डिज़ाइन किया गया है। यह आपके स्रोत कोड (JSX, TSX, Vue, Svelte) में सामग्री घोषणाओं को स्कैन करता है, उन्हें निकालता है, और आवश्यक शब्दकोश फ़ाइलों को स्वचालित रूप से उत्पन्न करता है। यह आपको अपनी सामग्री को आपके कंपोनेंट्स के साथ सह-स्थित रखने की अनुमति देता है जबकि Intlayer आपके शब्दकोशों के प्रबंधन और समन्वय को संभालता है।
33
+
34
+ ## Intlayer Compiler का उपयोग क्यों करें?
35
+
36
+ - **स्वचालन**: सामग्री को शब्दकोशों में मैन्युअल कॉपी-पेस्ट करने की आवश्यकता समाप्त करता है।
37
+ - **गति**: अनुकूलित सामग्री निष्कर्षण सुनिश्चित करता है कि आपका बिल्ड प्रक्रिया तेज़ बनी रहे।
38
+ - **डेवलपर अनुभव**: सामग्री घोषणाओं को वहीं रखें जहां उनका उपयोग होता है, जिससे रखरखाव में सुधार होता है।
39
+ - **लाइव अपडेट्स**: विकास के दौरान त्वरित प्रतिक्रिया के लिए Hot Module Replacement (HMR) का समर्थन करता है।
40
+
41
+ गहरे तुलना के लिए [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/en/compiler_vs_declarative_i18n.md) ब्लॉग पोस्ट देखें।
42
+
43
+ ## Intlayer Compiler का उपयोग क्यों न करें?
44
+
45
+ हालांकि कंपाइलर एक उत्कृष्ट "बस काम करता है" अनुभव प्रदान करता है, यह कुछ समझौते भी पेश करता है जिनके बारे में आपको पता होना चाहिए:
46
+
47
+ - **हेयूरिस्टिक अस्पष्टता**: कंपाइलर को यह अनुमान लगाना होगा कि उपयोगकर्ता-सामना करने वाली सामग्री बनाम एप्लिकेशन लॉजिक क्या है (उदाहरण के लिए, `className="active"`, स्थिति कोड, उत्पाद ID)। जटिल कोडबेस में, यह गलत सकारात्मक या छूटी हुई स्ट्रिंग्स का कारण बन सकता है जिन्हें मैन्युअल एनोटेशन और अपवादों की आवश्यकता होती है।
48
+ - **केवल स्थैतिक निष्कर्षण**: कंपाइलर-आधारित निष्कर्षण स्थैतिक विश्लेषण पर निर्भर करता है। स्ट्रिंग्स जो केवल रनटाइम पर मौजूद होती हैं (API त्रुटि कोड, CMS फ़ील्ड, आदि) को कंपाइलर द्वारा अकेले खोजा या अनुवादित नहीं किया जा सकता है, इसलिए आपको अभी भी एक पूरक रनटाइम i18n रणनीति की आवश्यकता है।
49
+
50
+ गहरी वास्तुकला तुलना के लिए, [Compiler vs. Declarative i18n](https://github.com/aymericzip/intlayer/blob/main/docs/blog/en/compiler_vs_declarative_i18n.md) ब्लॉग पोस्ट देखें।
51
+
52
+ वैकल्पिक रूप से, अपनी सामग्री पर पूर्ण नियंत्रण रखते हुए अपनी i18n प्रक्रिया को स्वचालित करने के लिए, Intlayer एक स्वचालित निष्कर्षण कमांड `intlayer transform` (देखें [CLI दस्तावेज़ीकरण](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/cli/transform.md)) या Intlayer VS Code एक्सटेंशन का `Intlayer: extract content to Dictionary` कमांड (देखें [VS Code एक्सटेंशन दस्तावेज़ीकरण](https://github.com/aymericzip/intlayer/blob/main/docs/docs/hi/vs_code_extension.md)) भी प्रदान करता है।
53
+
54
+ ## उपयोग
55
+
56
+ ### Vite
57
+
58
+ Vite-आधारित एप्लिकेशन (React, Vue, Svelte, आदि) के लिए, कंपाइलर का उपयोग करने का सबसे आसान तरीका `vite-intlayer` प्लगइन के माध्यम से है।
59
+
60
+ #### स्थापना
61
+
62
+ ```bash
63
+ npm install vite-intlayer
64
+ ```
65
+
66
+ #### कॉन्फ़िगरेशन
67
+
68
+ अपने `vite.config.ts` को अपडेट करें ताकि `intlayerCompiler` प्लगइन शामिल हो:
69
+
70
+ ```ts fileName="vite.config.ts"
71
+ import { defineConfig } from "vite";
72
+ import { intlayer, intlayerCompiler } from "vite-intlayer";
73
+
74
+ export default defineConfig({
75
+ plugins: [
76
+ intlayer(),
77
+ intlayerCompiler(), // कंपाइलर प्लगइन जोड़ता है
78
+ ],
79
+ });
80
+ ```
81
+
82
+ #### फ्रेमवर्क समर्थन
83
+
84
+ Vite प्लगइन स्वचालित रूप से विभिन्न फ़ाइल प्रकारों का पता लगाता है और उन्हें संभालता है:
85
+
86
+ - **React / JSX / TSX**: मूल रूप से संभाला जाता है।
87
+ - **Vue**: इसके लिए `@intlayer/vue-compiler` आवश्यक है।
88
+ - **Svelte**: इसके लिए `@intlayer/svelte-compiler` आवश्यक है।
89
+
90
+ सुनिश्चित करें कि आपने अपने फ्रेमवर्क के लिए उपयुक्त कंपाइलर पैकेज इंस्टॉल किया है:
91
+
92
+ ```bash
93
+ # Vue के लिए
94
+ npm install @intlayer/vue-compiler
95
+
96
+ # Svelte के लिए
97
+ npm install @intlayer/svelte-compiler
98
+ ```
99
+
100
+ ### Next.js (Babel)
101
+
102
+ Next.js या अन्य Webpack-आधारित एप्लिकेशन जो Babel का उपयोग करते हैं, उनके लिए आप `@intlayer/babel` प्लगइन का उपयोग करके कंपाइलर को कॉन्फ़िगर कर सकते हैं।
103
+
104
+ #### स्थापना
105
+
106
+ ```bash
107
+ npm install @intlayer/babel
108
+ ```
109
+
110
+ #### कॉन्फ़िगरेशन
111
+
112
+ अपना `babel.config.js` (या `babel.config.json`) अपडेट करें ताकि extraction प्लगइन शामिल हो सके। हम एक हेल्पर `getExtractPluginOptions` प्रदान करते हैं जो आपके Intlayer कॉन्फ़िगरेशन को स्वचालित रूप से लोड करता है।
113
+
114
+ ```js fileName="babel.config.js"
115
+ const {
116
+ intlayerExtractBabelPlugin,
117
+ intlayerOptimizeBabelPlugin,
118
+ getExtractPluginOptions,
119
+ getOptimizePluginOptions,
120
+ } = require("@intlayer/babel");
121
+
122
+ module.exports = {
123
+ presets: ["next/babel"],
124
+ plugins: [
125
+ // Extract content from components into dictionaries
126
+ [intlayerExtractBabelPlugin, getExtractPluginOptions()],
127
+ // Optimize imports by replacing useIntlayer with direct dictionary imports
128
+ [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],
129
+ ],
130
+ };
131
+ ```
132
+
133
+ यह कॉन्फ़िगरेशन सुनिश्चित करता है कि आपके कंपोनेंट्स में घोषित सामग्री स्वचालित रूप से निकाली जाए और आपके बिल्ड प्रक्रिया के दौरान शब्दकोश बनाने के लिए उपयोग की जाए।
@@ -153,9 +153,13 @@ const content = useIntlayer("my-key");
153
153
  // Kode yang Dioptimalkan (Dinamis)
154
154
  const content = useDictionaryAsync({
155
155
  en: () =>
156
- import(".intlayer/dynamic_dictionary/en.json").then((mod) => mod.default),
156
+ import(".intlayer/dynamic_dictionary/my-key/en.json").then(
157
+ (mod) => mod.default
158
+ ),
157
159
  fr: () =>
158
- import(".intlayer/dynamic_dictionary/fr.json").then((mod) => mod.default),
160
+ import(".intlayer/dynamic_dictionary/my-key/fr.json").then(
161
+ (mod) => mod.default
162
+ ),
159
163
  });
160
164
  ```
161
165