@intlayer/docs 7.3.10 → 7.3.12
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/dist/cjs/generated/docs.entry.cjs +19 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +19 -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_nuxt.md +305 -421
- package/docs/ar/intlayer_with_react_router_v7.md +33 -4
- package/docs/ar/intlayer_with_react_router_v7_fs_routes.md +516 -0
- package/docs/ar/intlayer_with_tanstack.md +2 -12
- package/docs/ar/intlayer_with_vite+vue.md +1 -0
- package/docs/de/intlayer_with_nuxt.md +296 -394
- package/docs/de/intlayer_with_react_router_v7.md +33 -4
- package/docs/de/intlayer_with_react_router_v7_fs_routes.md +573 -0
- package/docs/de/intlayer_with_tanstack.md +1 -0
- package/docs/de/intlayer_with_vite+vue.md +1 -0
- package/docs/en/intlayer_with_nuxt.md +242 -321
- package/docs/en/intlayer_with_react_router_v7.md +24 -0
- package/docs/en/intlayer_with_react_router_v7_fs_routes.md +570 -0
- package/docs/en/intlayer_with_tanstack.md +2 -12
- package/docs/en/intlayer_with_vite+vue.md +49 -48
- package/docs/en-GB/intlayer_with_nuxt.md +262 -358
- package/docs/en-GB/intlayer_with_react_router_v7.md +33 -4
- package/docs/en-GB/intlayer_with_react_router_v7_fs_routes.md +513 -0
- package/docs/en-GB/intlayer_with_tanstack.md +2 -12
- package/docs/en-GB/intlayer_with_vite+vue.md +1 -0
- package/docs/es/intlayer_with_nuxt.md +284 -375
- package/docs/es/intlayer_with_react_router_v7.md +33 -4
- package/docs/es/intlayer_with_react_router_v7_fs_routes.md +575 -0
- package/docs/es/intlayer_with_tanstack.md +1 -0
- package/docs/es/intlayer_with_vite+vue.md +1 -2
- package/docs/fr/intlayer_with_nuxt.md +288 -387
- package/docs/fr/intlayer_with_react_router_v7.md +34 -5
- package/docs/fr/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/fr/intlayer_with_tanstack.md +1 -0
- package/docs/fr/intlayer_with_vite+vue.md +1 -0
- package/docs/hi/intlayer_with_nuxt.md +318 -434
- package/docs/hi/intlayer_with_react_router_v7.md +33 -4
- package/docs/hi/intlayer_with_react_router_v7_fs_routes.md +518 -0
- package/docs/hi/intlayer_with_tanstack.md +2 -12
- package/docs/hi/intlayer_with_vite+vue.md +1 -0
- package/docs/id/intlayer_with_nuxt.md +275 -376
- package/docs/id/intlayer_with_react_router_v7.md +29 -4
- package/docs/id/intlayer_with_react_router_v7_fs_routes.md +521 -0
- package/docs/id/intlayer_with_tanstack.md +2 -12
- package/docs/id/intlayer_with_vite+vue.md +1 -0
- package/docs/it/intlayer_with_nuxt.md +312 -408
- package/docs/it/intlayer_with_react_router_v7.md +33 -4
- package/docs/it/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/it/intlayer_with_tanstack.md +1 -0
- package/docs/ja/intlayer_with_nuxt.md +319 -414
- package/docs/ja/intlayer_with_react_router_v7.md +33 -4
- package/docs/ja/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/ja/intlayer_with_tanstack.md +2 -12
- package/docs/ja/intlayer_with_vite+vue.md +1 -0
- package/docs/ko/intlayer_with_nuxt.md +307 -406
- package/docs/ko/intlayer_with_react_router_v7.md +33 -4
- package/docs/ko/intlayer_with_react_router_v7_fs_routes.md +515 -0
- package/docs/ko/intlayer_with_tanstack.md +2 -12
- package/docs/ko/intlayer_with_vite+vue.md +1 -0
- package/docs/pl/intlayer_with_nuxt.md +282 -457
- package/docs/pl/intlayer_with_react_router_v7.md +32 -5
- package/docs/pl/intlayer_with_react_router_v7_fs_routes.md +615 -0
- package/docs/pl/intlayer_with_tanstack.md +2 -12
- package/docs/pl/intlayer_with_vite+vue.md +1 -0
- package/docs/pt/intlayer_with_nuxt.md +288 -403
- package/docs/pt/intlayer_with_react_router_v7.md +28 -0
- package/docs/pt/intlayer_with_tanstack.md +1 -0
- package/docs/ru/intlayer_with_nuxt.md +300 -410
- package/docs/ru/intlayer_with_react_router_v7.md +33 -4
- package/docs/ru/intlayer_with_react_router_v7_fs_routes.md +574 -0
- package/docs/ru/intlayer_with_tanstack.md +1 -0
- package/docs/ru/intlayer_with_vite+vue.md +1 -0
- package/docs/tr/intlayer_with_nuxt.md +327 -392
- package/docs/tr/intlayer_with_react_router_v7.md +33 -4
- package/docs/tr/intlayer_with_react_router_v7_fs_routes.md +572 -0
- package/docs/tr/intlayer_with_tanstack.md +2 -12
- package/docs/tr/intlayer_with_vite+vue.md +1 -0
- package/docs/vi/intlayer_with_nuxt.md +282 -399
- package/docs/vi/intlayer_with_react_router_v7.md +29 -4
- package/docs/vi/intlayer_with_react_router_v7_fs_routes.md +523 -0
- package/docs/vi/intlayer_with_tanstack.md +2 -12
- package/docs/vi/intlayer_with_vite+vue.md +1 -0
- package/docs/zh/intlayer_with_nuxt.md +311 -444
- package/docs/zh/intlayer_with_react_router_v7.md +33 -4
- package/docs/zh/intlayer_with_react_router_v7_fs_routes.md +516 -0
- package/docs/zh/intlayer_with_tanstack.md +2 -12
- package/docs/zh/intlayer_with_vite+vue.md +1 -0
- package/package.json +6 -6
- package/src/generated/docs.entry.ts +19 -0
|
@@ -18,6 +18,7 @@ slugs:
|
|
|
18
18
|
- vite-and-react
|
|
19
19
|
- react-router-v7
|
|
20
20
|
applicationTemplate: https://github.com/aymericzip/intlayer-react-router-v7-template
|
|
21
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
21
22
|
history:
|
|
22
23
|
- version: 6.1.5
|
|
23
24
|
date: 2025-10-03
|
|
@@ -31,6 +32,10 @@ history:
|
|
|
31
32
|
|
|
32
33
|
Bu rehber, React Router v7 projelerinde yerel dil farkındalıklı yönlendirme, TypeScript desteği ve modern geliştirme uygulamaları ile sorunsuz uluslararasılaştırma için **Intlayer**'ın nasıl entegre edileceğini gösterir.
|
|
33
34
|
|
|
35
|
+
## Table of Contents
|
|
36
|
+
|
|
37
|
+
<TOC/>
|
|
38
|
+
|
|
34
39
|
## Intlayer Nedir?
|
|
35
40
|
|
|
36
41
|
**Intlayer**, modern web uygulamalarında çok dilli desteği basitleştirmek için tasarlanmış yenilikçi, açık kaynaklı bir uluslararasılaştırma (i18n) kütüphanesidir.
|
|
@@ -73,6 +78,29 @@ pnpm add vite-intlayer --save-dev
|
|
|
73
78
|
|
|
74
79
|
### Adım 2: Projenizin Yapılandırması
|
|
75
80
|
|
|
81
|
+
## Dosya sistemi tabanlı rotalar ile React Router v7 uygulamasında Intlayer kurulumu için adım adım rehber
|
|
82
|
+
|
|
83
|
+
<Tab defaultTab="video">
|
|
84
|
+
<TabItem label="Video" value="video">
|
|
85
|
+
|
|
86
|
+
<iframe title="How to translate your React Router v7 app using Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
87
|
+
|
|
88
|
+
</TabItem>
|
|
89
|
+
<TabItem label="Code" value="code">
|
|
90
|
+
|
|
91
|
+
<iframe
|
|
92
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-react-router-v7-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
93
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
94
|
+
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
95
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
96
|
+
loading="lazy"
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
</TabItem>
|
|
100
|
+
</Tab>
|
|
101
|
+
|
|
102
|
+
See [Application Template](https://github.com/aymericzip/intlayer-react-router-v7-template) on GitHub.
|
|
103
|
+
|
|
76
104
|
Uygulamanızın dillerini yapılandırmak için bir yapılandırma dosyası oluşturun:
|
|
77
105
|
|
|
78
106
|
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
@@ -257,7 +285,7 @@ export const LocalizedLink: FC<LinkProps> = (props) => {
|
|
|
257
285
|
Yerelleştirilmiş rotalara gitmek istediğiniz durumlarda, `useLocalizedNavigate` kancasını kullanabilirsiniz:
|
|
258
286
|
|
|
259
287
|
```tsx fileName="app/hooks/useLocalizedNavigate.ts"
|
|
260
|
-
import { useLocale } from "intlayer";
|
|
288
|
+
import { useLocale } from "react-intlayer";
|
|
261
289
|
import { type NavigateOptions, type To, useNavigate } from "react-router";
|
|
262
290
|
|
|
263
291
|
import { locacalizeTo } from "~/components/localized-link";
|
|
@@ -315,6 +343,7 @@ import {
|
|
|
315
343
|
getLocaleName,
|
|
316
344
|
getLocalizedUrl,
|
|
317
345
|
getPathWithoutLocale,
|
|
346
|
+
Locales,
|
|
318
347
|
} from "intlayer";
|
|
319
348
|
import { setLocaleInStorage, useIntlayer, useLocale } from "react-intlayer";
|
|
320
349
|
import { Link, useLocation } from "react-router";
|
|
@@ -408,13 +437,13 @@ Ayrıca uygulamanıza sunucu tarafı yönlendirme eklemek için `intlayerProxy`
|
|
|
408
437
|
> Üretimde `intlayerProxy` kullanmak için, `vite-intlayer` paketini `devDependencies`'den `dependencies`'e geçirmeniz gerektiğini unutmayın.
|
|
409
438
|
|
|
410
439
|
```typescript {3,7} fileName="vite.config.ts"
|
|
440
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
411
441
|
import { defineConfig } from "vite";
|
|
412
|
-
import react from "@vitejs/plugin-react-swc";
|
|
413
442
|
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
443
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
414
444
|
|
|
415
|
-
// https://vitejs.dev/config/
|
|
416
445
|
export default defineConfig({
|
|
417
|
-
plugins: [
|
|
446
|
+
plugins: [reactRouter(), tsconfigPaths(), intlayer(), intlayerProxy()],
|
|
418
447
|
});
|
|
419
448
|
```
|
|
420
449
|
|
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2025-12-07
|
|
3
|
+
updatedAt: 2025-12-07
|
|
4
|
+
title: React Router v7 (File-System Routes) uygulamanızı nasıl çevirirsiniz – i18n rehberi 2025
|
|
5
|
+
description: React Router v7 uygulamanıza Intlayer kullanarak dosya sistemi tabanlı yönlendirme ile uluslararasılaştırmayı (i18n) nasıl ekleyeceğinizi öğrenin. Uygulamanızı yerel dil farkındalıklı yönlendirme ile çok dilli hale getirmek için bu kapsamlı rehberi takip edin.
|
|
6
|
+
keywords:
|
|
7
|
+
- Uluslararasılaştırma
|
|
8
|
+
- Dokümantasyon
|
|
9
|
+
- Intlayer
|
|
10
|
+
- React Router v7
|
|
11
|
+
- fs-routes
|
|
12
|
+
- Dosya Sistemi Rotaları
|
|
13
|
+
- React
|
|
14
|
+
- i18n
|
|
15
|
+
- TypeScript
|
|
16
|
+
- Yerel Yönlendirme
|
|
17
|
+
slugs:
|
|
18
|
+
- doc
|
|
19
|
+
- environment
|
|
20
|
+
- vite-and-react
|
|
21
|
+
- react-router-v7-fs-routes
|
|
22
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-react-router-v7-template-fs-routes
|
|
23
|
+
youtubeVideo: https://www.youtube.com/watch?v=dS9L7uJeak4
|
|
24
|
+
history:
|
|
25
|
+
- version: 7.3.4
|
|
26
|
+
date: 2025-12-08
|
|
27
|
+
changes: Init history
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
# Intlayer ile React Router v7 (File-System Routes) çevirin | Uluslararasılaştırma (i18n)
|
|
31
|
+
|
|
32
|
+
Bu rehber, React Router v7 projelerinde **dosya sistemi tabanlı yönlendirme** (`@react-router/fs-routes`) kullanarak yerel dil farkındalıklı yönlendirme, TypeScript desteği ve modern geliştirme uygulamaları ile sorunsuz uluslararasılaştırma için **Intlayer**'ın nasıl entegre edileceğini gösterir.
|
|
33
|
+
|
|
34
|
+
## Table of Contents
|
|
35
|
+
|
|
36
|
+
<TOC/>
|
|
37
|
+
|
|
38
|
+
## Intlayer Nedir?
|
|
39
|
+
|
|
40
|
+
**Intlayer**, modern web uygulamalarında çok dilli desteği basitleştirmek için tasarlanmış yenilikçi, açık kaynaklı bir uluslararasılaştırma (i18n) kütüphanesidir.
|
|
41
|
+
|
|
42
|
+
Intlayer ile şunları yapabilirsiniz:
|
|
43
|
+
|
|
44
|
+
- **Bileşen seviyesinde bildirimsel sözlükler kullanarak çevirileri kolayca yönetmek.**
|
|
45
|
+
- **Meta verileri, yönlendirmeleri ve içeriği dinamik olarak yerelleştirmek.**
|
|
46
|
+
- **Otomatik oluşturulan tiplerle TypeScript desteğini sağlamak, otomatik tamamlama ve hata tespitini geliştirmek.**
|
|
47
|
+
- **Dinamik yerel dil algılama ve değiştirme gibi gelişmiş özelliklerden faydalanmak.**
|
|
48
|
+
- **React Router v7'nin dosya sistemi tabanlı yönlendirme sistemi ile yerel dil farkındalıklı yönlendirmeyi etkinleştirin.**
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Dosya sistemi tabanlı rotalar ile React Router v7 uygulamasında Intlayer kurulumu için adım adım rehber
|
|
53
|
+
|
|
54
|
+
<Tab defaultTab="video">
|
|
55
|
+
<TabItem label="Video" value="video">
|
|
56
|
+
|
|
57
|
+
<iframe title="How to translate your React Router v7 (File-System Routes) app using Intlayer" class="m-auto aspect-[16/9] w-full overflow-hidden rounded-lg border-0" allow="autoplay; gyroscope;" loading="lazy" width="1080" height="auto" src="https://www.youtube.com/embed/dS9L7uJeak4?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
58
|
+
|
|
59
|
+
</TabItem>
|
|
60
|
+
<TabItem label="Code" value="code">
|
|
61
|
+
|
|
62
|
+
<iframe
|
|
63
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-react-router-v7-template-fs-routes?embed=1&ctl=1&file=intlayer.config.ts"
|
|
64
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
65
|
+
title="Demo CodeSandbox - How to Internationalize your application using Intlayer"
|
|
66
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
67
|
+
loading="lazy"
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
</TabItem>
|
|
71
|
+
</Tab>
|
|
72
|
+
|
|
73
|
+
See [Application Template](https://github.com/aymericzip/intlayer-react-router-v7-template-fs-routes) on GitHub.
|
|
74
|
+
|
|
75
|
+
### Adım 1: Bağımlılıkları Yükleyin
|
|
76
|
+
|
|
77
|
+
Tercih ettiğiniz paket yöneticisini kullanarak gerekli paketleri yükleyin:
|
|
78
|
+
|
|
79
|
+
```bash packageManager="npm"
|
|
80
|
+
npm install intlayer react-intlayer
|
|
81
|
+
npm install vite-intlayer --save-dev
|
|
82
|
+
npm install @react-router/fs-routes --save-dev
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```bash packageManager="pnpm"
|
|
86
|
+
pnpm add intlayer react-intlayer
|
|
87
|
+
pnpm add vite-intlayer --save-dev
|
|
88
|
+
pnpm add @react-router/fs-routes --save-dev
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- **intlayer**
|
|
92
|
+
|
|
93
|
+
- Uluslararasılaştırma araçlarını yapılandırma yönetimi, çeviri, [içerik beyanı](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/get_started.md), transpile etme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_cli.md) için sağlayan temel paket.
|
|
94
|
+
|
|
95
|
+
- **react-intlayer**
|
|
96
|
+
Intlayer'ı React uygulamasıyla entegre eden paket. React uluslararasılaştırması için bağlam sağlayıcıları ve kancalar sunar.
|
|
97
|
+
|
|
98
|
+
- **vite-intlayer**
|
|
99
|
+
Intlayer'ı [Vite paketleyici](https://vite.dev/guide/why.html#why-bundle-for-production) ile entegre etmek için Vite eklentisini, ayrıca kullanıcının tercih ettiği yerel dili algılamak, çerezleri yönetmek ve URL yönlendirmesini işlemek için ara yazılımı içerir.
|
|
100
|
+
|
|
101
|
+
- **@react-router/fs-routes**
|
|
102
|
+
React Router v7 için dosya sistemi tabanlı yönlendirmeyi etkinleştiren paket.
|
|
103
|
+
|
|
104
|
+
### Adım 2: Projenizin Yapılandırması
|
|
105
|
+
|
|
106
|
+
Uygulamanızın dillerini yapılandırmak için bir yapılandırma dosyası oluşturun:
|
|
107
|
+
|
|
108
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
109
|
+
import { type IntlayerConfig, Locales } from "intlayer";
|
|
110
|
+
|
|
111
|
+
const config: IntlayerConfig = {
|
|
112
|
+
internationalization: {
|
|
113
|
+
defaultLocale: Locales.ENGLISH,
|
|
114
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default config;
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
122
|
+
import { Locales } from "intlayer";
|
|
123
|
+
|
|
124
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
125
|
+
const config = {
|
|
126
|
+
internationalization: {
|
|
127
|
+
defaultLocale: Locales.ENGLISH,
|
|
128
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export default config;
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
136
|
+
const { Locales } = require("intlayer");
|
|
137
|
+
|
|
138
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
139
|
+
const config = {
|
|
140
|
+
internationalization: {
|
|
141
|
+
defaultLocale: Locales.ENGLISH,
|
|
142
|
+
locales: [Locales.ENGLISH, Locales.FRENCH, Locales.SPANISH],
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
module.exports = config;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
> Bu yapılandırma dosyası aracılığıyla, yerelleştirilmiş URL'leri, ara yazılım yönlendirmesini, çerez isimlerini, içerik bildirimlerinizin konumunu ve uzantısını ayarlayabilir, Intlayer günlüklerini konsolda devre dışı bırakabilir ve daha fazlasını yapabilirsiniz. Mevcut parametrelerin tam listesi için [yapılandırma dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/configuration.md) bakınız.
|
|
150
|
+
|
|
151
|
+
### Adım 3: Intlayer'ı Vite Yapılandırmanıza Entegre Edin
|
|
152
|
+
|
|
153
|
+
Yapılandırmanıza intlayer eklentisini ekleyin:
|
|
154
|
+
|
|
155
|
+
```typescript fileName="vite.config.ts"
|
|
156
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
157
|
+
import { defineConfig } from "vite";
|
|
158
|
+
import { intlayer } from "vite-intlayer";
|
|
159
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
160
|
+
|
|
161
|
+
export default defineConfig({
|
|
162
|
+
plugins: [reactRouter(), tsconfigPaths(), intlayer()],
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
> `intlayer()` Vite eklentisi, Intlayer'ı Vite ile entegre etmek için kullanılır. İçerik bildirim dosyalarının oluşturulmasını sağlar ve geliştirme modunda bunları izler. Vite uygulaması içinde Intlayer ortam değişkenlerini tanımlar. Ayrıca, performansı optimize etmek için takma adlar sağlar.
|
|
167
|
+
|
|
168
|
+
### Adım 4: React Router v7 Dosya Sistemi Rotalarını Yapılandırma
|
|
169
|
+
|
|
170
|
+
Yönlendirme yapılandırmanızı `flatRoutes` ile dosya sistemi tabanlı rotalar kullanacak şekilde ayarlayın:
|
|
171
|
+
|
|
172
|
+
```typescript fileName="app/routes.ts"
|
|
173
|
+
import type { RouteConfig } from "@react-router/dev/routes";
|
|
174
|
+
import { flatRoutes } from "@react-router/fs-routes";
|
|
175
|
+
import { configuration } from "intlayer";
|
|
176
|
+
|
|
177
|
+
const routes: RouteConfig = flatRoutes({
|
|
178
|
+
// İçerik bildirimi dosyalarının rota olarak işlenmesini engelle
|
|
179
|
+
ignoredRouteFiles: configuration.content.fileExtensions.map(
|
|
180
|
+
(fileExtension) => `**/*${fileExtension}`
|
|
181
|
+
),
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
export default routes;
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
> `@react-router/fs-routes`'tan gelen `flatRoutes` işlevi, `routes/` dizinindeki dosya yapısının uygulamanızın rotalarını belirlediği dosya sistemi tabanlı yönlendirmeyi etkinleştirir. `ignoredRouteFiles` seçeneği, Intlayer içerik bildirimi dosyalarının (`.content.ts`, vb.) rota dosyaları olarak işlenmemesini sağlar.
|
|
188
|
+
|
|
189
|
+
### Adım 5: Dosya Sistemi Kuralları ile Rota Dosyaları Oluşturun
|
|
190
|
+
|
|
191
|
+
Dosya sistemi yönlendirmesi ile, noktalar (`.`) yol segmentlerini temsil eden ve parantezler `()` isteğe bağlı segmentleri belirten düz bir adlandırma kuralı kullanırsınız.
|
|
192
|
+
|
|
193
|
+
`app/routes/` dizininizde aşağıdaki dosyaları oluşturun:
|
|
194
|
+
|
|
195
|
+
#### Dosya Yapısı
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
app/routes/
|
|
199
|
+
├── ($locale)._layout.tsx # Yerel rota için layout sarmalayıcı
|
|
200
|
+
├── ($locale)._index.tsx # Ana sayfa (/:locale?)
|
|
201
|
+
├── ($locale)._index.content.ts # Ana sayfa içeriği
|
|
202
|
+
├── ($locale).about.tsx # Hakkında sayfası (/:locale?/about)
|
|
203
|
+
└── ($locale).about.content.ts # Hakkında sayfası içeriği
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Adlandırma kuralları:
|
|
207
|
+
|
|
208
|
+
- `($locale)` - Yerel parametre için isteğe bağlı dinamik segment
|
|
209
|
+
- `_layout` - Alt rotaları saran layout rotası
|
|
210
|
+
- `_index` - İndeks rotası (üst yolda render edilir)
|
|
211
|
+
- `.` (nokta) - Yol segmentlerini ayırır (örneğin, `($locale).about` → `/:locale?/about`)
|
|
212
|
+
|
|
213
|
+
#### Layout Bileşeni
|
|
214
|
+
|
|
215
|
+
```tsx fileName="app/routes/($locale)._layout.tsx"
|
|
216
|
+
import { IntlayerProvider } from "react-intlayer";
|
|
217
|
+
import { Outlet } from "react-router";
|
|
218
|
+
|
|
219
|
+
import { useI18nHTMLAttributes } from "~/hooks/useI18nHTMLAttributes";
|
|
220
|
+
|
|
221
|
+
import type { Route } from "./+types/($locale)._layout";
|
|
222
|
+
|
|
223
|
+
export default function RootLayout({ params }: Route.ComponentProps) {
|
|
224
|
+
useI18nHTMLAttributes();
|
|
225
|
+
|
|
226
|
+
const { locale } = params;
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<IntlayerProvider locale={locale}>
|
|
230
|
+
<Outlet />
|
|
231
|
+
</IntlayerProvider>
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### İndeks Sayfası
|
|
237
|
+
|
|
238
|
+
```tsx fileName="app/routes/($locale)._index.tsx"
|
|
239
|
+
import { useIntlayer } from "react-intlayer";
|
|
240
|
+
import { LocalizedLink } from "~/components/localized-link";
|
|
241
|
+
|
|
242
|
+
import type { Route } from "./+types/($locale)._index";
|
|
243
|
+
|
|
244
|
+
export default function Page() {
|
|
245
|
+
const { title, description, aboutLink } = useIntlayer("page");
|
|
246
|
+
|
|
247
|
+
return (
|
|
248
|
+
<div>
|
|
249
|
+
<h1>{title}</h1>
|
|
250
|
+
<p>{description}</p>
|
|
251
|
+
<nav>
|
|
252
|
+
<LocalizedLink to="/about">{aboutLink}</LocalizedLink>
|
|
253
|
+
</nav>
|
|
254
|
+
</div>
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
#### Hakkında Sayfası
|
|
260
|
+
|
|
261
|
+
```tsx fileName="app/routes/($locale).about.tsx"
|
|
262
|
+
import { useIntlayer } from "react-intlayer";
|
|
263
|
+
import { LocalizedLink } from "~/components/localized-link";
|
|
264
|
+
|
|
265
|
+
import type { Route } from "./+types/($locale).about";
|
|
266
|
+
|
|
267
|
+
export default function AboutPage() {
|
|
268
|
+
const { title, content, homeLink } = useIntlayer("about");
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<div>
|
|
272
|
+
<h1>{title}</h1>
|
|
273
|
+
<p>{content}</p>
|
|
274
|
+
<nav>
|
|
275
|
+
<LocalizedLink to="/">{homeLink}</LocalizedLink>
|
|
276
|
+
</nav>
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Adım 6: İçeriğinizi Bildirin
|
|
283
|
+
|
|
284
|
+
Çevirileri depolamak için içerik bildirimlerinizi oluşturun ve yönetin. İçerik dosyalarını rota dosyalarınızın yanına yerleştirin:
|
|
285
|
+
|
|
286
|
+
```tsx fileName="app/routes/($locale)._index.content.ts"
|
|
287
|
+
import { t, type Dictionary } from "intlayer";
|
|
288
|
+
|
|
289
|
+
const pageContent = {
|
|
290
|
+
key: "page",
|
|
291
|
+
content: {
|
|
292
|
+
title: t({
|
|
293
|
+
en: "Welcome to React Router v7 + Intlayer",
|
|
294
|
+
es: "Bienvenido a React Router v7 + Intlayer",
|
|
295
|
+
fr: "Bienvenue sur React Router v7 + Intlayer",
|
|
296
|
+
}),
|
|
297
|
+
description: t({
|
|
298
|
+
en: "Build multilingual applications with ease using React Router v7 and Intlayer.",
|
|
299
|
+
es: "Cree aplicaciones multilingües fácilmente usando React Router v7 y Intlayer.",
|
|
300
|
+
fr: "Créez des applications multilingues facilement avec React Router v7 et Intlayer.",
|
|
301
|
+
}),
|
|
302
|
+
aboutLink: t({
|
|
303
|
+
en: "Learn About Us",
|
|
304
|
+
es: "Aprender Sobre Nosotros",
|
|
305
|
+
fr: "En savoir plus sur nous",
|
|
306
|
+
}),
|
|
307
|
+
},
|
|
308
|
+
} satisfies Dictionary;
|
|
309
|
+
|
|
310
|
+
export default pageContent;
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
```tsx fileName="app/routes/($locale).about.content.ts"
|
|
314
|
+
import { t, type Dictionary } from "intlayer";
|
|
315
|
+
|
|
316
|
+
const aboutContent = {
|
|
317
|
+
key: "about",
|
|
318
|
+
content: {
|
|
319
|
+
title: t({
|
|
320
|
+
en: "About Us",
|
|
321
|
+
es: "Sobre Nosotros",
|
|
322
|
+
fr: "À propos de nous",
|
|
323
|
+
}),
|
|
324
|
+
content: t({
|
|
325
|
+
en: "This is the about page content.",
|
|
326
|
+
es: "Este es el contenido de la página de información.",
|
|
327
|
+
fr: "Ceci est le contenu de la page à propos.",
|
|
328
|
+
}),
|
|
329
|
+
homeLink: t({
|
|
330
|
+
en: "Home",
|
|
331
|
+
es: "Inicio",
|
|
332
|
+
fr: "Accueil",
|
|
333
|
+
}),
|
|
334
|
+
},
|
|
335
|
+
} satisfies Dictionary;
|
|
336
|
+
|
|
337
|
+
export default aboutContent;
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
> İçerik bildirimleriniz, uygulamanızda `contentDir` dizinine (varsayılan olarak `./app`) dahil edildiği sürece herhangi bir yerde tanımlanabilir. Ve içerik bildirim dosya uzantısıyla eşleşmelidir (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
341
|
+
|
|
342
|
+
> Daha fazla detay için [içerik bildirim dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/get_started.md) bakınız.
|
|
343
|
+
|
|
344
|
+
### Adım 7: Yerel Duyarlı Bileşenler Oluşturun
|
|
345
|
+
|
|
346
|
+
Yerel duyarlı gezinme için bir `LocalizedLink` bileşeni oluşturun:
|
|
347
|
+
|
|
348
|
+
```tsx fileName="app/components/localized-link.tsx"
|
|
349
|
+
import type { FC } from "react";
|
|
350
|
+
|
|
351
|
+
import { getLocalizedUrl, type LocalesValues } from "intlayer";
|
|
352
|
+
import { useLocale } from "react-intlayer";
|
|
353
|
+
import { Link, type LinkProps, type To } from "react-router";
|
|
354
|
+
|
|
355
|
+
const isExternalLink = (to: string) => /^(https?:)?\/\//.test(to);
|
|
356
|
+
|
|
357
|
+
// Belirtilen locale göre URL'yi yerelleştirir
|
|
358
|
+
export const locacalizeTo = (to: To, locale: LocalesValues): To => {
|
|
359
|
+
if (typeof to === "string") {
|
|
360
|
+
if (isExternalLink(to)) {
|
|
361
|
+
return to;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return getLocalizedUrl(to, locale);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (isExternalLink(to.pathname ?? "")) {
|
|
368
|
+
return to;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
return {
|
|
372
|
+
...to,
|
|
373
|
+
pathname: getLocalizedUrl(to.pathname ?? "", locale),
|
|
374
|
+
};
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
// Yerelleştirilmiş link bileşeni
|
|
378
|
+
export const LocalizedLink: FC<LinkProps> = (props) => {
|
|
379
|
+
const { locale } = useLocale();
|
|
380
|
+
|
|
381
|
+
return <Link {...props} to={locacalizeTo(props.to, locale)} />;
|
|
382
|
+
};
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
Yerelleştirilmiş rotalara gitmek istediğiniz durumlarda, `useLocalizedNavigate` kancasını kullanabilirsiniz:
|
|
386
|
+
|
|
387
|
+
```tsx fileName="app/hooks/useLocalizedNavigate.ts"
|
|
388
|
+
import { useLocale } from "react-intlayer";
|
|
389
|
+
import { type NavigateOptions, type To, useNavigate } from "react-router";
|
|
390
|
+
|
|
391
|
+
import { locacalizeTo } from "~/components/localized-link";
|
|
392
|
+
|
|
393
|
+
export const useLocalizedNavigate = () => {
|
|
394
|
+
const navigate = useNavigate();
|
|
395
|
+
const { locale } = useLocale();
|
|
396
|
+
|
|
397
|
+
const localizedNavigate = (to: To, options?: NavigateOptions) => {
|
|
398
|
+
const localedTo = locacalizeTo(to, locale);
|
|
399
|
+
|
|
400
|
+
navigate(localedTo, options);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
return localizedNavigate;
|
|
404
|
+
};
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Adım 8: Bir Dil Değiştirici Bileşeni Oluşturun
|
|
408
|
+
|
|
409
|
+
Kullanıcıların dilleri değiştirmesine izin veren bir bileşen oluşturun:
|
|
410
|
+
|
|
411
|
+
```tsx fileName="app/components/locale-switcher.tsx"
|
|
412
|
+
import type { FC } from "react";
|
|
413
|
+
|
|
414
|
+
import {
|
|
415
|
+
getHTMLTextDir,
|
|
416
|
+
getLocaleName,
|
|
417
|
+
getLocalizedUrl,
|
|
418
|
+
getPathWithoutLocale,
|
|
419
|
+
Locales,
|
|
420
|
+
} from "intlayer";
|
|
421
|
+
import { useIntlayer, useLocale } from "react-intlayer";
|
|
422
|
+
import { Link, useLocation } from "react-router";
|
|
423
|
+
|
|
424
|
+
export const LocaleSwitcher: FC = () => {
|
|
425
|
+
const { localeSwitcherLabel } = useIntlayer("locale-switcher");
|
|
426
|
+
const { pathname } = useLocation();
|
|
427
|
+
|
|
428
|
+
const { availableLocales, locale } = useLocale();
|
|
429
|
+
|
|
430
|
+
const pathWithoutLocale = getPathWithoutLocale(pathname);
|
|
431
|
+
|
|
432
|
+
return (
|
|
433
|
+
<ol>
|
|
434
|
+
{availableLocales.map((localeItem) => (
|
|
435
|
+
<li key={localeItem}>
|
|
436
|
+
<Link
|
|
437
|
+
aria-current={localeItem === locale ? "sayfa" : undefined}
|
|
438
|
+
aria-label={`${localeSwitcherLabel.value} ${getLocaleName(localeItem)}`}
|
|
439
|
+
reloadDocument // Yeni locale'i uygulamak için sayfayı yeniden yükle
|
|
440
|
+
to={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
441
|
+
>
|
|
442
|
+
<span>
|
|
443
|
+
{/* Yerel - örn. FR */}
|
|
444
|
+
{localeItem}
|
|
445
|
+
</span>
|
|
446
|
+
<span>
|
|
447
|
+
{/* Dil kendi yerelinde - örn. Français */}
|
|
448
|
+
{getLocaleName(localeItem, locale)}
|
|
449
|
+
</span>
|
|
450
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
451
|
+
{/* Mevcut yerelde dil - örn. Locales.SPANISH olarak ayarlanmış mevcut yerelle Francés */}
|
|
452
|
+
{getLocaleName(localeItem)}
|
|
453
|
+
</span>
|
|
454
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
455
|
+
{/* İngilizce dilinde - örn. French */}
|
|
456
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
457
|
+
</span>
|
|
458
|
+
</Link>
|
|
459
|
+
</li>
|
|
460
|
+
))}
|
|
461
|
+
</ol>
|
|
462
|
+
);
|
|
463
|
+
};
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
> `useLocale` hook'u hakkında daha fazla bilgi edinmek için [belgelere](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/react-intlayer/useLocale.md) bakınız.
|
|
467
|
+
|
|
468
|
+
### Adım 10: HTML Öznitelikleri Yönetimi Ekleme (İsteğe Bağlı)
|
|
469
|
+
|
|
470
|
+
HTML lang ve dir özniteliklerini yönetmek için bir hook oluşturun:
|
|
471
|
+
|
|
472
|
+
```tsx fileName="app/hooks/useI18nHTMLAttributes.tsx"
|
|
473
|
+
import { getHTMLTextDir } from "intlayer";
|
|
474
|
+
import { useEffect } from "react";
|
|
475
|
+
import { useLocale } from "react-intlayer";
|
|
476
|
+
|
|
477
|
+
export const useI18nHTMLAttributes = () => {
|
|
478
|
+
const { locale } = useLocale();
|
|
479
|
+
|
|
480
|
+
useEffect(() => {
|
|
481
|
+
document.documentElement.lang = locale;
|
|
482
|
+
document.documentElement.dir = getHTMLTextDir(locale);
|
|
483
|
+
}, [locale]);
|
|
484
|
+
};
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Bu hook, Adım 5'te gösterilen layout bileşeninde (`($locale)._layout.tsx`) zaten kullanılmaktadır.
|
|
488
|
+
|
|
489
|
+
### Adım 10: Middleware ekleyin (İsteğe bağlı)
|
|
490
|
+
|
|
491
|
+
Ayrıca uygulamanıza sunucu tarafı yönlendirme eklemek için `intlayerProxy` kullanabilirsiniz. Bu eklenti, URL'ye göre geçerli yerel ayarı otomatik olarak algılar ve uygun yerel ayar çerezini ayarlar. Hiçbir yerel ayar belirtilmemişse, eklenti kullanıcının tarayıcı dil tercihlerine göre en uygun yerel ayarı belirler. Hiçbir yerel ayar algılanmazsa, varsayılan yerel ayara yönlendirme yapar.
|
|
492
|
+
|
|
493
|
+
> Üretimde `intlayerProxy` kullanmak için, `vite-intlayer` paketini `devDependencies`'den `dependencies`'e geçirmeniz gerektiğini unutmayın.
|
|
494
|
+
|
|
495
|
+
```typescript {3,7} fileName="vite.config.ts"
|
|
496
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
497
|
+
import { defineConfig } from "vite";
|
|
498
|
+
import { intlayer, intlayerProxy } from "vite-intlayer";
|
|
499
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
500
|
+
|
|
501
|
+
export default defineConfig({
|
|
502
|
+
plugins: [reactRouter(), tsconfigPaths(), intlayer(), intlayerProxy()],
|
|
503
|
+
});
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## TypeScript'i Yapılandırma
|
|
509
|
+
|
|
510
|
+
Intlayer, TypeScript'in avantajlarından yararlanmak ve kod tabanınızı daha güçlü hale getirmek için modül genişletme (module augmentation) kullanır.
|
|
511
|
+
|
|
512
|
+
TypeScript yapılandırmanızın otomatik oluşturulan türleri içerdiğinden emin olun:
|
|
513
|
+
|
|
514
|
+
```json5 fileName="tsconfig.json"
|
|
515
|
+
{
|
|
516
|
+
// ... mevcut yapılandırmalarınız
|
|
517
|
+
include: [
|
|
518
|
+
// ... mevcut dahil ettikleriniz
|
|
519
|
+
".intlayer/**/*.ts", // Otomatik oluşturulan türleri dahil et
|
|
520
|
+
],
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## Git Yapılandırması
|
|
527
|
+
|
|
528
|
+
Intlayer tarafından oluşturulan dosyaların göz ardı edilmesi önerilir. Bu, bu dosyaların Git deposuna eklenmesini önlemenizi sağlar.
|
|
529
|
+
|
|
530
|
+
Bunu yapmak için `.gitignore` dosyanıza aşağıdaki talimatları ekleyebilirsiniz:
|
|
531
|
+
|
|
532
|
+
```plaintext fileName=".gitignore"
|
|
533
|
+
# Intlayer tarafından oluşturulan dosyaları göz ardı et
|
|
534
|
+
.intlayer
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## VS Code Eklentisi
|
|
540
|
+
|
|
541
|
+
Intlayer ile geliştirme deneyiminizi iyileştirmek için resmi **Intlayer VS Code Eklentisi**ni yükleyebilirsiniz.
|
|
542
|
+
|
|
543
|
+
[VS Code Marketplace'ten Yükleyin](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
544
|
+
|
|
545
|
+
Bu eklenti şunları sağlar:
|
|
546
|
+
|
|
547
|
+
- Çeviri anahtarları için **Otomatik Tamamlama**.
|
|
548
|
+
- Eksik çeviriler için **Gerçek Zamanlı Hata Tespiti**.
|
|
549
|
+
- Çevrilmiş içeriğin **Satır İçi Önizlemeleri**.
|
|
550
|
+
- Çevirileri kolayca oluşturup güncellemek için **Hızlı İşlemler**.
|
|
551
|
+
|
|
552
|
+
Eklentinin nasıl kullanılacağı hakkında daha fazla bilgi için [Intlayer VS Code Eklentisi dokümantasyonuna](https://intlayer.org/doc/vs-code-extension) bakabilirsiniz.
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
## Daha İleri Gitmek İçin
|
|
557
|
+
|
|
558
|
+
Daha ileri gitmek için, [görsel editörü](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_visual_editor.md) uygulayabilir veya içeriğinizi [CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_CMS.md) kullanarak dışa aktarabilirsiniz.
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
## Dokümantasyon Referansları
|
|
563
|
+
|
|
564
|
+
- [Intlayer Dokümantasyonu](https://intlayer.org)
|
|
565
|
+
- [React Router v7 Dokümantasyonu](https://reactrouter.com/)
|
|
566
|
+
- [React Router fs-routes Dokümantasyonu](https://reactrouter.com/how-to/file-route-conventions)
|
|
567
|
+
- [useIntlayer hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/react-intlayer/useIntlayer.md)
|
|
568
|
+
- [useLocale hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/react-intlayer/useLocale.md)
|
|
569
|
+
- [İçerik Beyanı](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/get_started.md)
|
|
570
|
+
- [Yapılandırma](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/configuration.md)
|
|
571
|
+
|
|
572
|
+
Bu kapsamlı rehber, dosya sistemi tabanlı yönlendirme kullanarak React Router v7 ile Intlayer'ı entegre etmeniz için ihtiyacınız olan her şeyi sağlar, böylece yerel dil farkındalıklı yönlendirme ve TypeScript desteği ile tamamen uluslararasılaştırılmış bir uygulama elde edersiniz.
|
|
@@ -17,6 +17,7 @@ slugs:
|
|
|
17
17
|
- environment
|
|
18
18
|
- tanstack-start
|
|
19
19
|
applicationTemplate: https://github.com/aymericzip/intlayer-tanstack-start-template
|
|
20
|
+
youtubeVideo: https://www.youtube.com/watch?v=_XTdKVWaeqg
|
|
20
21
|
history:
|
|
21
22
|
- version: 7.3.9
|
|
22
23
|
date: 2025-12-05
|
|
@@ -590,19 +591,8 @@ export const getLocaleServer = createServerFn().handler(async () => {
|
|
|
590
591
|
return getCookie(name, cookieString);
|
|
591
592
|
},
|
|
592
593
|
// Get the header from the request (default: 'x-intlayer-locale')
|
|
593
|
-
getHeader: (name) => getRequestHeader(name),
|
|
594
594
|
// Fallback using Accept-Language negotiation
|
|
595
|
-
|
|
596
|
-
const headers = getRequestHeaders();
|
|
597
|
-
const result: Record<string, string> = {};
|
|
598
|
-
|
|
599
|
-
// Convert the TypedHeaders into a plain Record<string, string>
|
|
600
|
-
for (const [key, value] of headers.entries()) {
|
|
601
|
-
result[key] = value;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
return result;
|
|
605
|
-
},
|
|
595
|
+
getHeader: (name) => getRequestHeader(name),
|
|
606
596
|
});
|
|
607
597
|
|
|
608
598
|
// Retrieve some content using getIntlayer()
|