@intlayer/docs 6.1.5 → 6.1.6
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.
- package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
- package/blog/en/intlayer_with_next-i18next.mdx +431 -0
- package/blog/en/intlayer_with_next-intl.mdx +335 -0
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +463 -209
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/dist/cjs/generated/docs.entry.cjs +32 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +32 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +186 -0
- package/docs/ar/intlayer_with_angular.md +2 -2
- package/docs/ar/intlayer_with_astro.md +246 -0
- package/docs/ar/intlayer_with_create_react_app.md +3 -2
- package/docs/ar/intlayer_with_express.md +2 -2
- package/docs/ar/intlayer_with_nestjs.md +2 -2
- package/docs/ar/intlayer_with_nextjs_14.md +2 -2
- package/docs/ar/intlayer_with_nextjs_15.md +2 -2
- package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ar/intlayer_with_nuxt.md +2 -2
- package/docs/ar/intlayer_with_react_native+expo.md +11 -20
- package/docs/ar/intlayer_with_react_router_v7.md +195 -241
- package/docs/ar/intlayer_with_tanstack.md +198 -272
- package/docs/ar/intlayer_with_vite+preact.md +9 -9
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/ar/vs_code_extension.md +48 -109
- package/docs/de/component_i18n.md +186 -0
- package/docs/de/intlayer_with_angular.md +2 -2
- package/docs/de/intlayer_with_astro.md +246 -0
- package/docs/de/intlayer_with_create_react_app.md +2 -2
- package/docs/de/intlayer_with_express.md +2 -2
- package/docs/de/intlayer_with_nestjs.md +2 -2
- package/docs/de/intlayer_with_nextjs_14.md +2 -2
- package/docs/de/intlayer_with_nextjs_15.md +2 -2
- package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/de/intlayer_with_nuxt.md +2 -2
- package/docs/de/intlayer_with_react_native+expo.md +11 -20
- package/docs/de/intlayer_with_react_router_v7.md +193 -242
- package/docs/de/intlayer_with_tanstack.md +194 -266
- package/docs/de/intlayer_with_vite+preact.md +9 -9
- package/docs/de/intlayer_with_vite+react.md +9 -9
- package/docs/de/intlayer_with_vite+vue.md +11 -11
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/de/vs_code_extension.md +46 -107
- package/docs/en/component_i18n.md +186 -0
- package/docs/en/how_works_intlayer.md +1 -1
- package/docs/en/index.md +1 -1
- package/docs/en/intlayer_cli.md +1 -1
- package/docs/en/intlayer_with_angular.md +4 -4
- package/docs/en/intlayer_with_astro.md +246 -0
- package/docs/en/intlayer_with_create_react_app.md +4 -4
- package/docs/en/intlayer_with_express.md +3 -3
- package/docs/en/intlayer_with_lynx+react.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +31 -5
- package/docs/en/intlayer_with_nextjs_15.md +31 -5
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/en/intlayer_with_nuxt.md +4 -4
- package/docs/en/intlayer_with_react_native+expo.md +46 -24
- package/docs/en/intlayer_with_react_router_v7.md +164 -211
- package/docs/en/intlayer_with_tanstack.md +166 -241
- package/docs/en/intlayer_with_vite+preact.md +12 -12
- package/docs/en/intlayer_with_vite+react.md +12 -12
- package/docs/en/intlayer_with_vite+solid.md +2 -2
- package/docs/en/intlayer_with_vite+svelte.md +2 -2
- package/docs/en/intlayer_with_vite+vue.md +12 -12
- package/docs/en/introduction.md +1 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/react-intlayer/useI18n.md +1 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en/releases/v6.md +1 -0
- package/docs/en/roadmap.md +1 -1
- package/docs/en/vs_code_extension.md +24 -114
- package/docs/en-GB/component_i18n.md +186 -0
- package/docs/en-GB/intlayer_with_angular.md +3 -3
- package/docs/en-GB/intlayer_with_astro.md +246 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
- package/docs/en-GB/intlayer_with_express.md +2 -2
- package/docs/en-GB/intlayer_with_nestjs.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
- package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/en-GB/intlayer_with_nuxt.md +2 -2
- package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
- package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
- package/docs/en-GB/intlayer_with_tanstack.md +174 -248
- package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
- package/docs/en-GB/intlayer_with_vite+react.md +9 -9
- package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
- package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/vs_code_extension.md +42 -103
- package/docs/es/component_i18n.md +182 -0
- package/docs/es/intlayer_with_angular.md +2 -2
- package/docs/es/intlayer_with_astro.md +246 -0
- package/docs/es/intlayer_with_create_react_app.md +3 -2
- package/docs/es/intlayer_with_express.md +2 -2
- package/docs/es/intlayer_with_nextjs_14.md +2 -2
- package/docs/es/intlayer_with_nextjs_15.md +2 -2
- package/docs/es/intlayer_with_react_native+expo.md +11 -20
- package/docs/es/intlayer_with_react_router_v7.md +188 -232
- package/docs/es/intlayer_with_tanstack.md +203 -273
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/es/vs_code_extension.md +53 -114
- package/docs/fr/component_i18n.md +186 -0
- package/docs/fr/intlayer_with_angular.md +2 -2
- package/docs/fr/intlayer_with_astro.md +246 -0
- package/docs/fr/intlayer_with_create_react_app.md +3 -2
- package/docs/fr/intlayer_with_express.md +2 -2
- package/docs/fr/intlayer_with_nestjs.md +2 -2
- package/docs/fr/intlayer_with_nextjs_14.md +2 -2
- package/docs/fr/intlayer_with_react_native+expo.md +11 -20
- package/docs/fr/intlayer_with_react_router_v7.md +188 -248
- package/docs/fr/intlayer_with_tanstack.md +192 -265
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/vs_code_extension.md +50 -111
- package/docs/hi/component_i18n.md +186 -0
- package/docs/hi/intlayer_cli.md +1 -4
- package/docs/hi/intlayer_with_angular.md +2 -2
- package/docs/hi/intlayer_with_astro.md +246 -0
- package/docs/hi/intlayer_with_create_react_app.md +2 -2
- package/docs/hi/intlayer_with_express.md +2 -2
- package/docs/hi/intlayer_with_nestjs.md +2 -2
- package/docs/hi/intlayer_with_nextjs_14.md +2 -2
- package/docs/hi/intlayer_with_nextjs_15.md +2 -2
- package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/hi/intlayer_with_nuxt.md +2 -2
- package/docs/hi/intlayer_with_react_native+expo.md +11 -20
- package/docs/hi/intlayer_with_react_router_v7.md +199 -243
- package/docs/hi/intlayer_with_tanstack.md +210 -285
- package/docs/hi/intlayer_with_vite+preact.md +9 -9
- package/docs/hi/intlayer_with_vite+react.md +9 -9
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+vue.md +11 -11
- package/docs/hi/vs_code_extension.md +49 -110
- package/docs/it/component_i18n.md +186 -0
- package/docs/it/intlayer_with_angular.md +2 -2
- package/docs/it/intlayer_with_astro.md +246 -0
- package/docs/it/intlayer_with_create_react_app.md +3 -2
- package/docs/it/intlayer_with_express.md +2 -2
- package/docs/it/intlayer_with_nestjs.md +2 -2
- package/docs/it/intlayer_with_nextjs_14.md +2 -2
- package/docs/it/intlayer_with_nextjs_15.md +2 -2
- package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/it/intlayer_with_nuxt.md +2 -2
- package/docs/it/intlayer_with_react_native+expo.md +11 -21
- package/docs/it/intlayer_with_react_router_v7.md +195 -242
- package/docs/it/intlayer_with_tanstack.md +203 -267
- package/docs/it/intlayer_with_vite+preact.md +9 -9
- package/docs/it/intlayer_with_vite+react.md +13 -11
- package/docs/it/intlayer_with_vite+vue.md +11 -11
- package/docs/it/vs_code_extension.md +50 -111
- package/docs/ja/component_i18n.md +186 -0
- package/docs/ja/intlayer_with_angular.md +2 -2
- package/docs/ja/intlayer_with_astro.md +246 -0
- package/docs/ja/intlayer_with_create_react_app.md +3 -2
- package/docs/ja/intlayer_with_express.md +2 -2
- package/docs/ja/intlayer_with_nestjs.md +2 -2
- package/docs/ja/intlayer_with_nextjs_14.md +2 -2
- package/docs/ja/intlayer_with_nextjs_15.md +2 -2
- package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ja/intlayer_with_nuxt.md +2 -2
- package/docs/ja/intlayer_with_react_native+expo.md +18 -29
- package/docs/ja/intlayer_with_react_router_v7.md +204 -250
- package/docs/ja/intlayer_with_tanstack.md +218 -286
- package/docs/ja/intlayer_with_vite+preact.md +9 -9
- package/docs/ja/intlayer_with_vite+react.md +11 -11
- package/docs/ja/intlayer_with_vite+vue.md +11 -11
- package/docs/ja/vs_code_extension.md +50 -111
- package/docs/ko/component_i18n.md +186 -0
- package/docs/ko/intlayer_with_angular.md +2 -2
- package/docs/ko/intlayer_with_astro.md +246 -0
- package/docs/ko/intlayer_with_create_react_app.md +3 -2
- package/docs/ko/intlayer_with_express.md +2 -2
- package/docs/ko/intlayer_with_nestjs.md +2 -2
- package/docs/ko/intlayer_with_nextjs_14.md +2 -2
- package/docs/ko/intlayer_with_nextjs_15.md +2 -2
- package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ko/intlayer_with_nuxt.md +2 -2
- package/docs/ko/intlayer_with_react_native+expo.md +19 -28
- package/docs/ko/intlayer_with_react_router_v7.md +190 -244
- package/docs/ko/intlayer_with_tanstack.md +200 -270
- package/docs/ko/intlayer_with_vite+preact.md +9 -9
- package/docs/ko/intlayer_with_vite+react.md +9 -9
- package/docs/ko/intlayer_with_vite+vue.md +11 -11
- package/docs/ko/vs_code_extension.md +48 -109
- package/docs/pt/component_i18n.md +186 -0
- package/docs/pt/intlayer_with_angular.md +2 -2
- package/docs/pt/intlayer_with_astro.md +246 -0
- package/docs/pt/intlayer_with_create_react_app.md +3 -2
- package/docs/pt/intlayer_with_express.md +2 -2
- package/docs/pt/intlayer_with_nestjs.md +2 -2
- package/docs/pt/intlayer_with_nextjs_14.md +2 -2
- package/docs/pt/intlayer_with_nextjs_15.md +2 -2
- package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/pt/intlayer_with_nuxt.md +2 -2
- package/docs/pt/intlayer_with_react_native+expo.md +11 -20
- package/docs/pt/intlayer_with_react_router_v7.md +7 -13
- package/docs/pt/intlayer_with_tanstack.md +183 -258
- package/docs/pt/intlayer_with_vite+preact.md +9 -9
- package/docs/pt/intlayer_with_vite+react.md +9 -9
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/pt/vs_code_extension.md +46 -107
- package/docs/ru/component_i18n.md +186 -0
- package/docs/ru/intlayer_with_angular.md +2 -2
- package/docs/ru/intlayer_with_astro.md +246 -0
- package/docs/ru/intlayer_with_create_react_app.md +3 -2
- package/docs/ru/intlayer_with_express.md +2 -2
- package/docs/ru/intlayer_with_nestjs.md +2 -2
- package/docs/ru/intlayer_with_nextjs_14.md +2 -2
- package/docs/ru/intlayer_with_nextjs_15.md +2 -2
- package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ru/intlayer_with_nuxt.md +2 -2
- package/docs/ru/intlayer_with_react_native+expo.md +11 -20
- package/docs/ru/intlayer_with_react_router_v7.md +192 -238
- package/docs/ru/intlayer_with_tanstack.md +197 -269
- package/docs/ru/intlayer_with_vite+preact.md +9 -9
- package/docs/ru/intlayer_with_vite+react.md +9 -9
- package/docs/ru/intlayer_with_vite+vue.md +11 -11
- package/docs/ru/vs_code_extension.md +48 -109
- package/docs/tr/component_i18n.md +186 -0
- package/docs/tr/how_works_intlayer.md +1 -1
- package/docs/tr/index.md +1 -1
- package/docs/tr/intlayer_cli.md +1 -1
- package/docs/tr/intlayer_with_angular.md +4 -4
- package/docs/tr/intlayer_with_astro.md +246 -0
- package/docs/tr/intlayer_with_create_react_app.md +4 -4
- package/docs/tr/intlayer_with_express.md +3 -3
- package/docs/tr/intlayer_with_lynx+react.md +1 -1
- package/docs/tr/intlayer_with_nestjs.md +2 -2
- package/docs/tr/intlayer_with_nextjs_14.md +2 -2
- package/docs/tr/intlayer_with_nextjs_15.md +4 -4
- package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/tr/intlayer_with_nuxt.md +4 -4
- package/docs/tr/intlayer_with_react_native+expo.md +12 -21
- package/docs/tr/intlayer_with_react_router_v7.md +222 -267
- package/docs/tr/intlayer_with_tanstack.md +400 -303
- package/docs/tr/intlayer_with_vite+preact.md +12 -12
- package/docs/tr/intlayer_with_vite+react.md +12 -12
- package/docs/tr/intlayer_with_vite+solid.md +2 -2
- package/docs/tr/intlayer_with_vite+svelte.md +2 -2
- package/docs/tr/intlayer_with_vite+vue.md +12 -12
- package/docs/tr/introduction.md +1 -1
- package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
- package/docs/tr/roadmap.md +1 -1
- package/docs/tr/vs_code_extension.md +54 -115
- package/docs/zh/component_i18n.md +186 -0
- package/docs/zh/intlayer_with_angular.md +2 -2
- package/docs/zh/intlayer_with_astro.md +246 -0
- package/docs/zh/intlayer_with_create_react_app.md +3 -2
- package/docs/zh/intlayer_with_express.md +2 -2
- package/docs/zh/intlayer_with_nestjs.md +2 -2
- package/docs/zh/intlayer_with_nextjs_14.md +2 -2
- package/docs/zh/intlayer_with_nextjs_15.md +2 -2
- package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/zh/intlayer_with_nuxt.md +2 -2
- package/docs/zh/intlayer_with_react_native+expo.md +19 -28
- package/docs/zh/intlayer_with_react_router_v7.md +200 -248
- package/docs/zh/intlayer_with_tanstack.md +208 -283
- package/docs/zh/intlayer_with_vite+preact.md +9 -9
- package/docs/zh/intlayer_with_vite+react.md +9 -9
- package/docs/zh/intlayer_with_vite+vue.md +9 -9
- package/docs/zh/vs_code_extension.md +51 -105
- package/package.json +10 -10
- package/src/generated/docs.entry.ts +32 -0
|
@@ -1052,38 +1052,38 @@ const App = () => (
|
|
|
1052
1052
|
module.exports = App;
|
|
1053
1053
|
```
|
|
1054
1054
|
|
|
1055
|
-
Параллельно вы также можете использовать `
|
|
1055
|
+
Параллельно вы также можете использовать `intlayerMiddleware` для добавления маршрутизации на стороне сервера в ваше приложение. Этот плагин автоматически определит текущую локаль на основе URL и установит соответствующее cookie с локалью. Если локаль не указана, плагин определит наиболее подходящую локаль на основе языковых предпочтений браузера пользователя. Если локаль не будет обнаружена, произойдет перенаправление на локаль по умолчанию.
|
|
1056
1056
|
|
|
1057
1057
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1058
1058
|
import { defineConfig } from "vite";
|
|
1059
1059
|
import preact from "@preact/preset-vite";
|
|
1060
|
-
import { intlayer,
|
|
1060
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1061
1061
|
|
|
1062
1062
|
// https://vitejs.dev/config/
|
|
1063
1063
|
export default defineConfig({
|
|
1064
|
-
plugins: [preact(), intlayer(),
|
|
1064
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1065
1065
|
});
|
|
1066
1066
|
```
|
|
1067
1067
|
|
|
1068
1068
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
1069
1069
|
import { defineConfig } from "vite";
|
|
1070
1070
|
import preact from "@preact/preset-vite";
|
|
1071
|
-
import { intlayer,
|
|
1071
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1072
1072
|
|
|
1073
1073
|
// https://vitejs.dev/config/
|
|
1074
1074
|
export default defineConfig({
|
|
1075
|
-
plugins: [preact(), intlayer(),
|
|
1075
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1076
1076
|
});
|
|
1077
1077
|
```
|
|
1078
1078
|
|
|
1079
1079
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
1080
1080
|
const { defineConfig } = require("vite");
|
|
1081
1081
|
const preact = require("@preact/preset-vite");
|
|
1082
|
-
const { intlayer,
|
|
1082
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
1083
1083
|
|
|
1084
1084
|
// https://vitejs.dev/config/
|
|
1085
1085
|
module.exports = defineConfig({
|
|
1086
|
-
plugins: [preact(), intlayer(),
|
|
1086
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1087
1087
|
});
|
|
1088
1088
|
```
|
|
1089
1089
|
|
|
@@ -1635,9 +1635,9 @@ module.exports = { LocalizedLink, checkIsExternalLink };
|
|
|
1635
1635
|
|
|
1636
1636
|
Intlayer использует расширение модулей (module augmentation), чтобы получить преимущества TypeScript и сделать вашу кодовую базу более надежной.
|
|
1637
1637
|
|
|
1638
|
-

|
|
1639
1639
|
|
|
1640
|
-

|
|
1641
1641
|
|
|
1642
1642
|
Убедитесь, что ваша конфигурация TypeScript включает автоматически сгенерированные типы.
|
|
1643
1643
|
|
|
@@ -1008,38 +1008,38 @@ const App = () => (
|
|
|
1008
1008
|
);
|
|
1009
1009
|
```
|
|
1010
1010
|
|
|
1011
|
-
Параллельно вы также можете использовать `
|
|
1011
|
+
Параллельно вы также можете использовать `intlayerMiddleware` для добавления маршрутизации на стороне сервера в ваше приложение. Этот плагин автоматически определит текущую локаль на основе URL и установит соответствующее cookie с локалью. Если локаль не указана, плагин определит наиболее подходящую локаль на основе языковых предпочтений браузера пользователя. Если локаль не будет обнаружена, произойдет перенаправление на локаль по умолчанию.
|
|
1012
1012
|
|
|
1013
1013
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1014
1014
|
import { defineConfig } from "vite";
|
|
1015
1015
|
import react from "@vitejs/plugin-react-swc";
|
|
1016
|
-
import { intlayer,
|
|
1016
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1017
1017
|
|
|
1018
1018
|
// https://vitejs.dev/config/
|
|
1019
1019
|
export default defineConfig({
|
|
1020
|
-
plugins: [react(), intlayer(),
|
|
1020
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1021
1021
|
});
|
|
1022
1022
|
```
|
|
1023
1023
|
|
|
1024
1024
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
1025
1025
|
import { defineConfig } from "vite";
|
|
1026
1026
|
import react from "@vitejs/plugin-react-swc";
|
|
1027
|
-
import { intlayer,
|
|
1027
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1028
1028
|
|
|
1029
1029
|
// https://vitejs.dev/config/
|
|
1030
1030
|
export default defineConfig({
|
|
1031
|
-
plugins: [react(), intlayer(),
|
|
1031
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1032
1032
|
});
|
|
1033
1033
|
```
|
|
1034
1034
|
|
|
1035
1035
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
1036
1036
|
const { defineConfig } = require("vite");
|
|
1037
1037
|
const react = require("@vitejs/plugin-react-swc");
|
|
1038
|
-
const { intlayer,
|
|
1038
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
1039
1039
|
|
|
1040
1040
|
// https://vitejs.dev/config/
|
|
1041
1041
|
module.exports = defineConfig({
|
|
1042
|
-
plugins: [react(), intlayer(),
|
|
1042
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1043
1043
|
});
|
|
1044
1044
|
```
|
|
1045
1045
|
|
|
@@ -1603,9 +1603,9 @@ Link.displayName = "Link";
|
|
|
1603
1603
|
|
|
1604
1604
|
Intlayer использует расширение модулей (module augmentation), чтобы использовать преимущества TypeScript и сделать вашу кодовую базу более надежной.
|
|
1605
1605
|
|
|
1606
|
-

|
|
1607
1607
|
|
|
1608
|
-

|
|
1609
1609
|
|
|
1610
1610
|
Убедитесь, что ваша конфигурация TypeScript включает автоматически сгенерированные типы.
|
|
1611
1611
|
|
|
@@ -675,46 +675,46 @@ import LocaleSwitcher from "@components/LocaleSwitcher.vue"; // Импорт п
|
|
|
675
675
|
</template>
|
|
676
676
|
```
|
|
677
677
|
|
|
678
|
-
Параллельно вы также можете использовать `
|
|
678
|
+
Параллельно вы также можете использовать `intlayerMiddleware` для добавления маршрутизации на стороне сервера в ваше приложение. Этот плагин автоматически определит текущую локаль на основе URL и установит соответствующий cookie с локалью. Если локаль не указана, плагин определит наиболее подходящую локаль на основе языковых предпочтений браузера пользователя. Если локаль не будет обнаружена, произойдет перенаправление на локаль по умолчанию.
|
|
679
679
|
|
|
680
680
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
681
681
|
import { defineConfig } from "vite";
|
|
682
682
|
import vue from "@vitejs/plugin-vue";
|
|
683
|
-
import { intlayer,
|
|
683
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
684
684
|
|
|
685
685
|
// https://vitejs.dev/config/
|
|
686
686
|
export default defineConfig({
|
|
687
|
-
plugins: [vue(), intlayer(),
|
|
687
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
688
688
|
});
|
|
689
689
|
```
|
|
690
690
|
|
|
691
691
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
692
692
|
import { defineConfig } from "vite";
|
|
693
693
|
import vue from "@vitejs/plugin-vue";
|
|
694
|
-
import { intlayer,
|
|
694
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
695
695
|
|
|
696
696
|
// https://vitejs.dev/config/
|
|
697
697
|
export default defineConfig({
|
|
698
|
-
plugins: [vue(), intlayer(),
|
|
698
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
699
699
|
});
|
|
700
700
|
```
|
|
701
701
|
|
|
702
702
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
703
703
|
const { defineConfig } = require("vite");
|
|
704
704
|
const vue = require("@vitejs/plugin-vue");
|
|
705
|
-
const { intlayer,
|
|
705
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
706
706
|
|
|
707
707
|
// https://vitejs.dev/config/
|
|
708
708
|
module.exports = defineConfig({
|
|
709
|
-
plugins: [vue(), intlayer(),
|
|
709
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
710
710
|
});
|
|
711
711
|
const { defineConfig } = require("vite");
|
|
712
712
|
const vue = require("@vitejs/plugin-vue");
|
|
713
|
-
const { intlayer,
|
|
713
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
714
714
|
|
|
715
715
|
// https://vitejs.dev/config/
|
|
716
716
|
module.exports = defineConfig({
|
|
717
|
-
plugins: [vue(), intlayer(),
|
|
717
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
718
718
|
});
|
|
719
719
|
```
|
|
720
720
|
|
|
@@ -1019,9 +1019,9 @@ const { myMarkdownContent } = useIntlayer("my-component");
|
|
|
1019
1019
|
|
|
1020
1020
|
Intlayer использует расширение модулей (module augmentation), чтобы использовать преимущества TypeScript и сделать ваш код более надежным.
|
|
1021
1021
|
|
|
1022
|
-

|
|
1023
1023
|
|
|
1024
|
-

|
|
1025
1025
|
|
|
1026
1026
|
Убедитесь, что ваша конфигурация TypeScript включает автоматически сгенерированные типы.
|
|
1027
1027
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-03-17
|
|
3
|
-
updatedAt: 2025-09-
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
4
|
title: Официальное расширение VS Code
|
|
5
5
|
description: Узнайте, как использовать расширение Intlayer в VS Code для улучшения вашего рабочего процесса разработки. Быстро переходите между локализованным контентом и эффективно управляйте своими словарями.
|
|
6
6
|
keywords:
|
|
@@ -21,94 +21,38 @@ slugs:
|
|
|
21
21
|
|
|
22
22
|
## Обзор
|
|
23
23
|
|
|
24
|
-
[**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) — официальное расширение Visual Studio Code для **Intlayer**,
|
|
24
|
+
[**Intlayer**](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension) — официальное расширение Visual Studio Code для **Intlayer**, разработанное для улучшения опыта разработчика при работе с локализованным контентом в ваших проектах.
|
|
25
25
|
|
|
26
|
-

|
|
26
|
+

|
|
27
27
|
|
|
28
28
|
Ссылка на расширение: [https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension](https://marketplace.visualstudio.com/items?itemName=Intlayer.intlayer-vs-code-extension)
|
|
29
29
|
|
|
30
30
|
## Возможности
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+

|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
**Поддержка нескольких языков** – Поддерживает локализованный контент на разных языках.
|
|
37
|
-
**Интеграция с VS Code** – Плавно интегрируется с навигацией и палитрой команд VS Code.
|
|
34
|
+
- **Мгновенная навигация** – Быстрый переход к нужному файлу контента при клике на ключ `useIntlayer`.
|
|
35
|
+
- **Заполнение словарей** – Заполнение словарей контентом из вашего проекта.
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+

|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
- **Простой доступ к командам Intlayer** – Легко собирайте, отправляйте, загружайте, заполняйте и тестируйте словари контента.
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
- **Отправка словарей** – Загружайте актуальное содержимое словарей в ваш репозиторий.
|
|
45
|
-
- **Получение словарей** – Синхронизируйте актуальное содержимое словарей из репозитория с вашей локальной средой.
|
|
46
|
-
- **Заполнение словарей** – Заполняйте словари контентом из вашего проекта.
|
|
47
|
-
- **Тестирование словарей** – Определяйте отсутствующие или неполные переводы.
|
|
41
|
+

|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
- **Генератор деклараций контента** – Создавайте файлы словарей контента в различных форматах (`.ts`, `.esm`, `.cjs`, `.json`).
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+

|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
- **Тестирование словарей** – Проверяйте словари на наличие отсутствующих переводов.
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+

|
|
56
50
|
|
|
57
|
-
|
|
58
|
-
const MyComponent = () => {
|
|
59
|
-
const { myTranslatedContent } = useIntlayer("my-component");
|
|
51
|
+
- **Держите ваши словари в актуальном состоянии** – Обновляйте словари с последним содержимым из вашего проекта.
|
|
60
52
|
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Сгенерированный файл в формате TypeScript:
|
|
66
|
-
|
|
67
|
-
```tsx fileName="src/components/MyComponent/index.content.ts"
|
|
68
|
-
import { t, type Dictionary } from "intlayer";
|
|
69
|
-
|
|
70
|
-
const componentContent = {
|
|
71
|
-
key: "my-component",
|
|
72
|
-
content: {
|
|
73
|
-
myTranslatedContent: t({
|
|
74
|
-
en: "Hello World",
|
|
75
|
-
es: "Hola Mundo",
|
|
76
|
-
fr: "Bonjour le monde",
|
|
77
|
-
}),
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export default componentContent;
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Доступные форматы:
|
|
85
|
-
|
|
86
|
-
- **TypeScript (`.ts`)**
|
|
87
|
-
- **ES Module (`.esm`)**
|
|
88
|
-
- **CommonJS (`.cjs`)**
|
|
89
|
-
- **JSON (`.json`)**
|
|
90
|
-
|
|
91
|
-
### Вкладка Intlayer (Панель активности)
|
|
53
|
+

|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
- **Поиск**: Живая строка поиска для быстрого фильтра словарей и их содержимого. При вводе результаты обновляются мгновенно.
|
|
96
|
-
- **Словари**: Древовидное представление ваших окружений/проектов, ключей словарей и файлов, вносящих записи. Вы можете:
|
|
97
|
-
- Кликнуть по файлу, чтобы открыть его в редакторе.
|
|
98
|
-
- Использовать панель инструментов для выполнения действий: Build, Pull, Push, Fill, Refresh, Test и Create Dictionary File.
|
|
99
|
-
- Использовать контекстное меню для действий, специфичных для элемента:
|
|
100
|
-
- Для словаря: Pull или Push
|
|
101
|
-
- Для файла: Fill Dictionary
|
|
102
|
-
- При переключении редакторов дерево покажет соответствующий файл, если он принадлежит словарю.
|
|
103
|
-
|
|
104
|
-
## Установка
|
|
105
|
-
|
|
106
|
-
Вы можете установить **Intlayer** напрямую из Marketplace VS Code:
|
|
107
|
-
|
|
108
|
-
1. Откройте **VS Code**.
|
|
109
|
-
2. Перейдите в **Marketplace расширений**.
|
|
110
|
-
3. Найдите **"Intlayer"**.
|
|
111
|
-
4. Нажмите **Установить**.
|
|
55
|
+
- **Вкладка Intlayer (Панель активности)** – Просматривайте и ищите словари через специальную боковую вкладку с панелью инструментов и контекстными действиями (Сборка, Загрузка, Отправка, Заполнение, Обновление, Тестирование, Создание файла).
|
|
112
56
|
|
|
113
57
|
## Использование
|
|
114
58
|
|
|
@@ -121,63 +65,58 @@ export default componentContent;
|
|
|
121
65
|
const content = useIntlayer("app");
|
|
122
66
|
```
|
|
123
67
|
|
|
124
|
-
3.
|
|
68
|
+
3. **Командный клик** (`⌘+Click` на macOS) или **Ctrl+Click** (на Windows/Linux) по ключу (например, `"app"`).
|
|
125
69
|
4. VS Code автоматически откроет соответствующий файл словаря, например, `src/app.content.ts`.
|
|
126
70
|
|
|
127
|
-
### Управление словарями контента
|
|
128
|
-
|
|
129
71
|
### Вкладка Intlayer (Панель активности)
|
|
130
72
|
|
|
131
73
|
Используйте боковую вкладку для просмотра и управления словарями:
|
|
132
74
|
|
|
133
|
-
- Откройте
|
|
134
|
-
- В
|
|
135
|
-
- В разделе **Словари** просматривайте окружения, словари и файлы. Используйте панель инструментов для
|
|
75
|
+
- Откройте иконку Intlayer на панели активности.
|
|
76
|
+
- В поле **Поиск** введите текст для фильтрации словарей и записей в реальном времени.
|
|
77
|
+
- В разделе **Словари** просматривайте окружения, словари и файлы. Используйте панель инструментов для действий: Сборка, Загрузка, Отправка, Заполнение, Обновление, Тестирование и Создание файла словаря. Щелкните правой кнопкой мыши для контекстных действий (Загрузка/Отправка для словарей, Заполнение для файлов). Текущий файл редактора автоматически подсвечивается в дереве, если применимо.
|
|
136
78
|
|
|
137
|
-
|
|
79
|
+
### Доступ к командам
|
|
138
80
|
|
|
139
|
-
|
|
81
|
+
Вы можете получить доступ к командам через **Палитру команд**.
|
|
140
82
|
|
|
141
83
|
```sh
|
|
142
84
|
Cmd + Shift + P (macOS) / Ctrl + Shift + P (Windows/Linux)
|
|
143
85
|
```
|
|
144
86
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
1. Откройте **Палитру команд**.
|
|
152
|
-
2. Найдите **Push Dictionaries**.
|
|
153
|
-
3. Выберите словари для отправки и подтвердите.
|
|
154
|
-
|
|
155
|
-
#### Получение словарей
|
|
87
|
+
- **Сборка словарей**
|
|
88
|
+
- **Отправка словарей**
|
|
89
|
+
- **Загрузка словарей**
|
|
90
|
+
- **Заполнение словарей**
|
|
91
|
+
- **Тестирование словарей**
|
|
92
|
+
- **Создание файла словаря**
|
|
156
93
|
|
|
157
|
-
|
|
94
|
+
### Загрузка переменных окружения
|
|
158
95
|
|
|
159
|
-
|
|
160
|
-
2. Найдите **Pull Dictionaries**.
|
|
161
|
-
3. Выберите словари для загрузки.
|
|
96
|
+
Intlayer рекомендует хранить ваши ключи API ИИ, а также идентификатор клиента Intlayer и секрет в переменных окружения.
|
|
162
97
|
|
|
163
|
-
|
|
98
|
+
Расширение может загружать переменные окружения из вашего рабочего пространства для выполнения команд Intlayer с правильным контекстом.
|
|
164
99
|
|
|
165
|
-
|
|
100
|
+
- **Порядок загрузки (по приоритету)**: `.env.<env>.local` → `.env.<env>` → `.env.local` → `.env`
|
|
101
|
+
- **Без разрушения**: существующие значения `process.env` не перезаписываются.
|
|
102
|
+
- **Область действия**: файлы разрешаются из настроенной базовой директории (по умолчанию корень рабочего пространства).
|
|
166
103
|
|
|
167
|
-
|
|
168
|
-
2. Найдите **Fill Dictionaries**.
|
|
169
|
-
3. Выполните команду для заполнения словарей.
|
|
104
|
+
#### Выбор активного окружения
|
|
170
105
|
|
|
171
|
-
|
|
106
|
+
- **Палитра команд**: откройте палитру и выполните команду `Intlayer: Select Environment`, затем выберите окружение (например, `development`, `staging`, `production`). Расширение попытается загрузить первый доступный файл из приведённого выше списка приоритетов и покажет уведомление, например «Загружено окружение из .env.<env>.local».
|
|
107
|
+
- **Настройки**: перейдите в `Настройки → Расширения → Intlayer` и установите:
|
|
108
|
+
- **Окружение**: имя окружения, используемое для разрешения файлов `.env.<env>*`.
|
|
109
|
+
- (Опционально) **Файл Env**: явный путь к файлу `.env`. При указании он имеет приоритет над списком, определённым автоматически.
|
|
172
110
|
|
|
173
|
-
|
|
111
|
+
#### Моно-репозитории и пользовательские директории
|
|
174
112
|
|
|
175
|
-
|
|
176
|
-
2. Найдите **Test Dictionaries**.
|
|
177
|
-
3. Просмотрите обнаруженные проблемы и исправьте их при необходимости.
|
|
113
|
+
Если ваши файлы `.env` находятся за пределами корня рабочего пространства, установите **Базовый каталог** в `Настройки → Расширения → Intlayer`. Загрузчик будет искать файлы `.env` относительно этого каталога.
|
|
178
114
|
|
|
179
|
-
## История
|
|
115
|
+
## История документации
|
|
180
116
|
|
|
181
|
-
| Версия | Дата | Изменения
|
|
182
|
-
| ------ | ---------- |
|
|
183
|
-
|
|
|
117
|
+
| Версия | Дата | Изменения |
|
|
118
|
+
| ------ | ---------- | -------------------------------------- |
|
|
119
|
+
| 6.1.5 | 2025-09-30 | Добавлено демонстрационное gif |
|
|
120
|
+
| 6.1.0 | 2025-09-24 | Добавлен раздел выбора окружения |
|
|
121
|
+
| 6.0.0 | 2025-09-22 | Вкладка Intlayer / команды Fill & Test |
|
|
122
|
+
| 5.5.10 | 2025-06-29 | Инициализация истории |
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-09-30
|
|
4
|
+
title: React ve Next.js'te bir bileşeni çok dilli (i18n kütüphanesi) yapma
|
|
5
|
+
description: Intlayer ile çok dilli bir React veya Next.js bileşeni oluşturmak için yerelleştirilmiş içeriğin nasıl beyan edileceğini ve alınacağını öğrenin.
|
|
6
|
+
keywords:
|
|
7
|
+
- i18n
|
|
8
|
+
- bileşen
|
|
9
|
+
- react
|
|
10
|
+
- çok dilli
|
|
11
|
+
- next.js
|
|
12
|
+
- intlayer
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- component
|
|
16
|
+
- i18n
|
|
17
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-vite-react-template
|
|
18
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# Intlayer ile bir bileşeni çok dilli (i18n) nasıl yaparsınız
|
|
22
|
+
|
|
23
|
+
Bu rehber, iki yaygın kurulumda bir UI bileşenini çok dilli yapmak için gereken asgari adımları gösterir:
|
|
24
|
+
|
|
25
|
+
- React (Vite/SPA)
|
|
26
|
+
- Next.js (App Router)
|
|
27
|
+
|
|
28
|
+
Öncelikle içeriğinizi beyan edecek, ardından bileşeninizde içeriği alacaksınız.
|
|
29
|
+
|
|
30
|
+
## 1) İçeriğinizi beyan edin (React ve Next.js için ortak)
|
|
31
|
+
|
|
32
|
+
Bileşeninizin yakınında bir içerik beyan dosyası oluşturun. Bu, çevirileri kullanıldıkları yere yakın tutar ve tür güvenliğini sağlar.
|
|
33
|
+
|
|
34
|
+
```ts fileName="component.content.ts"
|
|
35
|
+
import { t, type Dictionary } from "intlayer";
|
|
36
|
+
|
|
37
|
+
const componentContent = {
|
|
38
|
+
key: "component-example",
|
|
39
|
+
content: {
|
|
40
|
+
title: t({
|
|
41
|
+
en: "Hello",
|
|
42
|
+
fr: "Bonjour",
|
|
43
|
+
es: "Hola",
|
|
44
|
+
}),
|
|
45
|
+
description: t({
|
|
46
|
+
en: "A multilingual React component",
|
|
47
|
+
fr: "Un composant React multilingue",
|
|
48
|
+
es: "Un componente React multilingüe",
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
} satisfies Dictionary;
|
|
52
|
+
|
|
53
|
+
export default componentContent;
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Yapılandırma dosyalarını tercih ediyorsanız JSON da desteklenmektedir.
|
|
57
|
+
|
|
58
|
+
```json fileName="component.content.json"
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
61
|
+
"key": "component-example",
|
|
62
|
+
"content": {
|
|
63
|
+
"title": {
|
|
64
|
+
"nodeType": "translation",
|
|
65
|
+
"translation": { "en": "Hello", "fr": "Bonjour", "es": "Hola" }
|
|
66
|
+
},
|
|
67
|
+
"description": {
|
|
68
|
+
"nodeType": "translation",
|
|
69
|
+
"translation": {
|
|
70
|
+
"en": "A multilingual React component",
|
|
71
|
+
"fr": "Un composant React multilingue",
|
|
72
|
+
"es": "Un componente React multilingüe"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 2) İçeriğinizi alın
|
|
80
|
+
|
|
81
|
+
### Durum A — React uygulaması (Vite/SPA)
|
|
82
|
+
|
|
83
|
+
Varsayılan yaklaşım: Anahtarla almak için `useIntlayer` kullanın. Bu, bileşenleri hafif ve tipli tutar.
|
|
84
|
+
|
|
85
|
+
```tsx fileName="ComponentExample.tsx"
|
|
86
|
+
import { useIntlayer } from "react-intlayer";
|
|
87
|
+
|
|
88
|
+
export function ComponentExample() {
|
|
89
|
+
const content = useIntlayer("component-example");
|
|
90
|
+
return (
|
|
91
|
+
<div>
|
|
92
|
+
<h1>{content.title}</h1>
|
|
93
|
+
<p>{content.description}</p>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Sunucu tarafı render veya sağlayıcı dışında: `react-intlayer/server` kullanın ve gerektiğinde açık bir `locale` parametresi geçin.
|
|
100
|
+
|
|
101
|
+
```tsx fileName="ServerRenderedExample.tsx"
|
|
102
|
+
import { useIntlayer } from "react-intlayer/server";
|
|
103
|
+
|
|
104
|
+
export function ServerRenderedExample({ locale }: { locale: string }) {
|
|
105
|
+
const content = useIntlayer("component-example", locale);
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<h1>{content.title}</h1>
|
|
109
|
+
<p>{content.description}</p>
|
|
110
|
+
</>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Alternatif: Çağrı noktasında yapıyı yan yana koymayı tercih ederseniz, `useDictionary` tüm tanımlı nesneyi okuyabilir.
|
|
116
|
+
|
|
117
|
+
```tsx fileName="ComponentWithDictionary.tsx"
|
|
118
|
+
import { useDictionary } from "react-intlayer";
|
|
119
|
+
import componentContent from "./component.content";
|
|
120
|
+
|
|
121
|
+
export function ComponentWithDictionary() {
|
|
122
|
+
const { title, description } = useDictionary(componentContent);
|
|
123
|
+
return (
|
|
124
|
+
<div>
|
|
125
|
+
<h1>{title}</h1>
|
|
126
|
+
<p>{description}</p>
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Durum B — Next.js (App Router)
|
|
133
|
+
|
|
134
|
+
Veri güvenliği ve performans için sunucu bileşenlerini tercih edin. Sunucu dosyalarında `next-intlayer/server` içinden `useIntlayer` kullanın, istemci bileşenlerinde ise `next-intlayer` içinden `useIntlayer` kullanın.
|
|
135
|
+
|
|
136
|
+
```tsx fileName="app/[locale]/example/ServerComponent.tsx"
|
|
137
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
138
|
+
|
|
139
|
+
export default function ServerComponent() {
|
|
140
|
+
const content = useIntlayer("component-example");
|
|
141
|
+
return (
|
|
142
|
+
<>
|
|
143
|
+
<h1>{content.title}</h1>
|
|
144
|
+
<p>{content.description}</p>
|
|
145
|
+
</>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```tsx fileName="app/[locale]/example/ClientComponent.tsx"
|
|
151
|
+
"use client";
|
|
152
|
+
|
|
153
|
+
import { useIntlayer } from "next-intlayer";
|
|
154
|
+
|
|
155
|
+
export function ClientComponent() {
|
|
156
|
+
const content = useIntlayer("component-example");
|
|
157
|
+
return (
|
|
158
|
+
<div>
|
|
159
|
+
<h1>{content.title}</h1>
|
|
160
|
+
<p>{content.description}</p>
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
İpucu: Sayfa meta verileri ve SEO için, içeriği `getIntlayer` kullanarak da alabilir ve çok dilli URL’leri `getMultilingualUrls` ile oluşturabilirsiniz.
|
|
167
|
+
|
|
168
|
+
## Neden Intlayer’ın bileşen yaklaşımı en iyisidir
|
|
169
|
+
|
|
170
|
+
- **Birlikte konumlandırma**: İçerik beyanları bileşenlerin yakınında bulunur, sürüklenmeyi azaltır ve tasarım sistemleri arasında yeniden kullanımı artırır.
|
|
171
|
+
- **Tip güvenliği**: Anahtarlar ve yapılar güçlü şekilde tiplenmiştir; eksik çeviriler çalışma zamanında değil, derleme zamanında ortaya çıkar.
|
|
172
|
+
- **Sunucu-öncelikli**: Daha iyi güvenlik ve performans için sunucu bileşenlerinde doğal olarak çalışır; istemci kancaları ergonomik kalır.
|
|
173
|
+
- **Ağaç sarsma (Tree-shaking)**: Sadece bileşen tarafından kullanılan içerik paketlenir, böylece büyük uygulamalarda yükler küçük tutulur.
|
|
174
|
+
- **Geliştirici Deneyimi (DX) ve araçlar**: Dahili ara katman yazılımı, SEO yardımcıları ve isteğe bağlı Görsel Editör/Yapay Zeka çevirileri günlük işleri kolaylaştırır.
|
|
175
|
+
|
|
176
|
+
Next.js odaklı karşılaştırmalar ve kalıplar için bakınız: https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
|
|
177
|
+
|
|
178
|
+
## İlgili rehberler ve referanslar
|
|
179
|
+
|
|
180
|
+
- React kurulumu (Vite): https://intlayer.org/doc/environment/vite-and-react
|
|
181
|
+
- React Router v7: https://intlayer.org/doc/environment/vite-and-react/react-router-v7
|
|
182
|
+
- TanStack Başlangıç: https://intlayer.org/doc/environment/vite-and-react/tanstack-start
|
|
183
|
+
- Next.js kurulumu: https://intlayer.org/doc/environment/nextjs
|
|
184
|
+
- Neden Intlayer vs. next-intl vs. next-i18next: https://intlayer.org/blog/next-i18next-vs-next-intl-vs-intlayer
|
|
185
|
+
|
|
186
|
+
Bu sayfalar uçtan uca kurulum, sağlayıcılar, yönlendirme ve SEO yardımcılarını içerir.
|
|
@@ -74,7 +74,7 @@ const MyComponent = () => {
|
|
|
74
74
|
|
|
75
75
|
Bu kanca yerel ayar algılamayı sizin için yönetecek ve mevcut yerel ayar için içeriği döndürecektir. Bu kancayı kullanarak, markdown'ı yorumlayabilir, çoğullaştırmayı yönetebilir ve daha fazlasını yapabilirsiniz.
|
|
76
76
|
|
|
77
|
-
> Intlayer'ın tüm özelliklerini görmek için [sözlük dokümantasyonunu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
77
|
+
> Intlayer'ın tüm özelliklerini görmek için [sözlük dokümantasyonunu](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) okuyabilirsiniz.
|
|
78
78
|
|
|
79
79
|
## Uzak içerik
|
|
80
80
|
|
package/docs/tr/index.md
CHANGED
|
@@ -51,7 +51,7 @@ Intlayer, uygulamanızı çevirmek için esnek, modern bir yaklaşım sunar. Bel
|
|
|
51
51
|
|
|
52
52
|
Çok dilli içeriğinizi kodunuzun yakınında organize edin, böylece her şey tutarlı ve sürdürülebilir kalır.
|
|
53
53
|
|
|
54
|
-
- **[Başlarken](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
54
|
+
- **[Başlarken](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)**
|
|
55
55
|
Intlayer'da içeriğinizi bildirmenin temellerini öğrenin.
|
|
56
56
|
|
|
57
57
|
- **[Çeviri](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/translation.md)**
|
package/docs/tr/intlayer_cli.md
CHANGED
|
@@ -40,7 +40,7 @@ pnpm add intlayer-cli -g
|
|
|
40
40
|
|
|
41
41
|
## intlayer-cli paketi
|
|
42
42
|
|
|
43
|
-
`intlayer-cli` paketi [intlayer bildirimlerinizi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
43
|
+
`intlayer-cli` paketi [intlayer bildirimlerinizi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) sözlüklere dönüştürmeyi amaçlar.
|
|
44
44
|
|
|
45
45
|
Bu paket tüm intlayer dosyalarını dönüştürecek, örneğin `src/**/*.content.{ts|js|mjs|cjs|json}`. [Intlayer bildirim dosyalarınızı nasıl bildireceğinizi görün](https://github.com/aymericzip/intlayer/blob/main/packages/intlayer/README.md).
|
|
46
46
|
|