@intlayer/docs 7.5.12 → 7.5.14

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 (229) hide show
  1. package/blog/ar/per-component_vs_centralized_i18n.md +248 -0
  2. package/blog/de/per-component_vs_centralized_i18n.md +248 -0
  3. package/blog/en/_per-component_vs_centralized_i18n.md +252 -0
  4. package/blog/en/per-component_vs_centralized_i18n.md +248 -0
  5. package/blog/en-GB/per-component_vs_centralized_i18n.md +247 -0
  6. package/blog/es/per-component_vs_centralized_i18n.md +245 -0
  7. package/blog/fr/per-component_vs_centralized_i18n.md +245 -0
  8. package/blog/hi/per-component_vs_centralized_i18n.md +249 -0
  9. package/blog/id/per-component_vs_centralized_i18n.md +248 -0
  10. package/blog/it/per-component_vs_centralized_i18n.md +247 -0
  11. package/blog/ja/per-component_vs_centralized_i18n.md +247 -0
  12. package/blog/ko/per-component_vs_centralized_i18n.md +246 -0
  13. package/blog/pl/per-component_vs_centralized_i18n.md +247 -0
  14. package/blog/pt/per-component_vs_centralized_i18n.md +246 -0
  15. package/blog/ru/per-component_vs_centralized_i18n.md +251 -0
  16. package/blog/tr/per-component_vs_centralized_i18n.md +244 -0
  17. package/blog/uk/compiler_vs_declarative_i18n.md +224 -0
  18. package/blog/uk/i18n_using_next-i18next.md +1086 -0
  19. package/blog/uk/i18n_using_next-intl.md +760 -0
  20. package/blog/uk/index.md +69 -0
  21. package/blog/uk/internationalization_and_SEO.md +273 -0
  22. package/blog/uk/intlayer_with_i18next.md +211 -0
  23. package/blog/uk/intlayer_with_next-i18next.md +202 -0
  24. package/blog/uk/intlayer_with_next-intl.md +203 -0
  25. package/blog/uk/intlayer_with_react-i18next.md +200 -0
  26. package/blog/uk/intlayer_with_react-intl.md +202 -0
  27. package/blog/uk/intlayer_with_vue-i18n.md +206 -0
  28. package/blog/uk/l10n_platform_alternative/Lokalise.md +80 -0
  29. package/blog/uk/l10n_platform_alternative/crowdin.md +80 -0
  30. package/blog/uk/l10n_platform_alternative/phrase.md +78 -0
  31. package/blog/uk/list_i18n_technologies/CMS/drupal.md +143 -0
  32. package/blog/uk/list_i18n_technologies/CMS/wix.md +167 -0
  33. package/blog/uk/list_i18n_technologies/CMS/wordpress.md +189 -0
  34. package/blog/uk/list_i18n_technologies/frameworks/angular.md +125 -0
  35. package/blog/uk/list_i18n_technologies/frameworks/flutter.md +128 -0
  36. package/blog/uk/list_i18n_technologies/frameworks/react-native.md +217 -0
  37. package/blog/uk/list_i18n_technologies/frameworks/react.md +155 -0
  38. package/blog/uk/list_i18n_technologies/frameworks/svelte.md +145 -0
  39. package/blog/uk/list_i18n_technologies/frameworks/vue.md +144 -0
  40. package/blog/uk/next-i18next_vs_next-intl_vs_intlayer.md +1499 -0
  41. package/blog/uk/nextjs-multilingual-seo-comparison.md +360 -0
  42. package/blog/uk/per-component_vs_centralized_i18n.md +248 -0
  43. package/blog/uk/rag_powered_documentation_assistant.md +288 -0
  44. package/blog/uk/react-i18next_vs_react-intl_vs_intlayer.md +164 -0
  45. package/blog/uk/vue-i18n_vs_intlayer.md +279 -0
  46. package/blog/uk/what_is_internationalization.md +167 -0
  47. package/blog/vi/per-component_vs_centralized_i18n.md +246 -0
  48. package/blog/zh/per-component_vs_centralized_i18n.md +248 -0
  49. package/dist/cjs/common.cjs.map +1 -1
  50. package/dist/cjs/generated/blog.entry.cjs +20 -0
  51. package/dist/cjs/generated/blog.entry.cjs.map +1 -1
  52. package/dist/cjs/generated/docs.entry.cjs.map +1 -1
  53. package/dist/cjs/generated/frequentQuestions.entry.cjs +20 -0
  54. package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
  55. package/dist/cjs/generated/legal.entry.cjs.map +1 -1
  56. package/dist/esm/common.mjs.map +1 -1
  57. package/dist/esm/generated/blog.entry.mjs +20 -0
  58. package/dist/esm/generated/blog.entry.mjs.map +1 -1
  59. package/dist/esm/generated/docs.entry.mjs.map +1 -1
  60. package/dist/esm/generated/frequentQuestions.entry.mjs +20 -0
  61. package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
  62. package/dist/esm/generated/legal.entry.mjs.map +1 -1
  63. package/dist/types/generated/blog.entry.d.ts +1 -0
  64. package/dist/types/generated/blog.entry.d.ts.map +1 -1
  65. package/dist/types/generated/frequentQuestions.entry.d.ts +1 -0
  66. package/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
  67. package/docs/ar/configuration.md +6 -1
  68. package/docs/ar/dictionary/content_file.md +6 -1
  69. package/docs/de/configuration.md +6 -1
  70. package/docs/de/dictionary/content_file.md +6 -1
  71. package/docs/en/configuration.md +6 -1
  72. package/docs/en/dictionary/content_file.md +6 -1
  73. package/docs/en-GB/configuration.md +6 -1
  74. package/docs/en-GB/dictionary/content_file.md +3 -1
  75. package/docs/es/configuration.md +6 -1
  76. package/docs/es/dictionary/content_file.md +6 -1
  77. package/docs/fr/configuration.md +6 -1
  78. package/docs/fr/dictionary/content_file.md +3 -1
  79. package/docs/hi/configuration.md +6 -1
  80. package/docs/hi/dictionary/content_file.md +3 -1
  81. package/docs/id/configuration.md +6 -1
  82. package/docs/id/dictionary/content_file.md +3 -1
  83. package/docs/it/configuration.md +6 -1
  84. package/docs/it/dictionary/content_file.md +3 -1
  85. package/docs/ja/configuration.md +6 -1
  86. package/docs/ja/dictionary/content_file.md +3 -1
  87. package/docs/ko/configuration.md +6 -1
  88. package/docs/ko/dictionary/content_file.md +3 -1
  89. package/docs/pl/configuration.md +3 -1
  90. package/docs/pl/dictionary/content_file.md +3 -1
  91. package/docs/pt/configuration.md +6 -1
  92. package/docs/pt/dictionary/content_file.md +3 -1
  93. package/docs/ru/configuration.md +6 -1
  94. package/docs/ru/dictionary/content_file.md +6 -1
  95. package/docs/tr/configuration.md +6 -1
  96. package/docs/tr/dictionary/content_file.md +3 -1
  97. package/docs/uk/CI_CD.md +198 -0
  98. package/docs/uk/autoFill.md +307 -0
  99. package/docs/uk/bundle_optimization.md +185 -0
  100. package/docs/uk/cli/build.md +64 -0
  101. package/docs/uk/cli/ci.md +137 -0
  102. package/docs/uk/cli/configuration.md +63 -0
  103. package/docs/uk/cli/debug.md +46 -0
  104. package/docs/uk/cli/doc-review.md +43 -0
  105. package/docs/uk/cli/doc-translate.md +132 -0
  106. package/docs/uk/cli/editor.md +28 -0
  107. package/docs/uk/cli/fill.md +130 -0
  108. package/docs/uk/cli/index.md +190 -0
  109. package/docs/uk/cli/init.md +84 -0
  110. package/docs/uk/cli/list.md +90 -0
  111. package/docs/uk/cli/list_projects.md +128 -0
  112. package/docs/uk/cli/live.md +41 -0
  113. package/docs/uk/cli/login.md +157 -0
  114. package/docs/uk/cli/pull.md +78 -0
  115. package/docs/uk/cli/push.md +98 -0
  116. package/docs/uk/cli/sdk.md +71 -0
  117. package/docs/uk/cli/test.md +76 -0
  118. package/docs/uk/cli/transform.md +65 -0
  119. package/docs/uk/cli/version.md +24 -0
  120. package/docs/uk/cli/watch.md +37 -0
  121. package/docs/uk/configuration.md +742 -0
  122. package/docs/uk/dictionary/condition.md +237 -0
  123. package/docs/uk/dictionary/content_file.md +1134 -0
  124. package/docs/uk/dictionary/enumeration.md +245 -0
  125. package/docs/uk/dictionary/file.md +232 -0
  126. package/docs/uk/dictionary/function_fetching.md +212 -0
  127. package/docs/uk/dictionary/gender.md +273 -0
  128. package/docs/uk/dictionary/insertion.md +187 -0
  129. package/docs/uk/dictionary/markdown.md +383 -0
  130. package/docs/uk/dictionary/nesting.md +273 -0
  131. package/docs/uk/dictionary/translation.md +332 -0
  132. package/docs/uk/formatters.md +595 -0
  133. package/docs/uk/how_works_intlayer.md +256 -0
  134. package/docs/uk/index.md +175 -0
  135. package/docs/uk/interest_of_intlayer.md +297 -0
  136. package/docs/uk/intlayer_CMS.md +569 -0
  137. package/docs/uk/intlayer_visual_editor.md +292 -0
  138. package/docs/uk/intlayer_with_angular.md +710 -0
  139. package/docs/uk/intlayer_with_astro.md +256 -0
  140. package/docs/uk/intlayer_with_create_react_app.md +1258 -0
  141. package/docs/uk/intlayer_with_express.md +429 -0
  142. package/docs/uk/intlayer_with_fastify.md +446 -0
  143. package/docs/uk/intlayer_with_lynx+react.md +548 -0
  144. package/docs/uk/intlayer_with_nestjs.md +283 -0
  145. package/docs/uk/intlayer_with_next-i18next.md +640 -0
  146. package/docs/uk/intlayer_with_next-intl.md +456 -0
  147. package/docs/uk/intlayer_with_nextjs_page_router.md +1541 -0
  148. package/docs/uk/intlayer_with_nuxt.md +711 -0
  149. package/docs/uk/intlayer_with_react_router_v7.md +600 -0
  150. package/docs/uk/intlayer_with_react_router_v7_fs_routes.md +669 -0
  151. package/docs/uk/intlayer_with_svelte_kit.md +579 -0
  152. package/docs/uk/intlayer_with_tanstack.md +818 -0
  153. package/docs/uk/intlayer_with_vite+preact.md +1748 -0
  154. package/docs/uk/intlayer_with_vite+react.md +1449 -0
  155. package/docs/uk/intlayer_with_vite+solid.md +302 -0
  156. package/docs/uk/intlayer_with_vite+svelte.md +520 -0
  157. package/docs/uk/intlayer_with_vite+vue.md +1113 -0
  158. package/docs/uk/introduction.md +222 -0
  159. package/docs/uk/locale_mapper.md +242 -0
  160. package/docs/uk/mcp_server.md +211 -0
  161. package/docs/uk/packages/express-intlayer/t.md +465 -0
  162. package/docs/uk/packages/intlayer/getEnumeration.md +159 -0
  163. package/docs/uk/packages/intlayer/getHTMLTextDir.md +121 -0
  164. package/docs/uk/packages/intlayer/getLocaleLang.md +81 -0
  165. package/docs/uk/packages/intlayer/getLocaleName.md +135 -0
  166. package/docs/uk/packages/intlayer/getLocalizedUrl.md +338 -0
  167. package/docs/uk/packages/intlayer/getMultilingualUrls.md +359 -0
  168. package/docs/uk/packages/intlayer/getPathWithoutLocale.md +75 -0
  169. package/docs/uk/packages/intlayer/getPrefix.md +213 -0
  170. package/docs/uk/packages/intlayer/getTranslation.md +190 -0
  171. package/docs/uk/packages/intlayer/getTranslationContent.md +189 -0
  172. package/docs/uk/packages/next-intlayer/t.md +365 -0
  173. package/docs/uk/packages/next-intlayer/useDictionary.md +276 -0
  174. package/docs/uk/packages/next-intlayer/useIntlayer.md +263 -0
  175. package/docs/uk/packages/next-intlayer/useLocale.md +166 -0
  176. package/docs/uk/packages/react-intlayer/t.md +311 -0
  177. package/docs/uk/packages/react-intlayer/useDictionary.md +295 -0
  178. package/docs/uk/packages/react-intlayer/useI18n.md +250 -0
  179. package/docs/uk/packages/react-intlayer/useIntlayer.md +251 -0
  180. package/docs/uk/packages/react-intlayer/useLocale.md +210 -0
  181. package/docs/uk/per_locale_file.md +345 -0
  182. package/docs/uk/plugins/sync-json.md +398 -0
  183. package/docs/uk/readme.md +265 -0
  184. package/docs/uk/releases/v6.md +305 -0
  185. package/docs/uk/releases/v7.md +624 -0
  186. package/docs/uk/roadmap.md +346 -0
  187. package/docs/uk/testing.md +204 -0
  188. package/docs/vi/configuration.md +6 -1
  189. package/docs/vi/dictionary/content_file.md +6 -1
  190. package/docs/zh/configuration.md +6 -1
  191. package/docs/zh/dictionary/content_file.md +6 -1
  192. package/frequent_questions/ar/error-vite-env-only.md +77 -0
  193. package/frequent_questions/de/error-vite-env-only.md +77 -0
  194. package/frequent_questions/en/error-vite-env-only.md +77 -0
  195. package/frequent_questions/en-GB/error-vite-env-only.md +77 -0
  196. package/frequent_questions/es/error-vite-env-only.md +76 -0
  197. package/frequent_questions/fr/error-vite-env-only.md +77 -0
  198. package/frequent_questions/hi/error-vite-env-only.md +77 -0
  199. package/frequent_questions/id/error-vite-env-only.md +77 -0
  200. package/frequent_questions/it/error-vite-env-only.md +77 -0
  201. package/frequent_questions/ja/error-vite-env-only.md +77 -0
  202. package/frequent_questions/ko/error-vite-env-only.md +77 -0
  203. package/frequent_questions/pl/error-vite-env-only.md +77 -0
  204. package/frequent_questions/pt/error-vite-env-only.md +77 -0
  205. package/frequent_questions/ru/error-vite-env-only.md +77 -0
  206. package/frequent_questions/tr/error-vite-env-only.md +77 -0
  207. package/frequent_questions/uk/SSR_Next_no_[locale].md +104 -0
  208. package/frequent_questions/uk/array_as_content_declaration.md +72 -0
  209. package/frequent_questions/uk/build_dictionaries.md +58 -0
  210. package/frequent_questions/uk/build_error_CI_CD.md +74 -0
  211. package/frequent_questions/uk/bun_set_up.md +53 -0
  212. package/frequent_questions/uk/customized_locale_list.md +64 -0
  213. package/frequent_questions/uk/domain_routing.md +113 -0
  214. package/frequent_questions/uk/error-vite-env-only.md +77 -0
  215. package/frequent_questions/uk/esbuild_error.md +29 -0
  216. package/frequent_questions/uk/get_locale_cookie.md +142 -0
  217. package/frequent_questions/uk/intlayer_command_undefined.md +155 -0
  218. package/frequent_questions/uk/locale_incorect_in_url.md +73 -0
  219. package/frequent_questions/uk/package_version_error.md +181 -0
  220. package/frequent_questions/uk/static_rendering.md +44 -0
  221. package/frequent_questions/uk/translated_path_url.md +55 -0
  222. package/frequent_questions/uk/unknown_command.md +97 -0
  223. package/frequent_questions/vi/error-vite-env-only.md +77 -0
  224. package/frequent_questions/zh/error-vite-env-only.md +77 -0
  225. package/legal/uk/privacy_notice.md +83 -0
  226. package/legal/uk/terms_of_service.md +55 -0
  227. package/package.json +9 -9
  228. package/src/generated/blog.entry.ts +20 -0
  229. package/src/generated/frequentQuestions.entry.ts +20 -0
@@ -0,0 +1,429 @@
1
+ ---
2
+ createdAt: 2025-08-23
3
+ updatedAt: 2025-12-30
4
+ title: Як перекласти ваш бекенд на Express – i18n посібник 2026
5
+ description: Дізнайтеся, як зробити ваш бекенд на Express багатомовним. Дотримуйтесь документації, щоб інтернаціоналізувати (i18n) та перекласти його.
6
+ keywords:
7
+ - Інтернаціоналізація
8
+ - Документація
9
+ - Intlayer
10
+ - Express
11
+ - JavaScript
12
+ - Бекенд
13
+ slugs:
14
+ - doc
15
+ - environment
16
+ - express
17
+ applicationTemplate: https://github.com/aymericzip/intlayer-express-template
18
+ history:
19
+ - version: 7.5.9
20
+ date: 2025-12-30
21
+ changes: Додано команду init
22
+ - version: 5.5.10
23
+ date: 2025-06-29
24
+ changes: Ініціалізація історії
25
+ ---
26
+
27
+ # Перекладіть свій бекенд на Express за допомогою Intlayer | Інтернаціоналізація (i18n)
28
+
29
+ `express-intlayer` — потужний middleware для інтернаціоналізації (i18n) для додатків Express, призначений зробити ваші бекенд-сервіси доступними глобально, надаючи локалізовані відповіді відповідно до переваг клієнта.
30
+
31
+ ### Практичні сценарії використання
32
+
33
+ - **Відображення помилок бекенду мовою користувача**: Коли виникає помилка, відображення повідомлень рідною мовою користувача покращує розуміння та зменшує фрустрацію. Це особливо корисно для динамічних повідомлень про помилки, які можуть відображатися у фронтенд-компонентах, таких як toasts або модальні вікна.
34
+
35
+ - **Отримання багатомовного контенту**: Для додатків, що отримують контент із бази даних, інтернаціоналізація забезпечує можливість надавати цей контент кількома мовами. Це критично важливо для платформ, таких як e-commerce сайти або системи управління контентом (CMS), які повинні відображати описи товарів, статті та інший контент мовою, яку віддає перевагу користувач.
36
+
37
+ - **Надсилання багатомовних електронних листів**: Незалежно від того, чи це транзакційні листи, маркетингові кампанії або сповіщення, надсилання листів мовою отримувача може суттєво підвищити залучення та ефективність.
38
+
39
+ - **Багатомовні push-повідомлення**: Для мобільних додатків надсилання push-повідомлень мовою, якої надає перевагу користувач, може підвищити взаємодію та утримання. Такий персоналізований підхід робить повідомлення більш релевантними та спонукає до дії.
40
+
41
+ - **Інші комунікації**: Будь-які форми комунікації з бекенду, такі як SMS-повідомлення, системні сповіщення або оновлення інтерфейсу користувача, виграють від локалізації мовою користувача, що забезпечує зрозумілість і покращує загальний досвід.
42
+
43
+ Інтернаціоналізація бекенду дозволяє вашому застосунку не лише поважати культурні відмінності, але й краще відповідати вимогам глобального ринку, що робить її ключовим кроком для масштабування ваших сервісів у всьому світі.
44
+
45
+ ## Початок роботи
46
+
47
+ ### Встановлення
48
+
49
+ Щоб почати використовувати `express-intlayer`, встановіть пакет за допомогою npm:
50
+
51
+ ```bash packageManager="npm"
52
+ npm install intlayer express-intlayer
53
+ npx intlayer init
54
+ ```
55
+
56
+ ```bash packageManager="pnpm"
57
+ pnpm add intlayer express-intlayer
58
+ pnpm intlayer init
59
+ ```
60
+
61
+ ```bash packageManager="yarn"
62
+ yarn add intlayer express-intlayer
63
+ yarn intlayer init
64
+ ```
65
+
66
+ ```bash packageManager="bun"
67
+ bun add intlayer express-intlayer
68
+ bunx intlayer init
69
+ ```
70
+
71
+ ### Налаштування
72
+
73
+ Налаштуйте параметри internationalization, створивши `intlayer.config.ts` у корені проєкту:
74
+
75
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
76
+ import { Locales, type IntlayerConfig } from "intlayer";
77
+
78
+ const config: IntlayerConfig = {
79
+ internationalization: {
80
+ locales: [
81
+ Locales.ENGLISH,
82
+ Locales.FRENCH,
83
+ Locales.SPANISH_MEXICO,
84
+ Locales.SPANISH_SPAIN,
85
+ ],
86
+ defaultLocale: Locales.ENGLISH,
87
+ },
88
+ };
89
+
90
+ export default config;
91
+ ```
92
+
93
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
94
+ import { Locales } from "intlayer";
95
+
96
+ /** @type {import('intlayer').IntlayerConfig} */
97
+ const config = {
98
+ internationalization: {
99
+ locales: [
100
+ Locales.ENGLISH,
101
+ Locales.FRENCH,
102
+ Locales.SPANISH_MEXICO,
103
+ Locales.SPANISH_SPAIN,
104
+ ],
105
+ defaultLocale: Locales.ENGLISH,
106
+ },
107
+ };
108
+
109
+ export default config;
110
+ ```
111
+
112
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
113
+ const { Locales } = require("intlayer");
114
+
115
+ /** @type {import('intlayer').IntlayerConfig} */
116
+ const config = {
117
+ internationalization: {
118
+ locales: [
119
+ Locales.ENGLISH,
120
+ Locales.FRENCH,
121
+ Locales.SPANISH_MEXICO,
122
+ Locales.SPANISH_SPAIN,
123
+ ],
124
+ defaultLocale: Locales.ENGLISH,
125
+ },
126
+ };
127
+
128
+ module.exports = config;
129
+ ```
130
+
131
+ ### Оголосіть свій контент
132
+
133
+ Створюйте й керуйте деклараціями контенту для зберігання перекладів:
134
+
135
+ ```typescript fileName="src/index.content.ts" contentDeclarationFormat="typescript"
136
+ import { t, type Dictionary } from "intlayer";
137
+
138
+ const indexContent = {
139
+ key: "index",
140
+ content: {
141
+ exampleOfContent: t({
142
+ uk: "Приклад поверненого вмісту українською",
143
+ en: "Example of returned content in English",
144
+ fr: "Exemple de contenu renvoyé en français",
145
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
146
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
147
+ }),
148
+ },
149
+ } satisfies Dictionary;
150
+
151
+ export default indexContent;
152
+ ```
153
+
154
+ ```javascript fileName="src/index.content.mjs" contentDeclarationFormat="esm"
155
+ import { t } from "intlayer";
156
+
157
+ /** @type {import('intlayer').Dictionary} */
158
+ const indexContent = {
159
+ key: "index",
160
+ content: {
161
+ exampleOfContent: t({
162
+ uk: "Приклад поверненого вмісту українською",
163
+ en: "Example of returned content in English",
164
+ fr: "Exemple de contenu renvoyé en français",
165
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
166
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
167
+ }),
168
+ },
169
+ };
170
+
171
+ export default indexContent;
172
+ ```
173
+
174
+ ```javascript fileName="src/index.content.cjs" contentDeclarationFormat="commonjs"
175
+ const { t } = require("intlayer");
176
+
177
+ /** @type {import('intlayer').Dictionary} */
178
+ const indexContent = {
179
+ key: "index",
180
+ content: {
181
+ exampleOfContent: t({
182
+ uk: "Приклад поверненого вмісту українською",
183
+ en: "Example of returned content in English",
184
+ fr: "Exemple de contenu renvoyé en français",
185
+ uk: "Приклад поверненого вмісту українською",
186
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
187
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
188
+ }),
189
+ },
190
+ };
191
+
192
+ module.exports = indexContent;
193
+ ```
194
+
195
+ ```json fileName="src/index.content.json" contentDeclarationFormat="json"
196
+ {
197
+ "$schema": "https://intlayer.org/schema.json",
198
+ "key": "index",
199
+ "content": {
200
+ "exampleOfContent": {
201
+ "nodeType": "translation",
202
+ "translation": {
203
+ "uk": "Приклад поверненого вмісту українською",
204
+ "en": "Example of returned content in English",
205
+ "fr": "Exemple de contenu renvoyé en français",
206
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
207
+ "es-MX": "Ejemplo de contenido devuelto en español (México)"
208
+ }
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ > Ваші декларації вмісту можуть бути визначені будь-де у вашому додатку, доки вони включені до директорії `contentDir` (за замовчуванням `./src`). І відповідати розширенню файлу декларації вмісту (за замовчуванням `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
215
+
216
+ > Для детальнішої інформації зверніться до [документації щодо декларацій вмісту](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/dictionary/content_file.md).
217
+
218
+ ### Налаштування Express-застосунку
219
+
220
+ Налаштуйте ваш Express-застосунок для використання `express-intlayer`:
221
+
222
+ ```typescript fileName="src/index.ts" codeFormat="typescript"
223
+ import express, { type Express } from "express";
224
+ import { intlayer, t, getDictionary, getIntlayer } from "express-intlayer";
225
+ import dictionaryExample from "./index.content";
226
+
227
+ const app: Express = express();
228
+
229
+ // Підключення обробника інтернаціоналізації запитів
230
+ app.use(intlayer());
231
+
232
+ // Маршрути
233
+ app.get("/t_example", (_req, res) => {
234
+ res.send(
235
+ t({
236
+ uk: "Приклад поверненого вмісту українською",
237
+ en: "Example of returned content in English",
238
+ fr: "Exemple de contenu renvoyé en français",
239
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
240
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
241
+ })
242
+ );
243
+ });
244
+
245
+ app.get("/getIntlayer_example", (_req, res) => {
246
+ res.send(getIntlayer("index").exampleOfContent);
247
+ });
248
+
249
+ app.get("/getDictionary_example", (_req, res) => {
250
+ res.send(getDictionary(dictionaryExample).exampleOfContent);
251
+ });
252
+
253
+ // Запуск сервера
254
+ app.listen(3000, () => console.log(`Сервер запущено на порту 3000`));
255
+ ```
256
+
257
+ ```javascript fileName="src/index.mjs" codeFormat="esm"
258
+ import express from "express";
259
+ import { intlayer, t, getDictionary, getIntlayer } from "express-intlayer";
260
+ import dictionaryExample from "./index.content";
261
+
262
+ const app = express();
263
+
264
+ // Підключити обробник запитів інтернаціоналізації
265
+ app.use(intlayer());
266
+
267
+ // Маршрути
268
+ app.get("/t_example", (_req, res) => {
269
+ res.send(
270
+ t({
271
+ uk: "Приклад поверненого вмісту українською",
272
+ en: "Example of returned content in English",
273
+ fr: "Exemple de contenu renvoyé en français",
274
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
275
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
276
+ })
277
+ );
278
+ });
279
+
280
+ app.get("/getIntlayer_example", (_req, res) => {
281
+ res.send(getIntlayer("index").exampleOfContent);
282
+ });
283
+
284
+ app.get("/getDictionary_example", (_req, res) => {
285
+ res.send(getDictionary(dictionaryExample).exampleOfContent);
286
+ });
287
+
288
+ // Запустити сервер
289
+ app.listen(3000, () => console.log(`Слухаю порт 3000`));
290
+ ```
291
+
292
+ ```javascript fileName="src/index.cjs" codeFormat="commonjs"
293
+ const express = require("express");
294
+ const { intlayer, t, getDictionary, getIntlayer } = require("express-intlayer");
295
+ const dictionaryExample = require("./index.content");
296
+
297
+ const app = express();
298
+
299
+ // Підключаємо обробник інтернаціоналізації
300
+ app.use(intlayer());
301
+
302
+ // Маршрути
303
+ app.get("/t_example", (_req, res) => {
304
+ res.send(
305
+ t({
306
+ uk: "Приклад поверненого вмісту українською",
307
+ en: "Example of returned content in English",
308
+ fr: "Exemple de contenu renvoyé en français",
309
+ "es-ES": "Ejemplo de contenido devuelto en español (España)",
310
+ "es-MX": "Ejemplo de contenido devuelto en español (México)",
311
+ })
312
+ );
313
+ });
314
+
315
+ app.get("/getIntlayer_example", (_req, res) => {
316
+ res.send(getIntlayer("index").exampleOfContent);
317
+ });
318
+
319
+ app.get("/getDictionary_example", (_req, res) => {
320
+ res.send(getDictionary(dictionaryExample).exampleOfContent);
321
+ });
322
+
323
+ // Start server
324
+ app.listen(3000, () => console.log(`Listening on port 3000`));
325
+ ```
326
+
327
+ ### Сумісність
328
+
329
+ `express-intlayer` повністю сумісний з:
330
+
331
+ - [`react-intlayer`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/packages/react-intlayer/index.md) для додатків React
332
+ - [`next-intlayer`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/packages/next-intlayer/index.md) для додатків Next.js
333
+ - [`vite-intlayer`](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/packages/vite-intlayer/index.md) для додатків Vite
334
+
335
+ Воно також безшовно працює з будь-яким рішенням для інтернаціоналізації в різних середовищах, включно з браузерами та API-запитами. Ви можете налаштувати middleware для визначення локалі через headers або cookies:
336
+
337
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
338
+ import { Locales, type IntlayerConfig } from "intlayer";
339
+
340
+ const config: IntlayerConfig = {
341
+ // ... Інші параметри конфігурації
342
+ middleware: {
343
+ headerName: "my-locale-header",
344
+ cookieName: "my-locale-cookie",
345
+ },
346
+ };
347
+
348
+ export default config;
349
+ ```
350
+
351
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
352
+ import { Locales } from "intlayer";
353
+
354
+ /** @type {import('intlayer').IntlayerConfig} */
355
+ const config = {
356
+ // ... Інші параметри конфігурації
357
+ middleware: {
358
+ headerName: "my-locale-header",
359
+ cookieName: "my-locale-cookie",
360
+ },
361
+ };
362
+
363
+ export default config;
364
+ ```
365
+
366
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
367
+ const { Locales } = require("intlayer");
368
+
369
+ /** @type {import('intlayer').IntlayerConfig} */
370
+ const config = {
371
+ // ... Інші параметри конфігурації
372
+ middleware: {
373
+ headerName: "my-locale-header",
374
+ cookieName: "my-locale-cookie",
375
+ },
376
+ };
377
+
378
+ module.exports = config;
379
+ ```
380
+
381
+ За замовчуванням `express-intlayer` буде інтерпретувати заголовок `Accept-Language` для визначення переважної мови клієнта.
382
+
383
+ > Для отримання додаткової інформації про конфігурацію та розширені теми перегляньте нашу [документацію](https://github.com/aymericzip/intlayer/blob/main/docs/docs/uk/configuration.md).
384
+
385
+ ### Налаштування TypeScript
386
+
387
+ `express-intlayer` використовує потужні можливості TypeScript для покращення процесу інтернаціоналізації. Статична типізація TypeScript гарантує, що кожен ключ перекладу врахований, зменшуючи ризик відсутніх перекладів та покращуючи підтримуваність.
388
+
389
+ ![Автозаповнення](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true)
390
+
391
+ ![Помилка перекладу](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png?raw=true)
392
+
393
+ Переконайтеся, що автогенеровані типи (за замовчуванням у ./types/intlayer.d.ts) включені у ваш файл tsconfig.json.
394
+
395
+ ```json5 fileName="tsconfig.json"
396
+ {
397
+ // ... Ваші існуючі конфігурації TypeScript
398
+ "include": [
399
+ // ... Ваші існуючі конфігурації TypeScript
400
+ ".intlayer/**/*.ts", // Включити автогенеровані типи
401
+ ],
402
+ }
403
+ ```
404
+
405
+ ### Розширення для VS Code
406
+
407
+ Щоб покращити ваш досвід розробки з Intlayer, ви можете встановити офіційне **розширення Intlayer для VS Code**.
408
+
409
+ [Встановити з Marketplace для VS Code](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
410
+
411
+ Це розширення надає:
412
+
413
+ - **Автодоповнення** для ключів перекладу.
414
+ - **Виявлення помилок у реальному часі** для відсутніх перекладів.
415
+ - **Вбудовані попередні перегляди** перекладеного контенту.
416
+ - **Швидкі дії** для простого створення та оновлення перекладів.
417
+
418
+ Для детальнішої інформації про використання розширення див. [документацію розширення Intlayer для VS Code](https://intlayer.org/doc/vs-code-extension).
419
+
420
+ ### Конфігурація Git
421
+
422
+ Рекомендується ігнорувати файли, згенеровані Intlayer. Це дозволяє уникнути їх додавання до вашого Git-репозиторію.
423
+
424
+ Для цього ви можете додати наступні інструкції до файлу `.gitignore`:
425
+
426
+ ```plaintext fileName=".gitignore"
427
+ # Ігнорувати файли, згенеровані Intlayer
428
+ .intlayer
429
+ ```