@intlayer/docs 7.5.12 → 7.5.13

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 (197) hide show
  1. package/blog/uk/compiler_vs_declarative_i18n.md +224 -0
  2. package/blog/uk/i18n_using_next-i18next.md +1086 -0
  3. package/blog/uk/i18n_using_next-intl.md +760 -0
  4. package/blog/uk/index.md +69 -0
  5. package/blog/uk/internationalization_and_SEO.md +273 -0
  6. package/blog/uk/intlayer_with_i18next.md +211 -0
  7. package/blog/uk/intlayer_with_next-i18next.md +202 -0
  8. package/blog/uk/intlayer_with_next-intl.md +203 -0
  9. package/blog/uk/intlayer_with_react-i18next.md +200 -0
  10. package/blog/uk/intlayer_with_react-intl.md +202 -0
  11. package/blog/uk/intlayer_with_vue-i18n.md +206 -0
  12. package/blog/uk/l10n_platform_alternative/Lokalise.md +80 -0
  13. package/blog/uk/l10n_platform_alternative/crowdin.md +80 -0
  14. package/blog/uk/l10n_platform_alternative/phrase.md +78 -0
  15. package/blog/uk/list_i18n_technologies/CMS/drupal.md +143 -0
  16. package/blog/uk/list_i18n_technologies/CMS/wix.md +167 -0
  17. package/blog/uk/list_i18n_technologies/CMS/wordpress.md +189 -0
  18. package/blog/uk/list_i18n_technologies/frameworks/angular.md +125 -0
  19. package/blog/uk/list_i18n_technologies/frameworks/flutter.md +128 -0
  20. package/blog/uk/list_i18n_technologies/frameworks/react-native.md +217 -0
  21. package/blog/uk/list_i18n_technologies/frameworks/react.md +155 -0
  22. package/blog/uk/list_i18n_technologies/frameworks/svelte.md +145 -0
  23. package/blog/uk/list_i18n_technologies/frameworks/vue.md +144 -0
  24. package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1499 -0
  25. package/blog/uk/nextjs-multilingual-seo-comparison.md +360 -0
  26. package/blog/uk/rag_powered_documentation_assistant.md +288 -0
  27. package/blog/uk/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
  28. package/blog/uk/vue-i18n_vs_intlayer.md +279 -0
  29. package/blog/uk/what_is_internationalization.md +167 -0
  30. package/dist/cjs/generated/frequentQuestions.entry.cjs +20 -0
  31. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  32. package/dist/esm/generated/frequentQuestions.entry.mjs +20 -0
  33. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  34. package/dist/types/generated/frequentQuestions.entry.d.ts +1 -0
  35. package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
  36. package/docs/ar/configuration.md +6 -1
  37. package/docs/ar/dictionary/content_file.md +6 -1
  38. package/docs/de/configuration.md +6 -1
  39. package/docs/de/dictionary/content_file.md +6 -1
  40. package/docs/en/configuration.md +6 -1
  41. package/docs/en/dictionary/content_file.md +6 -1
  42. package/docs/en-GB/configuration.md +6 -1
  43. package/docs/en-GB/dictionary/content_file.md +3 -1
  44. package/docs/es/configuration.md +6 -1
  45. package/docs/es/dictionary/content_file.md +6 -1
  46. package/docs/fr/configuration.md +6 -1
  47. package/docs/fr/dictionary/content_file.md +3 -1
  48. package/docs/hi/configuration.md +6 -1
  49. package/docs/hi/dictionary/content_file.md +3 -1
  50. package/docs/id/configuration.md +6 -1
  51. package/docs/id/dictionary/content_file.md +3 -1
  52. package/docs/it/configuration.md +6 -1
  53. package/docs/it/dictionary/content_file.md +3 -1
  54. package/docs/ja/configuration.md +6 -1
  55. package/docs/ja/dictionary/content_file.md +3 -1
  56. package/docs/ko/configuration.md +6 -1
  57. package/docs/ko/dictionary/content_file.md +3 -1
  58. package/docs/pl/configuration.md +3 -1
  59. package/docs/pl/dictionary/content_file.md +3 -1
  60. package/docs/pt/configuration.md +6 -1
  61. package/docs/pt/dictionary/content_file.md +3 -1
  62. package/docs/ru/configuration.md +6 -1
  63. package/docs/ru/dictionary/content_file.md +6 -1
  64. package/docs/tr/configuration.md +6 -1
  65. package/docs/tr/dictionary/content_file.md +3 -1
  66. package/docs/uk/CI_CD.md +198 -0
  67. package/docs/uk/autoFill.md +307 -0
  68. package/docs/uk/bundle_optimization.md +185 -0
  69. package/docs/uk/cli/build.md +64 -0
  70. package/docs/uk/cli/ci.md +137 -0
  71. package/docs/uk/cli/configuration.md +63 -0
  72. package/docs/uk/cli/debug.md +46 -0
  73. package/docs/uk/cli/doc-review.md +43 -0
  74. package/docs/uk/cli/doc-translate.md +132 -0
  75. package/docs/uk/cli/editor.md +28 -0
  76. package/docs/uk/cli/fill.md +130 -0
  77. package/docs/uk/cli/index.md +190 -0
  78. package/docs/uk/cli/init.md +84 -0
  79. package/docs/uk/cli/list.md +90 -0
  80. package/docs/uk/cli/list_projects.md +128 -0
  81. package/docs/uk/cli/live.md +41 -0
  82. package/docs/uk/cli/login.md +157 -0
  83. package/docs/uk/cli/pull.md +78 -0
  84. package/docs/uk/cli/push.md +98 -0
  85. package/docs/uk/cli/sdk.md +71 -0
  86. package/docs/uk/cli/test.md +76 -0
  87. package/docs/uk/cli/transform.md +65 -0
  88. package/docs/uk/cli/version.md +24 -0
  89. package/docs/uk/cli/watch.md +37 -0
  90. package/docs/uk/configuration.md +742 -0
  91. package/docs/uk/dictionary/condition.md +237 -0
  92. package/docs/uk/dictionary/content_file.md +1134 -0
  93. package/docs/uk/dictionary/enumeration.md +245 -0
  94. package/docs/uk/dictionary/file.md +232 -0
  95. package/docs/uk/dictionary/function_fetching.md +212 -0
  96. package/docs/uk/dictionary/gender.md +273 -0
  97. package/docs/uk/dictionary/insertion.md +187 -0
  98. package/docs/uk/dictionary/markdown.md +383 -0
  99. package/docs/uk/dictionary/nesting.md +273 -0
  100. package/docs/uk/dictionary/translation.md +332 -0
  101. package/docs/uk/formatters.md +595 -0
  102. package/docs/uk/how_works_intlayer.md +256 -0
  103. package/docs/uk/index.md +175 -0
  104. package/docs/uk/interest_of_intlayer.md +297 -0
  105. package/docs/uk/intlayer_CMS.md +569 -0
  106. package/docs/uk/intlayer_visual_editor.md +292 -0
  107. package/docs/uk/intlayer_with_angular.md +710 -0
  108. package/docs/uk/intlayer_with_astro.md +256 -0
  109. package/docs/uk/intlayer_with_create_react_app.md +1258 -0
  110. package/docs/uk/intlayer_with_express.md +429 -0
  111. package/docs/uk/intlayer_with_fastify.md +446 -0
  112. package/docs/uk/intlayer_with_lynx+react.md +548 -0
  113. package/docs/uk/intlayer_with_nestjs.md +283 -0
  114. package/docs/uk/intlayer_with_next-i18next.md +640 -0
  115. package/docs/uk/intlayer_with_next-intl.md +456 -0
  116. package/docs/uk/intlayer_with_nextjs_page_router.md +1541 -0
  117. package/docs/uk/intlayer_with_nuxt.md +711 -0
  118. package/docs/uk/intlayer_with_react_router_v7.md +600 -0
  119. package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +669 -0
  120. package/docs/uk/intlayer_with_svelte_kit.md +579 -0
  121. package/docs/uk/intlayer_with_tanstack.md +818 -0
  122. package/docs/uk/intlayer_with_vite+preact.md +1748 -0
  123. package/docs/uk/intlayer_with_vite+react.md +1449 -0
  124. package/docs/uk/intlayer_with_vite+solid.md +302 -0
  125. package/docs/uk/intlayer_with_vite+svelte.md +520 -0
  126. package/docs/uk/intlayer_with_vite+vue.md +1113 -0
  127. package/docs/uk/introduction.md +222 -0
  128. package/docs/uk/locale_mapper.md +242 -0
  129. package/docs/uk/mcp_server.md +211 -0
  130. package/docs/uk/packages/express-intlayer/t.md +465 -0
  131. package/docs/uk/packages/intlayer/getEnumeration.md +159 -0
  132. package/docs/uk/packages/intlayer/getHTMLTextDir.md +121 -0
  133. package/docs/uk/packages/intlayer/getLocaleLang.md +81 -0
  134. package/docs/uk/packages/intlayer/getLocaleName.md +135 -0
  135. package/docs/uk/packages/intlayer/getLocalizedUrl.md +338 -0
  136. package/docs/uk/packages/intlayer/getMultilingualUrls.md +359 -0
  137. package/docs/uk/packages/intlayer/getPathWithoutLocale.md +75 -0
  138. package/docs/uk/packages/intlayer/getPrefix.md +213 -0
  139. package/docs/uk/packages/intlayer/getTranslation.md +190 -0
  140. package/docs/uk/packages/intlayer/getTranslationContent.md +189 -0
  141. package/docs/uk/packages/next-intlayer/t.md +365 -0
  142. package/docs/uk/packages/next-intlayer/useDictionary.md +276 -0
  143. package/docs/uk/packages/next-intlayer/useIntlayer.md +263 -0
  144. package/docs/uk/packages/next-intlayer/useLocale.md +166 -0
  145. package/docs/uk/packages/react-intlayer/t.md +311 -0
  146. package/docs/uk/packages/react-intlayer/useDictionary.md +295 -0
  147. package/docs/uk/packages/react-intlayer/useI18n.md +250 -0
  148. package/docs/uk/packages/react-intlayer/useIntlayer.md +251 -0
  149. package/docs/uk/packages/react-intlayer/useLocale.md +210 -0
  150. package/docs/uk/per_locale_file.md +345 -0
  151. package/docs/uk/plugins/sync-json.md +398 -0
  152. package/docs/uk/readme.md +265 -0
  153. package/docs/uk/releases/v6.md +305 -0
  154. package/docs/uk/releases/v7.md +624 -0
  155. package/docs/uk/roadmap.md +346 -0
  156. package/docs/uk/testing.md +204 -0
  157. package/docs/vi/configuration.md +6 -1
  158. package/docs/vi/dictionary/content_file.md +6 -1
  159. package/docs/zh/configuration.md +6 -1
  160. package/docs/zh/dictionary/content_file.md +6 -1
  161. package/frequent_questions/ar/error-vite-env-only.md +77 -0
  162. package/frequent_questions/de/error-vite-env-only.md +77 -0
  163. package/frequent_questions/en/error-vite-env-only.md +77 -0
  164. package/frequent_questions/en-GB/error-vite-env-only.md +77 -0
  165. package/frequent_questions/es/error-vite-env-only.md +76 -0
  166. package/frequent_questions/fr/error-vite-env-only.md +77 -0
  167. package/frequent_questions/hi/error-vite-env-only.md +77 -0
  168. package/frequent_questions/id/error-vite-env-only.md +77 -0
  169. package/frequent_questions/it/error-vite-env-only.md +77 -0
  170. package/frequent_questions/ja/error-vite-env-only.md +77 -0
  171. package/frequent_questions/ko/error-vite-env-only.md +77 -0
  172. package/frequent_questions/pl/error-vite-env-only.md +77 -0
  173. package/frequent_questions/pt/error-vite-env-only.md +77 -0
  174. package/frequent_questions/ru/error-vite-env-only.md +77 -0
  175. package/frequent_questions/tr/error-vite-env-only.md +77 -0
  176. package/frequent_questions/uk/SSR_Next_no_[locale].md +104 -0
  177. package/frequent_questions/uk/array_as_content_declaration.md +72 -0
  178. package/frequent_questions/uk/build_dictionaries.md +58 -0
  179. package/frequent_questions/uk/build_error_CI_CD.md +74 -0
  180. package/frequent_questions/uk/bun_set_up.md +53 -0
  181. package/frequent_questions/uk/customized_locale_list.md +64 -0
  182. package/frequent_questions/uk/domain_routing.md +113 -0
  183. package/frequent_questions/uk/error-vite-env-only.md +77 -0
  184. package/frequent_questions/uk/esbuild_error.md +29 -0
  185. package/frequent_questions/uk/get_locale_cookie.md +142 -0
  186. package/frequent_questions/uk/intlayer_command_undefined.md +155 -0
  187. package/frequent_questions/uk/locale_incorect_in_url.md +73 -0
  188. package/frequent_questions/uk/package_version_error.md +181 -0
  189. package/frequent_questions/uk/static_rendering.md +44 -0
  190. package/frequent_questions/uk/translated_path_url.md +55 -0
  191. package/frequent_questions/uk/unknown_command.md +97 -0
  192. package/frequent_questions/vi/error-vite-env-only.md +77 -0
  193. package/frequent_questions/zh/error-vite-env-only.md +77 -0
  194. package/legal/uk/privacy_notice.md +83 -0
  195. package/legal/uk/terms_of_service.md +55 -0
  196. package/package.json +6 -6
  197. package/src/generated/frequentQuestions.entry.ts +20 -0
@@ -0,0 +1,383 @@
1
+ ---
2
+ createdAt: 2025-02-07
3
+ updatedAt: 2025-06-29
4
+ title: Markdown
5
+ description: "Дізнайтеся, як оголошувати та використовувати контент у форматі Markdown на вашому багатомовному вебсайті з Intlayer. Дотримуйтесь кроків у цій онлайн-документації, щоб безшовно інтегрувати Markdown у ваш проєкт."
6
+ keywords:
7
+ - Markdown
8
+ - Internationalization
9
+ - Documentation
10
+ - Intlayer
11
+ - Next.js
12
+ - JavaScript
13
+ - React
14
+ slugs:
15
+ - doc
16
+ - concept
17
+ - content
18
+ - markdown
19
+ history:
20
+ - version: 5.5.10
21
+ date: 2025-06-29
22
+ changes: Ініціалізація історії
23
+ ---
24
+
25
+ # Markdown / Форматований текст
26
+
27
+ ## Як працює Markdown
28
+
29
+ Intlayer підтримує контент у форматі rich text, визначений за допомогою синтаксису Markdown. Це досягається за допомогою функції `md`, яка перетворює рядок у форматі Markdown у формат, яким може керувати Intlayer. Використовуючи Markdown, ви можете легко писати й підтримувати контент із багатим форматуванням, наприклад блоги, статті та інше.
30
+
31
+ [Візуальний редактор Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_visual_editor.md) та [Intlayer CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_CMS.md) обидва підтримують керування контентом у Markdown.
32
+
33
+ Під час інтеграції з React-додатком ви можете використовувати провайдера рендерингу Markdown (наприклад, [`markdown-to-jsx`](https://www.npmjs.com/package/markdown-to-jsx)), щоб перетворювати вміст Markdown на HTML. Це дозволяє писати контент у Markdown і забезпечує його коректне відображення в вашому додатку.
34
+
35
+ ## Налаштування Markdown-контенту
36
+
37
+ Щоб налаштувати Markdown-контент у вашому проєкті Intlayer, визначте словник контенту, що використовує функцію `md`.
38
+
39
+ ```typescript fileName="markdownDictionary.content.ts" contentDeclarationFormat="typescript"
40
+ import { md, type Dictionary } from "intlayer";
41
+
42
+ const markdownDictionary = {
43
+ key: "app",
44
+ content: {
45
+ myMarkdownContent: md("## My title \n\nLorem Ipsum"),
46
+ },
47
+ } satisfies Dictionary;
48
+
49
+ export default markdownDictionary;
50
+ ```
51
+
52
+ ```javascript fileName="markdownDictionary.content.mjs" contentDeclarationFormat="esm"
53
+ import { md } from "intlayer";
54
+
55
+ // Тип словника Intlayer: import('intlayer').Dictionary
56
+ /** @type {import('intlayer').Dictionary} */
57
+ const markdownDictionary = {
58
+ key: "app",
59
+ content: {
60
+ myMarkdownContent: md("## Мій заголовок \n\nLorem Ipsum"),
61
+ },
62
+ };
63
+
64
+ export default markdownDictionary;
65
+ ```
66
+
67
+ ```javascript fileName="markdownDictionary.content.cjs" contentDeclarationFormat="commonjs"
68
+ const { md } = require("intlayer");
69
+
70
+ // Тип словника Intlayer: import('intlayer').Dictionary
71
+ /** @type {import('intlayer').Dictionary} */
72
+ const markdownDictionary = {
73
+ key: "app",
74
+ content: {
75
+ myMarkdownContent: md("## Мій заголовок \n\nLorem Ipsum"),
76
+ },
77
+ };
78
+
79
+ module.exports = markdownDictionary;
80
+ ```
81
+
82
+ ```json fileName="markdownDictionary.content.json" contentDeclarationFormat="json"
83
+ {
84
+ "$schema": "https://intlayer.org/schema.json",
85
+ "key": "app",
86
+ "content": {
87
+ "myMarkdownContent": {
88
+ "nodeType": "markdown",
89
+ "markdown": "## My title \n\nLorem Ipsum"
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Імпорт (багатомовний) файлу `.md`
96
+
97
+ Якщо ваш Markdown-файл має розширення `.md`, ви можете імпортувати його за допомогою різних форматів імпорту, які надає JavaScript або Intlayer.
98
+
99
+ Рекомендується віддавати перевагу імпорту через функцію [`file`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/dictionary/file.md), оскільки вона дозволяє Intlayer коректно керувати шляхами відносно розташування файлу та забезпечує інтеграцію цього файлу з Візуальним редактором / CMS.
100
+
101
+ ```typescript fileName="md.d.ts" contentDeclarationFormat="typescript"
102
+ // Ця декларація дозволяє TypeScript розпізнавати та імпортувати Markdown (.md) файли як модулі.
103
+ // Без цього TypeScript викинув би помилку при спробі імпортувати Markdown-файли,
104
+ // оскільки він за замовчуванням не підтримує імпорт нечітких файлів (non-code files).
105
+
106
+ declare module "*.md";
107
+ ```
108
+
109
+ ```typescript fileName="markdownDictionary.content.ts" contentDeclarationFormat="typescript"
110
+ import { md, file, t, type Dictionary } from "intlayer";
111
+ import { readFileSync } from "fs";
112
+ import { resolve } from "path";
113
+
114
+ import markdown from "./myMarkdown.md";
115
+
116
+ const markdownDictionary = {
117
+ key: "app",
118
+ content: {
119
+ contentMultilingualFile: t({
120
+ en: md(file("./myMarkdown.en.md")),
121
+ fr: md(file("./myMarkdown.fr.md")),
122
+ es: md(file("./myMarkdown.es.md")),
123
+ }),
124
+
125
+ contentImport: md(markdown),
126
+ contentRequire: md(require("./myMarkdown.md")),
127
+ contentAsyncImport: md(
128
+ import("./myMarkdown.md").then((module) => module.default)
129
+ ),
130
+ contentFetch: md(fetch("https://example.com").then((res) => res.text())),
131
+ contentFS: md(() => {
132
+ const filePath = resolve(process.cwd(), "doc/test.md");
133
+ return readFileSync(filePath, "utf8");
134
+ }),
135
+ },
136
+ } satisfies Dictionary;
137
+
138
+ export default markdownDictionary;
139
+ ```
140
+
141
+ ```javascript fileName="markdownDictionary.content.mjs" contentDeclarationFormat="esm"
142
+ import { md, file, t } from "intlayer";
143
+ import { readFileSync } from "fs";
144
+ import { resolve } from "path";
145
+
146
+ import markdown from "./myMarkdown.md";
147
+
148
+ /** @type {import('intlayer').Dictionary} */
149
+ const markdownDictionary = {
150
+ key: "app",
151
+ content: {
152
+ contentMultilingualFile: t({
153
+ en: md(file("./myMarkdown.en.md")),
154
+ uk: md(file("./myMarkdown.uk.md")),
155
+ fr: md(file("./myMarkdown.fr.md")),
156
+ es: md(file("./myMarkdown.es.md")),
157
+ }),
158
+
159
+ contentImport: md(markdown),
160
+ contentRequire: md(require("./myMarkdown.md")),
161
+ contentAsyncImport: md(
162
+ import("./myMarkdown.md").then((module) => module.default)
163
+ ),
164
+ contentFetch: md(fetch("https://example.com").then((res) => res.text())),
165
+ contentFS: md(() => {
166
+ const filePath = resolve(process.cwd(), "doc/test.md");
167
+ return readFileSync(filePath, "utf8");
168
+ }),
169
+ },
170
+ };
171
+
172
+ export default markdownDictionary;
173
+ ```
174
+
175
+ ```javascript fileName="markdownDictionary.content.cjs" contentDeclarationFormat="commonjs"
176
+ const { md, file, t } = require("intlayer");
177
+
178
+ const markdown_en = require("./myMarkdown.en.md");
179
+ const markdown_fr = require("./myMarkdown.fr.md");
180
+ const markdown_uk = require("./myMarkdown.uk.md");
181
+ const markdown_es = require("./myMarkdown.es.md");
182
+
183
+ /** @type {import('intlayer').Dictionary} */
184
+ const markdownDictionary = {
185
+ key: "app",
186
+ content: {
187
+ contentMultilingualFile: t({
188
+ en: md(file("./myMarkdown.en.md")),
189
+ fr: md(file("./myMarkdown.fr.md")),
190
+ es: md(file("./myMarkdown.es.md")),
191
+ }),
192
+
193
+ contentImport: md(markdown),
194
+ contentFetch: md(fetch("https://example.com").then((res) => res.text())),
195
+ contentFS: md(() => {
196
+ const filePath = resolve(process.cwd(), "doc/test.md");
197
+ return readFileSync(filePath, "utf8");
198
+ }),
199
+ },
200
+ };
201
+
202
+ module.exports = markdownDictionary;
203
+ ```
204
+
205
+ ```jsonc fileName="markdownDictionary.content.json" contentDeclarationFormat="json"
206
+ // - Імпорт зовнішніх файлів Markdown (.md) можливий лише за допомогою вузла `file` або деклараційних файлів JS чи TS.
207
+ // - Отримання зовнішнього вмісту Markdown можливе лише за допомогою деклараційних файлів JS або TS.
208
+
209
+ {
210
+ "$schema": "https://intlayer.org/schema.json",
211
+ "key": "app",
212
+ "content": {
213
+ "": {
214
+ "nodeType": "file",
215
+ "file": "./myMarkdown.md",
216
+ },
217
+ },
218
+
219
+ "contentMultilingualFile": {
220
+ "nodeType": "translation",
221
+ "translation": {
222
+ "en": {
223
+ "nodeType": "markdown",
224
+ "markdown": {
225
+ "nodeType": "file",
226
+ "file": "./myMarkdown.en.md",
227
+ },
228
+ },
229
+ "fr": {
230
+ "nodeType": "markdown",
231
+ "markdown": {
232
+ "nodeType": "file",
233
+ "file": "./myMarkdown.fr.md",
234
+ },
235
+ },
236
+ "es": {
237
+ "nodeType": "markdown",
238
+ "markdown": {
239
+ "nodeType": "file",
240
+ "file": "./myMarkdown.es.md",
241
+ },
242
+ },
243
+ },
244
+ },
245
+ },
246
+ }
247
+ ```
248
+
249
+ ## Використання Markdown з React Intlayer
250
+
251
+ Щоб відобразити вміст Markdown у React-застосунку, ви можете скористатися хуком `useIntlayer` з пакета `react-intlayer` разом із провайдером рендерингу Markdown. У цьому прикладі ми використовуємо пакет [`markdown-to-jsx`](https://www.npmjs.com/package/markdown-to-jsx) для конвертації Markdown у HTML.
252
+
253
+ ```tsx fileName="App.tsx" codeFormat="typescript"
254
+ import type { FC } from "react";
255
+ import { useIntlayer, MarkdownProvider } from "react-intlayer";
256
+ import Markdown from "markdown-to-jsx";
257
+
258
+ const AppContent: FC = () => {
259
+ const { myMarkdownContent } = useIntlayer("app");
260
+
261
+ return <>{myMarkdownContent}</>;
262
+ };
263
+
264
+ export const AppProvider: FC = () => (
265
+ <MarkdownProvider
266
+ renderMarkdown={(markdown) => <Markdown>{markdown}</Markdown>}
267
+ >
268
+ <AppContent />
269
+ </MarkdownProvider>
270
+ );
271
+ ```
272
+
273
+ ```jsx fileName="App.jsx" codeFormat="esm"
274
+ import { useIntlayer, MarkdownProvider } from "react-intlayer";
275
+ import Markdown from "markdown-to-jsx";
276
+
277
+ const AppContent = () => {
278
+ const { myMarkdownContent } = useIntlayer("app");
279
+
280
+ return <>{myMarkdownContent}</>;
281
+ };
282
+
283
+ export const AppProvider = () => (
284
+ <MarkdownProvider
285
+ renderMarkdown={(markdown) => <Markdown>{markdown}</Markdown>}
286
+ >
287
+ <AppContent />
288
+ </MarkdownProvider>
289
+ );
290
+ ```
291
+
292
+ ```jsx fileName="App.jsx" codeFormat="commonjs"
293
+ const { useIntlayer, MarkdownProvider } = require("react-intlayer");
294
+ const Markdown = require("markdown-to-jsx");
295
+
296
+ const AppContent = () => {
297
+ const { myMarkdownContent } = useIntlayer("app");
298
+
299
+ return <>{myMarkdownContent}</>;
300
+ };
301
+
302
+ AppProvider = () => (
303
+ <MarkdownProvider
304
+ renderMarkdown={(markdown) => <Markdown>{markdown}</Markdown>}
305
+ >
306
+ <AppContent />
307
+ </MarkdownProvider>
308
+ );
309
+
310
+ module.exports = {
311
+ AppProvider,
312
+ };
313
+ ```
314
+
315
+ У цій реалізації:
316
+
317
+ - Компонент `MarkdownProvider` обгортає застосунок (або відповідну його частину) та приймає функцію `renderMarkdown`. Ця функція використовується для перетворення рядків Markdown у JSX за допомогою пакету `markdown-to-jsx`.
318
+ - Хук `useIntlayer` використовується для отримання вмісту Markdown (`myMarkdownContent`) зі словника за ключем `"app"`.
319
+ - Вміст Markdown рендериться безпосередньо в компоненті, а рендеринг Markdown обробляється провайдером.
320
+
321
+ ### Використання Markdown з Next Intlayer
322
+
323
+ Реалізація з пакетом `next-intlayer` схожа на наведену вище. Єдина відмінність полягає в тому, що функцію `renderMarkdown` слід передати в компонент `MarkdownProvider` у клієнтському компоненті.
324
+
325
+ ```tsx title="src/providers/IntlayerMarkdownProvider.tsx" codeFormat="typescript"
326
+ "use client";
327
+
328
+ import type { FC, PropsWithChildren } from "react";
329
+ import { MarkdownProvider } from "next-intlayer";
330
+
331
+ const renderMarkdown = (markdown: string) => (
332
+ <span style={{ color: "red" }}>{markdown}</span>
333
+ );
334
+
335
+ export const IntlayerMarkdownProvider: FC<PropsWithChildren> = ({
336
+ children,
337
+ }) => (
338
+ <MarkdownProvider renderMarkdown={renderMarkdown}>
339
+ {children}
340
+ </MarkdownProvider>
341
+ );
342
+ ```
343
+
344
+ ```jsx title="src/providers/IntlayerMarkdownProvider.msx" codeFormat="esm"
345
+ "use client";
346
+
347
+ import { MarkdownProvider } from "next-intlayer";
348
+
349
+ const renderMarkdown = (markdown) => (
350
+ <span style={{ color: "red" }}>{markdown}</span>
351
+ );
352
+
353
+ export const IntlayerMarkdownProvider = ({ children }) => (
354
+ <MarkdownProvider renderMarkdown={renderMarkdown}>
355
+ {children}
356
+ </MarkdownProvider>
357
+ );
358
+ ```
359
+
360
+ ```jsx title="src/providers/IntlayerMarkdownProvider.csx" codeFormat="commonjs"
361
+ "use client";
362
+
363
+ const { MarkdownProvider } = require("next-intlayer");
364
+
365
+ const renderMarkdown = (markdown) => (
366
+ <span style={{ color: "red" }}>{markdown}</span>
367
+ );
368
+
369
+ const IntlayerMarkdownProvider = ({ children }) => (
370
+ <MarkdownProvider renderMarkdown={renderMarkdown}>
371
+ {children}
372
+ </MarkdownProvider>
373
+ );
374
+ ```
375
+
376
+ ## Додаткові ресурси
377
+
378
+ - [Документація Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/cli/index.md)
379
+ - [Документація Intlayer для React](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_with_create_react_app.md)
380
+ - [Документація Intlayer для Next.js](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_with_nextjs_15.md)
381
+ - [markdown-to-jsx на npm](https://www.npmjs.com/package/markdown-to-jsx)
382
+
383
+ Ці ресурси надають додаткову інформацію щодо налаштування та використання Intlayer з різними типами контенту та фреймворками.
@@ -0,0 +1,273 @@
1
+ ---
2
+ createdAt: 2025-02-07
3
+ updatedAt: 2025-06-29
4
+ title: Вкладення словника
5
+ description: Дізнайтесь, як використовувати вкладення контенту в Intlayer, щоб ефективно повторно використовувати та структурувати багатомовний контент. Дотримуйтесь цієї документації, щоб безшовно реалізувати вкладення у вашому проєкті.
6
+ keywords:
7
+ - Вкладення
8
+ - Повторне використання контенту
9
+ - Документація
10
+ - Intlayer
11
+ - Next.js
12
+ - JavaScript
13
+ - React
14
+ slugs:
15
+ - doc
16
+ - concept
17
+ - content
18
+ - nesting
19
+ history:
20
+ - version: 5.5.10
21
+ date: 2025-06-29
22
+ changes: Ініціалізація історії
23
+ ---
24
+
25
+ # Вкладення / Посилання на підконтент
26
+
27
+ ## Як працює вкладення
28
+
29
+ У Intlayer вкладення реалізується за допомогою функції `nest`, яка дозволяє посилатися на контент з іншого словника та повторно його використовувати. Замість дублювання контенту ви можете вказати на існуючий модуль контенту за його ключем.
30
+
31
+ ## Налаштування вкладення
32
+
33
+ Щоб налаштувати вкладення у вашому проєкті Intlayer, спочатку визначте базовий контент, який ви хочете повторно використовувати. Далі, у окремому модулі контенту, використайте функцію `nest` для імпорту цього контенту.
34
+
35
+ ### Базовий словник
36
+
37
+ Нижче наведено приклад базового словника, який можна вкладати в інший словник:
38
+
39
+ ```typescript fileName="firstDictionary.content.ts" contentDeclarationFormat="typescript"
40
+ import { type Dictionary } from "intlayer";
41
+
42
+ const firstDictionary = {
43
+ key: "key_of_my_first_dictionary",
44
+ content: {
45
+ content: "content",
46
+ subContent: {
47
+ contentNumber: 0,
48
+ contentString: "string",
49
+ },
50
+ },
51
+ } satisfies Dictionary;
52
+
53
+ export default firstDictionary;
54
+ ```
55
+
56
+ ```javascript fileName="firstDictionary.content.mjs" contentDeclarationFormat="esm"
57
+ /** @type {import('intlayer').Dictionary} */
58
+ const firstDictionary = {
59
+ key: "key_of_my_first_dictionary",
60
+ content: {
61
+ content: "content",
62
+ subContent: {
63
+ contentNumber: 0,
64
+ contentString: "string",
65
+ },
66
+ },
67
+ };
68
+
69
+ export default firstDictionary;
70
+ ```
71
+
72
+ ```javascript fileName="firstDictionary.content.cjs" contentDeclarationFormat="commonjs"
73
+ /** @type {import('intlayer').Dictionary} */
74
+ const firstDictionary = {
75
+ key: "key_of_my_first_dictionary",
76
+ content: {
77
+ content: "content",
78
+ subContent: {
79
+ contentNumber: 0,
80
+ contentString: "string",
81
+ },
82
+ },
83
+ };
84
+
85
+ module.exports = firstDictionary;
86
+ ```
87
+
88
+ ```json fileName="firstDictionary.content.json" contentDeclarationFormat="json"
89
+ {
90
+ "$schema": "https://intlayer.org/schema.json",
91
+ "key": "key_of_my_first_dictionary",
92
+ "content": {
93
+ "content": "content",
94
+ "subContent": {
95
+ "contentNumber": 0,
96
+ "contentString": "string"
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Посилання за допомогою nest
103
+
104
+ Тепер створіть інший модуль вмісту, який використовує функцію `nest` для посилання на наведений вище вміст. Ви можете посилатися на весь вміст або на конкретне вкладене значення:
105
+
106
+ ```typescript fileName="secondDictionary.content.ts" contentDeclarationFormat="typescript"
107
+ import { nest, type Dictionary } from "intlayer";
108
+
109
+ const myNestingContent = {
110
+ key: "key_of_my_second_dictionary",
111
+ content: {
112
+ // Посилання на весь словник:
113
+ fullNestedContent: nest("key_of_my_first_dictionary"),
114
+ // Посилання на конкретне вкладене значення:
115
+ partialNestedContent: nest(
116
+ "key_of_my_first_dictionary",
117
+ "subContent.contentNumber"
118
+ ),
119
+ },
120
+ } satisfies Dictionary;
121
+
122
+ export default myNestingContent;
123
+ ```
124
+
125
+ ```javascript fileName="secondDictionary.content.mjs" contentDeclarationFormat="esm"
126
+ import { nest } from "intlayer";
127
+
128
+ /** @type {import('intlayer').Dictionary} */
129
+ const myNestingContent = {
130
+ key: "key_of_my_second_dictionary",
131
+ content: {
132
+ fullNestedContent: nest("key_of_my_first_dictionary"),
133
+ partialNestedContent: nest(
134
+ "key_of_my_first_dictionary",
135
+ "subContent.contentNumber"
136
+ ),
137
+ },
138
+ };
139
+
140
+ export default myNestingContent;
141
+ ```
142
+
143
+ ```javascript fileName="secondDictionary.content.cjs" contentDeclarationFormat="commonjs"
144
+ const { nest } = require("intlayer");
145
+
146
+ /** @type {import('intlayer').Dictionary} */
147
+ const myNestingContent = {
148
+ key: "key_of_my_second_dictionary",
149
+ content: {
150
+ fullNestedContent: nest("key_of_my_first_dictionary"),
151
+ partialNestedContent: nest(
152
+ "key_of_my_first_dictionary",
153
+ "subContent.contentNumber"
154
+ ),
155
+ },
156
+ };
157
+
158
+ module.exports = myNestingContent;
159
+ ```
160
+
161
+ ```json fileName="secondDictionary.content.json" contentDeclarationFormat="json"
162
+ {
163
+ "$schema": "https://intlayer.org/schema.json",
164
+ "key": "key_of_my_second_dictionary",
165
+ "content": {
166
+ "fullNestedContent": {
167
+ "nodeType": "nested",
168
+ "nested": {
169
+ "dictionaryKey": "key_of_my_first_dictionary"
170
+ }
171
+ },
172
+ "partialNestedContent": {
173
+ "nodeType": "nested",
174
+ "nested": {
175
+ "dictionaryKey": "key_of_my_first_dictionary",
176
+ "path": "subContent.contentNumber"
177
+ }
178
+ }
179
+ }
180
+ }
181
+ ```
182
+
183
+ Як другий параметр ви можете вказати шлях до вкладеного значення в цьому вмісті. Якщо шлях не вказано, повертається весь вміст зазначеного словника.
184
+
185
+ ## Використання вкладення з React Intlayer
186
+
187
+ Щоб використовувати вкладений вміст у React-компоненті, скористайтеся хуком `useIntlayer` з пакету `react-intlayer`. Цей хук отримує відповідний вміст на основі вказаного ключа. Ось приклад того, як його використовувати:
188
+
189
+ ```tsx fileName="**/*.tsx" codeFormat="typescript"
190
+ import type { FC } from "react";
191
+ import { useIntlayer } from "react-intlayer";
192
+
193
+ const NestComponent: FC = () => {
194
+ const { fullNestedContent, partialNestedContent } = useIntlayer(
195
+ "key_of_my_second_dictionary"
196
+ );
197
+
198
+ return (
199
+ <div>
200
+ <p>
201
+ Full Nested Content: {JSON.stringify(fullNestedContent)}
202
+ {/* Вивід: {"content": "content", "subContent": {"contentNumber": 0, "contentString": "string"}} */}
203
+ </p>
204
+ <p>
205
+ Часткове вкладене значення: {partialNestedContent}
206
+ {/* Вивід: 0 */}
207
+ </p>
208
+ </div>
209
+ );
210
+ };
211
+
212
+ export default NestComponent;
213
+ ```
214
+
215
+ ```javascript fileName="**/*.mjx" codeFormat="esm"
216
+ import { useIntlayer } from "react-intlayer";
217
+
218
+ const NestComponent = () => {
219
+ const { fullNestedContent, partialNestedContent } = useIntlayer(
220
+ "key_of_my_second_dictionary"
221
+ );
222
+
223
+ return (
224
+ <div>
225
+ <p>
226
+ Повний вкладений вміст: {JSON.stringify(fullNestedContent)}
227
+ {/* Вивід: {"content": "content", "subContent": {"contentNumber": 0, "contentString": "string"}} */}
228
+ </p>
229
+ <p>
230
+ Часткове вкладене значення: {partialNestedContent}
231
+ {/* Вивід: 0 */}
232
+ </p>
233
+ </div>
234
+ );
235
+ };
236
+
237
+ export default NestComponent;
238
+ ```
239
+
240
+ ```javascript fileName="**/*.cjx" codeFormat="commonjs"
241
+ const { useIntlayer } = require("react-intlayer");
242
+
243
+ const NestComponent = () => {
244
+ const { fullNestedContent, partialNestedContent } = useIntlayer(
245
+ "key_of_my_second_dictionary"
246
+ );
247
+
248
+ return (
249
+ <div>
250
+ <p>
251
+ Full Nested Content: {JSON.stringify(fullNestedContent)}
252
+ {/* Вивід: {"content": "content", "subContent": {"contentNumber": 0, "contentString": "string"}} */}
253
+ </p>
254
+ <p>
255
+ Partial Nested Value: {partialNestedContent}
256
+ {/* Вивід: 0 */}
257
+ </p>
258
+ </div>
259
+ );
260
+ };
261
+
262
+ module.exports = NestComponent;
263
+ ```
264
+
265
+ ## Додаткові ресурси
266
+
267
+ Для детальнішої інформації щодо конфігурації та використання зверніться до наступних ресурсів:
268
+
269
+ - [Документація Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/cli/index.md)
270
+ - [Документація React Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_with_create_react_app.md)
271
+ - [Документація Next Intlayer](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/intlayer_with_nextjs_15.md)
272
+
273
+ Ці ресурси надають додаткові відомості щодо налаштування та використання Intlayer в різних середовищах та з різними фреймворками.