@intlayer/docs 6.1.6-canary.0 → 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/en/next-i18next_vs_next-intl_vs_intlayer.md +71 -80
- package/dist/cjs/generated/docs.entry.cjs +16 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +16 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +1 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- 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/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/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 +13 -4
- package/docs/en/intlayer_with_nextjs_15.md +13 -4
- 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-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/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/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/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/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/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/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/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/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/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/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/package.json +11 -11
- package/src/generated/docs.entry.ts +16 -0
|
@@ -59,7 +59,7 @@ yarn add vite-intlayer --save-dev
|
|
|
59
59
|
|
|
60
60
|
- **intlayer**
|
|
61
61
|
|
|
62
|
-
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
62
|
+
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), dönüştürme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md) için uluslararasılaştırma araçları sağlayan çekirdek paket.
|
|
63
63
|
|
|
64
64
|
- **preact-intlayer**
|
|
65
65
|
Preact uygulamasıyla Intlayer'ı entegre eden paket. Preact uluslararasılaştırması için bağlam sağlayıcıları ve kancalar sağlar.
|
|
@@ -374,7 +374,7 @@ module.exports = appContent;
|
|
|
374
374
|
|
|
375
375
|
> İçerik bildiriminiz uygulamanızın herhangi bir yerine yerleştirilebilir, yeter ki `contentDir` dizinine dahil edilsin (varsayılan olarak `./src`). Ve içerik bildirimi dosya uzantısı ile eşleşsin (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
376
376
|
|
|
377
|
-
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
377
|
+
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) bakın.
|
|
378
378
|
|
|
379
379
|
> İçerik dosyanız TSX kodu içeriyorsa, `import { h } from "preact";`'ı içe aktarmanız gerekebilir veya JSX pragma'nızın Preact için doğru şekilde ayarlandığından emin olun.
|
|
380
380
|
|
|
@@ -1036,40 +1036,40 @@ const App = () => (
|
|
|
1036
1036
|
module.exports = App;
|
|
1037
1037
|
```
|
|
1038
1038
|
|
|
1039
|
-
Paralel olarak, uygulamanıza sunucu tarafı yönlendirme eklemek için `
|
|
1039
|
+
Paralel olarak, uygulamanıza sunucu tarafı yönlendirme eklemek için `intlayerMiddleware`'i de kullanabilirsiniz. Bu eklenti, URL'ye göre geçerli yerel ayarı otomatik olarak algılar ve uygun yerel ayar çerezini ayarlar. Hiç yerel ayar belirtilmezse, eklenti kullanıcının tarayıcı dil tercihlerine göre en uygun yerel ayarı belirler. Hiç yerel ayar algılanmazsa, varsayılan yerel ayara yönlendirir.
|
|
1040
1040
|
|
|
1041
|
-
> Not: Üretimde `
|
|
1041
|
+
> Not: Üretimde `intlayerMiddleware`'i kullanmak için `vite-intlayer` paketini `devDependencies`'den `dependencies`'e taşımalısınız.
|
|
1042
1042
|
|
|
1043
1043
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1044
1044
|
import { defineConfig } from "vite";
|
|
1045
1045
|
import preact from "@preact/preset-vite";
|
|
1046
|
-
import { intlayer,
|
|
1046
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1047
1047
|
|
|
1048
1048
|
// https://vitejs.dev/config/
|
|
1049
1049
|
export default defineConfig({
|
|
1050
|
-
plugins: [preact(), intlayer(),
|
|
1050
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1051
1051
|
});
|
|
1052
1052
|
```
|
|
1053
1053
|
|
|
1054
1054
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
1055
1055
|
import { defineConfig } from "vite";
|
|
1056
1056
|
import preact from "@preact/preset-vite";
|
|
1057
|
-
import { intlayer,
|
|
1057
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1058
1058
|
|
|
1059
1059
|
// https://vitejs.dev/config/
|
|
1060
1060
|
export default defineConfig({
|
|
1061
|
-
plugins: [preact(), intlayer(),
|
|
1061
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1062
1062
|
});
|
|
1063
1063
|
```
|
|
1064
1064
|
|
|
1065
1065
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
1066
1066
|
const { defineConfig } = require("vite");
|
|
1067
1067
|
const preact = require("@preact/preset-vite");
|
|
1068
|
-
const { intlayer,
|
|
1068
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
1069
1069
|
|
|
1070
1070
|
// https://vitejs.dev/config/
|
|
1071
1071
|
module.exports = defineConfig({
|
|
1072
|
-
plugins: [preact(), intlayer(),
|
|
1072
|
+
plugins: [preact(), intlayer(), intlayerMiddleware()],
|
|
1073
1073
|
});
|
|
1074
1074
|
```
|
|
1075
1075
|
|
|
@@ -1604,9 +1604,9 @@ module.exports = { LocalizedLink, checkIsExternalLink };
|
|
|
1604
1604
|
|
|
1605
1605
|
Intlayer, modül genişletmesi kullanarak TypeScript avantajlarından yararlanır.
|
|
1606
1606
|
|
|
1607
|
-

|
|
1608
1608
|
|
|
1609
|
-

|
|
1610
1610
|
|
|
1611
1611
|
Otomatik oluşturulan türleri TypeScript yapılandırmanıza dahil edin.
|
|
1612
1612
|
|
|
@@ -61,7 +61,7 @@ yarn add vite-intlayer --save-dev
|
|
|
61
61
|
|
|
62
62
|
- **intlayer**
|
|
63
63
|
|
|
64
|
-
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
64
|
+
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), dönüştürme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md) için uluslararasılaştırma araçları sağlayan çekirdek paket.
|
|
65
65
|
|
|
66
66
|
- **react-intlayer**
|
|
67
67
|
React uygulamasıyla Intlayer'ı entegre eden paket. React uluslararasılaştırması için bağlam sağlayıcıları ve kancalar sağlar.
|
|
@@ -406,7 +406,7 @@ module.exports = appContent;
|
|
|
406
406
|
|
|
407
407
|
> İçerik bildiriminiz uygulamanızın herhangi bir yerine yerleştirilebilir, yeter ki `contentDir` dizinine dahil edilsin (varsayılan olarak `./src`). Ve içerik bildirimi dosya uzantısı ile eşleşsin (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
408
408
|
|
|
409
|
-
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
409
|
+
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) bakın.
|
|
410
410
|
|
|
411
411
|
> İçerik dosyanız TSX kodu içeriyorsa, `import React from "react";`'ı içerik dosyanıza dahil etmeyi düşünün.
|
|
412
412
|
|
|
@@ -1004,40 +1004,40 @@ const App = () => (
|
|
|
1004
1004
|
);
|
|
1005
1005
|
```
|
|
1006
1006
|
|
|
1007
|
-
Paralel olarak, uygulamanıza sunucu tarafı yönlendirme eklemek için `
|
|
1007
|
+
Paralel olarak, uygulamanıza sunucu tarafı yönlendirme eklemek için `intlayerMiddleware`'i de kullanabilirsiniz. Bu eklenti, URL'ye göre geçerli yerel ayarı otomatik olarak algılar ve uygun yerel ayar çerezini ayarlar. Hiç yerel ayar belirtilmezse, eklenti kullanıcının tarayıcı dil tercihlerine göre en uygun yerel ayarı belirler. Hiç yerel ayar algılanmazsa, varsayılan yerel ayara yönlendirir.
|
|
1008
1008
|
|
|
1009
|
-
> Not: Üretimde `
|
|
1009
|
+
> Not: Üretimde `intlayerMiddleware`'i kullanmak için `vite-intlayer` paketini `devDependencies`'den `dependencies`'e taşımalısınız.
|
|
1010
1010
|
|
|
1011
1011
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
1012
1012
|
import { defineConfig } from "vite";
|
|
1013
1013
|
import react from "@vitejs/plugin-react-swc";
|
|
1014
|
-
import { intlayer,
|
|
1014
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1015
1015
|
|
|
1016
1016
|
// https://vitejs.dev/config/
|
|
1017
1017
|
export default defineConfig({
|
|
1018
|
-
plugins: [react(), intlayer(),
|
|
1018
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1019
1019
|
});
|
|
1020
1020
|
```
|
|
1021
1021
|
|
|
1022
1022
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
1023
1023
|
import { defineConfig } from "vite";
|
|
1024
1024
|
import react from "@vitejs/plugin-react-swc";
|
|
1025
|
-
import { intlayer,
|
|
1025
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
1026
1026
|
|
|
1027
1027
|
// https://vitejs.dev/config/
|
|
1028
1028
|
export default defineConfig({
|
|
1029
|
-
plugins: [react(), intlayer(),
|
|
1029
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1030
1030
|
});
|
|
1031
1031
|
```
|
|
1032
1032
|
|
|
1033
1033
|
```javascript {3,7} fileName="vite.config.cjs" codeFormat="commonjs"
|
|
1034
1034
|
const { defineConfig } = require("vite");
|
|
1035
1035
|
const react = "@vitejs/plugin-react-swc";
|
|
1036
|
-
const { intlayer,
|
|
1036
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
1037
1037
|
|
|
1038
1038
|
// https://vitejs.dev/config/
|
|
1039
1039
|
module.exports = defineConfig({
|
|
1040
|
-
plugins: [react(), intlayer(),
|
|
1040
|
+
plugins: [react(), intlayer(), intlayerMiddleware()],
|
|
1041
1041
|
});
|
|
1042
1042
|
```
|
|
1043
1043
|
|
|
@@ -1571,9 +1571,9 @@ Bu `Link` bileşenini uygulamanız boyunca entegre ederek, dil farkındalığı
|
|
|
1571
1571
|
|
|
1572
1572
|
Intlayer, modül genişletmesi kullanarak TypeScript avantajlarından yararlanır.
|
|
1573
1573
|
|
|
1574
|
-

|
|
1575
1575
|
|
|
1576
|
-

|
|
1577
1577
|
|
|
1578
1578
|
Otomatik oluşturulan türleri TypeScript yapılandırmanıza dahil edin.
|
|
1579
1579
|
|
|
@@ -59,7 +59,7 @@ yarn add vite-intlayer --save-dev
|
|
|
59
59
|
|
|
60
60
|
- **intlayer**
|
|
61
61
|
|
|
62
|
-
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
62
|
+
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), dönüştürme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md) için uluslararasılaştırma araçları sağlayan çekirdek paket.
|
|
63
63
|
|
|
64
64
|
- **solid-intlayer**
|
|
65
65
|
Solid uygulamasıyla Intlayer'ı entegre eden paket. Solid uluslararasılaştırması için bağlam sağlayıcıları ve kancalar sağlar.
|
|
@@ -217,7 +217,7 @@ module.exports = appContent;
|
|
|
217
217
|
|
|
218
218
|
> İçerik bildiriminiz uygulamanızın herhangi bir yerine yerleştirilebilir, yeter ki `contentDir` dizinine dahil edilsin (varsayılan olarak `./src`). Ve içerik bildirimi dosya uzantısı ile eşleşsin (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
219
219
|
|
|
220
|
-
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
220
|
+
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) bakın.
|
|
221
221
|
|
|
222
222
|
### Adım 5: Kodunuzda Intlayer'ı Kullanın
|
|
223
223
|
|
|
@@ -59,7 +59,7 @@ yarn add vite-intlayer --save-dev
|
|
|
59
59
|
|
|
60
60
|
- **intlayer**
|
|
61
61
|
|
|
62
|
-
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
62
|
+
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), dönüştürme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md) için uluslararasılaştırma araçları sağlayan çekirdek paket.
|
|
63
63
|
|
|
64
64
|
- **svelte-intlayer**
|
|
65
65
|
Svelte uygulamasıyla Intlayer'ı entegre eden paket. Svelte uluslararasılaştırması için bağlam sağlayıcıları ve kancalar sağlar.
|
|
@@ -217,7 +217,7 @@ module.exports = appContent;
|
|
|
217
217
|
|
|
218
218
|
> İçerik bildiriminiz uygulamanızın herhangi bir yerine yerleştirilebilir, yeter ki `contentDir` dizinine dahil edilsin (varsayılan olarak `./src`). Ve içerik bildirimi dosya uzantısı ile eşleşsin (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
219
219
|
|
|
220
|
-
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
220
|
+
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) bakın.
|
|
221
221
|
|
|
222
222
|
### Adım 5: Kodunuzda Intlayer'ı Kullanın
|
|
223
223
|
|
|
@@ -57,7 +57,7 @@ yarn add vite-intlayer --save-dev
|
|
|
57
57
|
|
|
58
58
|
- **intlayer**
|
|
59
59
|
|
|
60
|
-
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
60
|
+
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md), dönüştürme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_cli.md) için uluslararasılaştırma araçları sağlayan çekirdek paket.
|
|
61
61
|
|
|
62
62
|
- **vue-intlayer**
|
|
63
63
|
Vue uygulamasıyla Intlayer'ı entegre eden paket. Vue uluslararasılaştırması için bağlam sağlayıcıları ve composables sağlar.
|
|
@@ -356,7 +356,7 @@ module.exports = appContent;
|
|
|
356
356
|
|
|
357
357
|
> İçerik bildiriminiz uygulamanızın herhangi bir yerine yerleştirilebilir, yeter ki `contentDir` dizinine dahil edilsin (varsayılan olarak `./src`). Ve içerik bildirimi dosya uzantısı ile eşleşsin (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
358
358
|
|
|
359
|
-
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
359
|
+
> Daha fazla ayrıntı için [içerik bildirimi dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md) bakın.
|
|
360
360
|
|
|
361
361
|
### Adım 5: Kodunuzda Intlayer'ı Kullanın
|
|
362
362
|
|
|
@@ -644,40 +644,40 @@ import LocaleSwitcher from "@components/LocaleSwitcher.vue";
|
|
|
644
644
|
</template>
|
|
645
645
|
```
|
|
646
646
|
|
|
647
|
-
Paralel olarak, uygulamanıza sunucu tarafı yönlendirme eklemek için `
|
|
647
|
+
Paralel olarak, uygulamanıza sunucu tarafı yönlendirme eklemek için `intlayerMiddleware`'i de kullanabilirsiniz. Bu eklenti, URL'ye göre geçerli yerel ayarı otomatik olarak algılar ve uygun yerel ayar çerezini ayarlar. Hiç yerel ayar belirtilmezse, eklenti kullanıcının tarayıcı dil tercihlerine göre en uygun yerel ayarı belirler. Hiç yerel ayar algılanmazsa, varsayılan yerel ayara yönlendirir.
|
|
648
648
|
|
|
649
|
-
> Not: Üretimde `
|
|
649
|
+
> Not: Üretimde `intlayerMiddleware`'i kullanmak için `vite-intlayer` paketini `devDependencies`'den `dependencies`'e taşımalısınız.
|
|
650
650
|
|
|
651
651
|
```typescript {3,7} fileName="vite.config.ts" codeFormat="typescript"
|
|
652
652
|
import { defineConfig } from "vite";
|
|
653
653
|
import vue from "@vitejs/plugin-vue";
|
|
654
|
-
import { intlayer,
|
|
654
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
655
655
|
|
|
656
656
|
// https://vitejs.dev/config/
|
|
657
657
|
export default defineConfig({
|
|
658
|
-
plugins: [vue(), intlayer(),
|
|
658
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
659
659
|
});
|
|
660
660
|
```
|
|
661
661
|
|
|
662
662
|
```javascript {3,7} fileName="vite.config.mjs" codeFormat="esm"
|
|
663
663
|
import { defineConfig } from "vite";
|
|
664
664
|
import vue from "@vitejs/plugin-vue";
|
|
665
|
-
import { intlayer,
|
|
665
|
+
import { intlayer, intlayerMiddleware } from "vite-intlayer";
|
|
666
666
|
|
|
667
667
|
// https://vitejs.dev/config/
|
|
668
668
|
export default defineConfig({
|
|
669
|
-
plugins: [vue(), intlayer(),
|
|
669
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
670
670
|
});
|
|
671
671
|
```
|
|
672
672
|
|
|
673
673
|
```javascript fileName="vite.config.cjs" codeFormat="commonjs"
|
|
674
674
|
const { defineConfig } = require("vite");
|
|
675
675
|
const vue = require("@vitejs/plugin-vue");
|
|
676
|
-
const { intlayer,
|
|
676
|
+
const { intlayer, intlayerMiddleware } = require("vite-intlayer");
|
|
677
677
|
|
|
678
678
|
// https://vitejs.dev/config/
|
|
679
679
|
module.exports = defineConfig({
|
|
680
|
-
plugins: [vue(), intlayer(),
|
|
680
|
+
plugins: [vue(), intlayer(), intlayerMiddleware()],
|
|
681
681
|
});
|
|
682
682
|
```
|
|
683
683
|
|
|
@@ -981,9 +981,9 @@ const { myMarkdownContent } = useIntlayer("my-component");
|
|
|
981
981
|
|
|
982
982
|
Intlayer, modül genişletmesi kullanarak TypeScript avantajlarından yararlanır.
|
|
983
983
|
|
|
984
|
-

|
|
985
985
|
|
|
986
|
-

|
|
987
987
|
|
|
988
988
|
Otomatik oluşturulan türleri TypeScript yapılandırmanıza dahil edin.
|
|
989
989
|
|
package/docs/tr/introduction.md
CHANGED
|
@@ -152,7 +152,7 @@ Intlayer, modern web geliştirmenin ihtiyaçlarını karşılamak için çeşitl
|
|
|
152
152
|
|
|
153
153
|
Çok dilli içeriğinizi kodunuzun yakınında organize edin, böylece her şey tutarlı ve sürdürülebilir kalır.
|
|
154
154
|
|
|
155
|
-
- **[Başlarken](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
155
|
+
- **[Başlarken](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)**
|
|
156
156
|
Intlayer'da içeriğinizi bildirmenin temellerini öğrenin.
|
|
157
157
|
|
|
158
158
|
- **[Çeviri](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/translation.md)**
|
|
@@ -331,7 +331,7 @@ The hook accepts two parameters:
|
|
|
331
331
|
|
|
332
332
|
## Dictionary
|
|
333
333
|
|
|
334
|
-
All dictionary objects should be declared in structured content files to ensure type safety and prevent runtime errors. You can find the [setup instructions here](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
334
|
+
All dictionary objects should be declared in structured content files to ensure type safety and prevent runtime errors. You can find the [setup instructions here](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md). Here's an example of content declaration:
|
|
335
335
|
|
|
336
336
|
```typescript fileName="./component.content.ts" contentDeclarationFormat="typescript"
|
|
337
337
|
import { t, type Dictionary } from "intlayer";
|
|
@@ -294,7 +294,7 @@ This hook accepts two parameters:
|
|
|
294
294
|
|
|
295
295
|
## Dictionary
|
|
296
296
|
|
|
297
|
-
All dictionary keys must be declared within content declaration files to enhance type safety and prevent errors. [Configuration instructions can be found here](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
297
|
+
All dictionary keys must be declared within content declaration files to enhance type safety and prevent errors. [Configuration instructions can be found here](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md).
|
|
298
298
|
|
|
299
299
|
## Usage Examples in React
|
|
300
300
|
|
package/docs/tr/roadmap.md
CHANGED
|
@@ -32,7 +32,7 @@ Intlayer, uygulamalarınızda içeriği bildirme, yönetme ve güncelleme şekli
|
|
|
32
32
|
|
|
33
33
|
> Kaynaklar:
|
|
34
34
|
>
|
|
35
|
-
> - [İçerik Bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/
|
|
35
|
+
> - [İçerik Bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/dictionary/content_file.md)
|
|
36
36
|
|
|
37
37
|
### 2. Uluslararasılaştırma
|
|
38
38
|
|
|
@@ -664,9 +664,9 @@ export const appConfig: ApplicationConfig = {
|
|
|
664
664
|
|
|
665
665
|
Intlayer 使用模块增强来利用 TypeScript 的优势,使你的代码库更健壮。
|
|
666
666
|
|
|
667
|
-

|
|
668
668
|
|
|
669
|
-

|
|
670
670
|
|
|
671
671
|
确保你的 TypeScript 配置包含自动生成的类型。
|
|
672
672
|
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-10-03
|
|
4
|
+
title: 在 Astro 中使用 Intlayer 入门
|
|
5
|
+
description: 学习如何使用 Intlayer 为您的 Vite 和 React 应用添加国际化(i18n)。按照本指南使您的应用支持多语言。
|
|
6
|
+
keywords:
|
|
7
|
+
- 国际化
|
|
8
|
+
- 文档
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- React
|
|
12
|
+
- i18n
|
|
13
|
+
- JavaScript
|
|
14
|
+
slugs:
|
|
15
|
+
- doc
|
|
16
|
+
- environment
|
|
17
|
+
- astro
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-astro-template
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# 使用 Intlayer 和 Astro 开始国际化(i18n)
|
|
22
|
+
|
|
23
|
+
请参阅 GitHub 上的[应用模板](https://github.com/aymericzip/intlayer-astro-template)。
|
|
24
|
+
|
|
25
|
+
## 什么是 Intlayer?
|
|
26
|
+
|
|
27
|
+
**Intlayer** 是一个创新的开源国际化(i18n)库,旨在简化现代 Web 应用中的多语言支持。
|
|
28
|
+
|
|
29
|
+
使用 Intlayer,您可以:
|
|
30
|
+
|
|
31
|
+
- **通过组件级声明式字典轻松管理翻译**。
|
|
32
|
+
- **动态本地化元数据、路由和内容**。
|
|
33
|
+
- **确保 TypeScript 支持**,通过自动生成类型,提升自动补全和错误检测能力。
|
|
34
|
+
- **享受高级功能**,如动态语言环境检测和切换。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 在 Astro 中设置 Intlayer 的分步指南
|
|
39
|
+
|
|
40
|
+
### 第一步:安装依赖
|
|
41
|
+
|
|
42
|
+
使用您的包管理器安装必要的包:
|
|
43
|
+
|
|
44
|
+
```bash packageManager="npm"
|
|
45
|
+
npm install intlayer astro-intlayer
|
|
46
|
+
# 可选:添加 React 岛屿支持
|
|
47
|
+
npm install react react-dom react-intlayer @astrojs/react
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash packageManager="pnpm"
|
|
51
|
+
pnpm add intlayer astro-intlayer
|
|
52
|
+
# 可选:添加 React 岛屿支持
|
|
53
|
+
pnpm add react react-dom react-intlayer @astrojs/react
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash packageManager="yarn"
|
|
57
|
+
yarn add intlayer astro-intlayer
|
|
58
|
+
# 可选:添加 React 岛屿支持
|
|
59
|
+
yarn add react react-dom react-intlayer @astrojs/react
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **intlayer**
|
|
63
|
+
核心包,提供国际化工具,用于配置管理、翻译、[内容声明](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/get_started.md)、转译以及[命令行工具](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_cli.md)。
|
|
64
|
+
|
|
65
|
+
- **astro-intlayer**
|
|
66
|
+
包括用于将 Intlayer 与 [Vite 打包工具](https://vite.dev/guide/why.html#why-bundle-for-production) 集成的 Astro 集成插件,以及用于检测用户首选语言环境、管理 Cookie 和处理 URL 重定向的中间件。
|
|
67
|
+
|
|
68
|
+
### 第 2 步:配置您的项目
|
|
69
|
+
|
|
70
|
+
创建一个配置文件来配置您的应用程序语言:
|
|
71
|
+
|
|
72
|
+
```typescript fileName="intlayer.config.ts"
|
|
73
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
74
|
+
|
|
75
|
+
const config: IntlayerConfig = {
|
|
76
|
+
internationalization: {
|
|
77
|
+
locales: [
|
|
78
|
+
Locales.ENGLISH,
|
|
79
|
+
Locales.FRENCH,
|
|
80
|
+
Locales.SPANISH,
|
|
81
|
+
// 您的其他语言环境
|
|
82
|
+
],
|
|
83
|
+
defaultLocale: Locales.ENGLISH,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default config;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> 通过此配置文件,您可以设置本地化 URL、中间件重定向、cookie 名称、内容声明的位置和扩展名、禁用控制台中的 Intlayer 日志等。有关可用参数的完整列表,请参阅[配置文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/configuration.md)。
|
|
91
|
+
|
|
92
|
+
### 第三步:在您的 Astro 配置中集成 Intlayer
|
|
93
|
+
|
|
94
|
+
将 intlayer 插件添加到您的配置中。
|
|
95
|
+
|
|
96
|
+
```typescript fileName="astro.config.ts"
|
|
97
|
+
// @ts-check
|
|
98
|
+
|
|
99
|
+
import { intlayer } from "astro-intlayer";
|
|
100
|
+
import { defineConfig } from "astro/config";
|
|
101
|
+
|
|
102
|
+
// https://astro.build/config
|
|
103
|
+
export default defineConfig({
|
|
104
|
+
integrations: [intlayer()],
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> `intlayer()` Astro 集成插件用于将 Intlayer 与 Astro 集成。它确保内容声明文件的构建,并在开发模式下监控这些文件。在 Astro 应用中定义了 Intlayer 环境变量。此外,它还提供别名以优化性能。
|
|
109
|
+
|
|
110
|
+
### 第4步:声明您的内容
|
|
111
|
+
|
|
112
|
+
创建并管理您的内容声明以存储翻译:
|
|
113
|
+
|
|
114
|
+
```tsx fileName="src/app.content.tsx"
|
|
115
|
+
import { t, type Dictionary } from "intlayer";
|
|
116
|
+
import type { ReactNode } from "react";
|
|
117
|
+
|
|
118
|
+
const appContent = {
|
|
119
|
+
key: "app",
|
|
120
|
+
content: {
|
|
121
|
+
title: t({
|
|
122
|
+
en: "Hello World",
|
|
123
|
+
fr: "Bonjour le monde",
|
|
124
|
+
es: "Hola mundo",
|
|
125
|
+
}),
|
|
126
|
+
},
|
|
127
|
+
} satisfies Dictionary;
|
|
128
|
+
|
|
129
|
+
export default appContent;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> 您的内容声明可以定义在应用程序中的任何位置,只要它们被包含在 `contentDir` 目录中(默认是 `./src`)。并且文件扩展名需匹配内容声明文件扩展名(默认是 `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`)。
|
|
133
|
+
|
|
134
|
+
> 更多详情,请参阅[内容声明文档](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/dictionary/get_started.md)。
|
|
135
|
+
|
|
136
|
+
### 第5步:在 Astro 中使用您的内容
|
|
137
|
+
|
|
138
|
+
您可以直接在 `.astro` 文件中使用 `intlayer` 导出的核心辅助函数来消费字典。
|
|
139
|
+
|
|
140
|
+
```astro fileName="src/pages/index.astro"
|
|
141
|
+
<!-- astro -->
|
|
142
|
+
---
|
|
143
|
+
import { getIntlayer } from "intlayer";
|
|
144
|
+
import appContent from "../app.content";
|
|
145
|
+
|
|
146
|
+
const { title } = getIntlayer('app');
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
<html lang="en">
|
|
150
|
+
<head>
|
|
151
|
+
<meta charset="utf-8" />
|
|
152
|
+
<meta name="viewport" content="width=device-width" />
|
|
153
|
+
<title>{title}</title>
|
|
154
|
+
</head>
|
|
155
|
+
<body>
|
|
156
|
+
<h1>{title}</h1>
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 第6步:本地化路由
|
|
162
|
+
|
|
163
|
+
创建一个动态路由段来服务本地化页面,例如 `src/pages/[locale]/index.astro`:
|
|
164
|
+
|
|
165
|
+
```astro fileName="src/pages/[locale]/index.astro"
|
|
166
|
+
<!-- astro -->
|
|
167
|
+
---
|
|
168
|
+
import { getIntlayer } from "intlayer";
|
|
169
|
+
|
|
170
|
+
const { title } = getIntlayer('app');
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
<h1>{title}</h1>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Astro 集成在开发期间添加了一个 Vite 中间件,帮助处理基于语言环境的路由和环境定义。你仍然可以使用自己的逻辑或 `intlayer` 提供的工具函数如 `getLocalizedUrl` 来实现语言环境间的链接。
|
|
177
|
+
|
|
178
|
+
### 第7步:继续使用你喜欢的框架
|
|
179
|
+
|
|
180
|
+
继续使用您喜欢的框架来构建您的应用程序。
|
|
181
|
+
|
|
182
|
+
- Intlayer + React: [Intlayer 与 React](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_vite+react.md)
|
|
183
|
+
- Intlayer + Vue: [Intlayer 与 Vue](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_vite+vue.md)
|
|
184
|
+
- Intlayer + Svelte: [Intlayer 与 Svelte](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_vite+svelte.md)
|
|
185
|
+
- Intlayer + Solid: [Intlayer 与 Solid](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_vite+solid.md)
|
|
186
|
+
- Intlayer + Preact: [Intlayer 与 Preact](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_with_vite+preact.md)
|
|
187
|
+
|
|
188
|
+
### 配置 TypeScript
|
|
189
|
+
|
|
190
|
+
Intlayer 使用模块增强来利用 TypeScript 的优势,使您的代码库更强大。
|
|
191
|
+
|
|
192
|
+

|
|
193
|
+
|
|
194
|
+

|
|
195
|
+
|
|
196
|
+
确保您的 TypeScript 配置包含自动生成的类型。
|
|
197
|
+
|
|
198
|
+
```json5 fileName="tsconfig.json"
|
|
199
|
+
{
|
|
200
|
+
// ... 您现有的 TypeScript 配置
|
|
201
|
+
"include": [
|
|
202
|
+
// ... 您现有的 TypeScript 配置
|
|
203
|
+
".intlayer/**/*.ts", // 包含自动生成的类型
|
|
204
|
+
],
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Git 配置
|
|
209
|
+
|
|
210
|
+
建议忽略 Intlayer 生成的文件。这样可以避免将它们提交到您的 Git 仓库中。
|
|
211
|
+
|
|
212
|
+
要做到这一点,您可以将以下指令添加到您的 `.gitignore` 文件中:
|
|
213
|
+
|
|
214
|
+
```plaintext
|
|
215
|
+
# 忽略 Intlayer 生成的文件
|
|
216
|
+
.intlayer
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### VS Code 扩展
|
|
220
|
+
|
|
221
|
+
为了提升您使用 Intlayer 的开发体验,您可以安装官方的 **Intlayer VS Code 扩展**。
|
|
222
|
+
|
|
223
|
+
[从 VS Code 市场安装](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
224
|
+
|
|
225
|
+
该扩展提供:
|
|
226
|
+
|
|
227
|
+
- 翻译键的 **自动补全**。
|
|
228
|
+
- 缺失翻译的 **实时错误检测**。
|
|
229
|
+
- 翻译内容的 **内联预览**。
|
|
230
|
+
- 轻松创建和更新翻译的 **快速操作**。
|
|
231
|
+
|
|
232
|
+
有关如何使用该扩展的更多详细信息,请参阅 [Intlayer VS Code 扩展文档](https://intlayer.org/doc/vs-code-extension)。
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### 深入探索
|
|
237
|
+
|
|
238
|
+
要进一步使用,您可以实现[可视化编辑器](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_visual_editor.md)或使用[内容管理系统(CMS)](https://github.com/aymericzip/intlayer/blob/main/docs/docs/zh/intlayer_CMS.md)将内容外部化。
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 文档历史
|
|
243
|
+
|
|
244
|
+
| 版本 | 日期 | 变更内容 |
|
|
245
|
+
| ----- | ---------- | ------------------------------------- |
|
|
246
|
+
| 6.2.0 | 2025-10-03 | 针对 Astro 集成、配置和使用进行了更新 |
|
|
@@ -1195,9 +1195,10 @@ module.exports = App;
|
|
|
1195
1195
|
|
|
1196
1196
|
Intlayer 使用模块增强来利用 TypeScript 的优势,使您的代码库更强大。
|
|
1197
1197
|
|
|
1198
|
-

|
|
1199
|
+
|
|
1200
|
+

|
|
1199
1201
|
|
|
1200
|
-

|
|
1201
1202
|
确保您的 TypeScript 配置包含自动生成的类型。
|
|
1202
1203
|
|
|
1203
1204
|
```json5 fileName="tsconfig.json"
|
|
@@ -367,9 +367,9 @@ module.exports = config;
|
|
|
367
367
|
|
|
368
368
|
`express-intlayer` 利用 TypeScript 强大的功能来增强国际化过程。TypeScript 的静态类型确保每个翻译键都被考虑到,减少遗漏翻译的风险并提升可维护性。
|
|
369
369
|
|
|
370
|
-

|
|
371
371
|
|
|
372
|
-

|
|
373
373
|
|
|
374
374
|
确保自动生成的类型(默认位于 ./types/intlayer.d.ts)已包含在你的 tsconfig.json 文件中。
|
|
375
375
|
|
|
@@ -219,9 +219,9 @@ export default config;
|
|
|
219
219
|
|
|
220
220
|
`express-intlayer` 利用 TypeScript 强大的功能来增强国际化过程。TypeScript 的静态类型确保每个翻译键都被考虑到,减少了缺失翻译的风险,并提升了可维护性。
|
|
221
221
|
|
|
222
|
-

|
|
223
223
|
|
|
224
|
-

|
|
225
225
|
|
|
226
226
|
确保自动生成的类型(默认位于 ./types/intlayer.d.ts)已包含在你的 tsconfig.json 文件中。
|
|
227
227
|
|
|
@@ -1427,9 +1427,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1427
1427
|
|
|
1428
1428
|
Intlayer 使用模块增强来利用 TypeScript 的优势,使您的代码库更健壮。
|
|
1429
1429
|
|
|
1430
|
-

|
|
1431
1431
|
|
|
1432
|
-

|
|
1433
1433
|
|
|
1434
1434
|
确保您的 TypeScript 配置包含自动生成的类型。
|
|
1435
1435
|
|