@intlayer/docs 7.5.11 → 7.5.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/blog/ar/intlayer_with_i18next.md +0 -2
- package/blog/ar/intlayer_with_next-i18next.md +0 -2
- package/blog/ar/intlayer_with_react-i18next.md +0 -2
- package/blog/de/intlayer_with_i18next.md +0 -45
- package/blog/de/intlayer_with_next-i18next.md +0 -46
- package/blog/de/intlayer_with_react-i18next.md +0 -2
- package/blog/en/intlayer_with_i18next.md +0 -46
- package/blog/en/intlayer_with_next-i18next.md +0 -48
- package/blog/en/intlayer_with_next-intl.md +0 -44
- package/blog/en/intlayer_with_react-i18next.md +0 -44
- package/blog/en/intlayer_with_react-intl.md +0 -42
- package/blog/en/intlayer_with_vue-i18n.md +0 -44
- package/blog/en-GB/intlayer_with_i18next.md +0 -45
- package/blog/en-GB/intlayer_with_next-i18next.md +0 -47
- package/blog/en-GB/intlayer_with_next-intl.md +0 -42
- package/blog/en-GB/intlayer_with_react-i18next.md +0 -43
- package/blog/en-GB/intlayer_with_react-intl.md +0 -42
- package/blog/en-GB/intlayer_with_vue-i18n.md +0 -46
- package/blog/es/intlayer_with_i18next.md +0 -45
- package/blog/es/intlayer_with_next-i18next.md +0 -47
- package/blog/es/intlayer_with_next-intl.md +0 -42
- package/blog/es/intlayer_with_react-i18next.md +0 -43
- package/blog/es/intlayer_with_react-intl.md +0 -42
- package/blog/es/intlayer_with_vue-i18n.md +0 -46
- package/blog/fr/intlayer_with_i18next.md +0 -45
- package/blog/fr/intlayer_with_next-i18next.md +0 -47
- package/blog/fr/intlayer_with_next-intl.md +0 -42
- package/blog/fr/intlayer_with_react-i18next.md +0 -43
- package/blog/fr/intlayer_with_react-intl.md +0 -42
- package/blog/fr/intlayer_with_vue-i18n.md +0 -46
- package/blog/hi/intlayer_with_i18next.md +0 -2
- package/blog/hi/intlayer_with_next-i18next.md +0 -2
- package/blog/hi/intlayer_with_react-i18next.md +0 -2
- package/blog/id/intlayer_with_i18next.md +0 -2
- package/blog/id/intlayer_with_next-i18next.md +0 -2
- package/blog/id/intlayer_with_react-i18next.md +0 -2
- package/blog/it/intlayer_with_i18next.md +0 -2
- package/blog/it/intlayer_with_next-i18next.md +0 -2
- package/blog/it/intlayer_with_react-i18next.md +0 -2
- package/blog/ja/intlayer_with_i18next.md +0 -45
- package/blog/ja/intlayer_with_next-i18next.md +0 -46
- package/blog/ja/intlayer_with_next-intl.md +0 -42
- package/blog/ja/intlayer_with_react-i18next.md +0 -42
- package/blog/ja/intlayer_with_react-intl.md +0 -42
- package/blog/ja/intlayer_with_vue-i18n.md +0 -46
- package/blog/ko/intlayer_with_i18next.md +0 -2
- package/blog/ko/intlayer_with_next-i18next.md +0 -2
- package/blog/ko/intlayer_with_react-i18next.md +0 -1
- package/blog/pl/intlayer_with_i18next.md +0 -45
- package/blog/pl/intlayer_with_next-i18next.md +0 -46
- package/blog/pl/intlayer_with_next-intl.md +0 -42
- package/blog/pl/intlayer_with_react-i18next.md +0 -43
- package/blog/pl/intlayer_with_react-intl.md +0 -42
- package/blog/pl/intlayer_with_vue-i18n.md +0 -46
- package/blog/pt/intlayer_with_i18next.md +0 -2
- package/blog/pt/intlayer_with_next-i18next.md +0 -2
- package/blog/pt/intlayer_with_react-i18next.md +0 -2
- package/blog/ru/intlayer_with_i18next.md +0 -45
- package/blog/ru/intlayer_with_next-i18next.md +0 -47
- package/blog/ru/intlayer_with_next-intl.md +0 -42
- package/blog/ru/intlayer_with_react-i18next.md +0 -43
- package/blog/ru/intlayer_with_react-intl.md +0 -42
- package/blog/ru/intlayer_with_vue-i18n.md +0 -46
- package/blog/tr/intlayer_with_i18next.md +0 -2
- package/blog/tr/intlayer_with_next-i18next.md +0 -1
- package/blog/tr/intlayer_with_react-i18next.md +0 -2
- package/blog/vi/intlayer_with_i18next.md +0 -2
- package/blog/vi/intlayer_with_next-i18next.md +0 -2
- package/blog/vi/intlayer_with_react-i18next.md +0 -2
- package/blog/zh/intlayer_with_i18next.md +0 -2
- package/blog/zh/intlayer_with_next-i18next.md +0 -2
- package/blog/zh/intlayer_with_react-i18next.md +0 -2
- package/blog/zh/intlayer_with_vue-i18n.md +0 -46
- package/dist/cjs/generated/blog.entry.cjs +58 -29
- package/dist/cjs/generated/blog.entry.cjs.map +1 -1
- package/dist/cjs/generated/docs.entry.cjs +218 -99
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/cjs/generated/frequentQuestions.entry.cjs +30 -15
- package/dist/cjs/generated/frequentQuestions.entry.cjs.map +1 -1
- package/dist/cjs/generated/legal.entry.cjs +4 -2
- package/dist/cjs/generated/legal.entry.cjs.map +1 -1
- package/dist/esm/generated/blog.entry.mjs +58 -29
- package/dist/esm/generated/blog.entry.mjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +218 -99
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/esm/generated/frequentQuestions.entry.mjs +30 -15
- package/dist/esm/generated/frequentQuestions.entry.mjs.map +1 -1
- package/dist/esm/generated/legal.entry.mjs +4 -2
- package/dist/esm/generated/legal.entry.mjs.map +1 -1
- package/dist/types/generated/blog.entry.d.ts.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/dist/types/generated/frequentQuestions.entry.d.ts.map +1 -1
- package/dist/types/generated/legal.entry.d.ts.map +1 -1
- package/docs/ar/intlayer_with_next-i18next.md +0 -1
- package/docs/ar/intlayer_with_nextjs_14.md +28 -0
- package/docs/ar/intlayer_with_nextjs_15.md +28 -0
- package/docs/ar/intlayer_with_nextjs_16.md +28 -0
- package/docs/ar/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/ar/plugins/sync-json.md +6 -2
- package/docs/de/intlayer_with_next-i18next.md +0 -1
- package/docs/de/intlayer_with_nextjs_14.md +28 -0
- package/docs/de/intlayer_with_nextjs_15.md +28 -0
- package/docs/de/intlayer_with_nextjs_16.md +28 -0
- package/docs/de/intlayer_with_nextjs_no_locale_path.md +1152 -0
- package/docs/de/plugins/sync-json.md +6 -2
- package/docs/en/intlayer_with_next-i18next.md +0 -1
- package/docs/en/intlayer_with_nextjs_14.md +28 -0
- package/docs/en/intlayer_with_nextjs_15.md +28 -0
- package/docs/en/intlayer_with_nextjs_16.md +31 -1
- package/docs/en/intlayer_with_nextjs_no_locale_path.md +1132 -0
- package/docs/en/plugins/sync-json.md +6 -2
- package/docs/en-GB/intlayer_with_next-i18next.md +0 -1
- package/docs/en-GB/intlayer_with_nextjs_14.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_15.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_16.md +28 -0
- package/docs/en-GB/intlayer_with_nextjs_no_locale_path.md +1154 -0
- package/docs/en-GB/plugins/sync-json.md +6 -2
- package/docs/es/intlayer_with_next-i18next.md +0 -1
- package/docs/es/intlayer_with_nextjs_14.md +28 -0
- package/docs/es/intlayer_with_nextjs_15.md +28 -0
- package/docs/es/intlayer_with_nextjs_16.md +28 -0
- package/docs/es/intlayer_with_nextjs_no_locale_path.md +1143 -0
- package/docs/es/plugins/sync-json.md +6 -2
- package/docs/fr/intlayer_with_next-i18next.md +0 -1
- package/docs/fr/intlayer_with_nextjs_14.md +28 -0
- package/docs/fr/intlayer_with_nextjs_15.md +28 -0
- package/docs/fr/intlayer_with_nextjs_16.md +28 -0
- package/docs/fr/intlayer_with_nextjs_no_locale_path.md +1174 -0
- package/docs/fr/plugins/sync-json.md +9 -5
- package/docs/hi/intlayer_with_next-i18next.md +0 -1
- package/docs/hi/intlayer_with_nextjs_14.md +28 -0
- package/docs/hi/intlayer_with_nextjs_15.md +28 -0
- package/docs/hi/intlayer_with_nextjs_16.md +28 -0
- package/docs/hi/intlayer_with_nextjs_no_locale_path.md +1151 -0
- package/docs/hi/plugins/sync-json.md +6 -2
- package/docs/id/intlayer_with_next-i18next.md +0 -1
- package/docs/id/intlayer_with_nextjs_14.md +28 -0
- package/docs/id/intlayer_with_nextjs_15.md +28 -0
- package/docs/id/intlayer_with_nextjs_16.md +28 -0
- package/docs/id/intlayer_with_nextjs_no_locale_path.md +1154 -0
- package/docs/id/plugins/sync-json.md +6 -2
- package/docs/it/intlayer_with_next-i18next.md +0 -1
- package/docs/it/intlayer_with_nextjs_14.md +28 -0
- package/docs/it/intlayer_with_nextjs_15.md +28 -0
- package/docs/it/intlayer_with_nextjs_16.md +28 -0
- package/docs/it/intlayer_with_nextjs_no_locale_path.md +1148 -0
- package/docs/it/plugins/sync-json.md +6 -2
- package/docs/ja/intlayer_with_next-i18next.md +0 -1
- package/docs/ja/intlayer_with_nextjs_14.md +28 -0
- package/docs/ja/intlayer_with_nextjs_15.md +28 -0
- package/docs/ja/intlayer_with_nextjs_16.md +28 -0
- package/docs/ja/intlayer_with_nextjs_no_locale_path.md +1222 -0
- package/docs/ja/plugins/sync-json.md +6 -2
- package/docs/ko/intlayer_with_next-i18next.md +0 -1
- package/docs/ko/intlayer_with_nextjs_14.md +28 -0
- package/docs/ko/intlayer_with_nextjs_15.md +28 -0
- package/docs/ko/intlayer_with_nextjs_16.md +28 -0
- package/docs/ko/intlayer_with_nextjs_no_locale_path.md +1205 -0
- package/docs/ko/plugins/sync-json.md +6 -2
- package/docs/pl/intlayer_with_next-i18next.md +0 -1
- package/docs/pl/intlayer_with_nextjs_14.md +28 -0
- package/docs/pl/intlayer_with_nextjs_15.md +28 -0
- package/docs/pl/intlayer_with_nextjs_16.md +28 -0
- package/docs/pl/intlayer_with_nextjs_no_locale_path.md +1149 -0
- package/docs/pl/plugins/sync-json.md +6 -2
- package/docs/pt/intlayer_with_next-i18next.md +0 -1
- package/docs/pt/intlayer_with_nextjs_14.md +28 -0
- package/docs/pt/intlayer_with_nextjs_15.md +28 -0
- package/docs/pt/intlayer_with_nextjs_16.md +28 -0
- package/docs/pt/intlayer_with_nextjs_no_locale_path.md +1152 -0
- package/docs/pt/plugins/sync-json.md +6 -2
- package/docs/ru/intlayer_with_next-i18next.md +0 -1
- package/docs/ru/intlayer_with_nextjs_14.md +28 -0
- package/docs/ru/intlayer_with_nextjs_15.md +28 -0
- package/docs/ru/intlayer_with_nextjs_16.md +28 -0
- package/docs/ru/intlayer_with_nextjs_no_locale_path.md +1204 -0
- package/docs/ru/plugins/sync-json.md +6 -2
- package/docs/tr/intlayer_with_next-i18next.md +0 -1
- package/docs/tr/intlayer_with_nextjs_14.md +28 -0
- package/docs/tr/intlayer_with_nextjs_15.md +28 -0
- package/docs/tr/intlayer_with_nextjs_16.md +28 -0
- package/docs/tr/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/tr/plugins/sync-json.md +6 -2
- package/docs/uk/compiler.md +133 -0
- package/docs/uk/component_i18n.md +194 -0
- package/docs/uk/intlayer_with_nextjs_14.md +1646 -0
- package/docs/uk/intlayer_with_nextjs_15.md +1910 -0
- package/docs/uk/intlayer_with_nextjs_16.md +1763 -0
- package/docs/uk/intlayer_with_nextjs_no_locale_path.md +1159 -0
- package/docs/uk/intlayer_with_react_native+expo.md +715 -0
- package/docs/uk/packages/intlayer/getConfiguration.md +145 -0
- package/docs/uk/vs_code_extension.md +133 -0
- package/docs/vi/intlayer_with_next-i18next.md +0 -1
- package/docs/vi/intlayer_with_nextjs_14.md +28 -0
- package/docs/vi/intlayer_with_nextjs_15.md +28 -0
- package/docs/vi/intlayer_with_nextjs_16.md +28 -0
- package/docs/vi/intlayer_with_nextjs_no_locale_path.md +1151 -0
- package/docs/vi/plugins/sync-json.md +6 -2
- package/docs/zh/intlayer_with_next-i18next.md +0 -1
- package/docs/zh/intlayer_with_nextjs_14.md +28 -0
- package/docs/zh/intlayer_with_nextjs_15.md +28 -0
- package/docs/zh/intlayer_with_nextjs_16.md +28 -0
- package/docs/zh/intlayer_with_nextjs_no_locale_path.md +1206 -0
- package/docs/zh/plugins/sync-json.md +9 -5
- package/frequent_questions/ar/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/de/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/en/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/en-GB/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/es/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/fr/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/hi/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/id/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/it/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ja/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ko/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/pl/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/pt/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/ru/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/tr/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/vi/SSR_Next_no_[locale].md +1 -1
- package/frequent_questions/zh/SSR_Next_no_[locale].md +1 -1
- package/package.json +6 -6
- package/src/generated/blog.entry.ts +29 -0
- package/src/generated/docs.entry.ts +119 -0
- package/src/generated/frequentQuestions.entry.ts +15 -0
- package/src/generated/legal.entry.ts +2 -0
|
@@ -0,0 +1,1159 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2026-01-10
|
|
3
|
+
updatedAt: 2026-01-10
|
|
4
|
+
title: Next.js 16 uygulamanızı (sayfa yolunda [locale] olmadan) nasıl çevirirsiniz – i18n rehberi 2026
|
|
5
|
+
description: Next.js 16 web sitenizi, sayfa yolunda [locale] olmadan nasıl çokdilli hale getireceğinizi keşfedin. Uluslararasılaştırma (i18n) ve çeviri için dokümantasyonu izleyin.
|
|
6
|
+
keywords:
|
|
7
|
+
- Uluslararasılaştırma
|
|
8
|
+
- Dokümantasyon
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Next.js 16
|
|
11
|
+
- JavaScript
|
|
12
|
+
- React
|
|
13
|
+
slugs:
|
|
14
|
+
- doc
|
|
15
|
+
- environment
|
|
16
|
+
- nextjs
|
|
17
|
+
- no-locale-path
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-next-no-lolale-path-template
|
|
19
|
+
youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
|
|
20
|
+
history:
|
|
21
|
+
- version: 1.0.0
|
|
22
|
+
date: 2026-01-10
|
|
23
|
+
changes: İlk sürüm
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Next.js 16 web sitenizi (sayfa yolunda [locale] olmadan) Intlayer kullanarak çevirin | Uluslararasılaştırma (i18n)
|
|
27
|
+
|
|
28
|
+
<Tab defaultTab="video">
|
|
29
|
+
<TabItem label="Video" value="video">
|
|
30
|
+
|
|
31
|
+
<iframe title="Next.js için en iyi i18n çözümü mü? Intlayer'ı keşfedin" 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/e_PPG7PTqGU?autoplay=0&origin=http://intlayer.org&controls=0&rel=1"/>
|
|
32
|
+
|
|
33
|
+
</TabItem>
|
|
34
|
+
<TabItem label="Kod" value="code">
|
|
35
|
+
|
|
36
|
+
<iframe
|
|
37
|
+
src="https://stackblitz.com/github/aymericzip/intlayer-next-16-no-locale-path-template?embed=1&ctl=1&file=intlayer.config.ts"
|
|
38
|
+
className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
|
|
39
|
+
title="Demo CodeSandbox - Intlayer kullanarak uygulamanızı nasıl uluslararasılaştırırsınız"
|
|
40
|
+
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
|
|
41
|
+
loading="lazy"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
</TabItem>
|
|
45
|
+
</Tab>
|
|
46
|
+
|
|
47
|
+
GitHub'da [Uygulama Şablonu](https://github.com/aymericzip/intlayer-next-no-lolale-path-template) sayfasına bakın.
|
|
48
|
+
|
|
49
|
+
## İçindekiler
|
|
50
|
+
|
|
51
|
+
<TOC/>
|
|
52
|
+
|
|
53
|
+
## Intlayer Nedir?
|
|
54
|
+
|
|
55
|
+
**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. Intlayer, güçlü **App Router** dahil olmak üzere en güncel **Next.js 16** framework'ü ile sorunsuz entegre olur. Verimli render için **Server Components** ile çalışacak şekilde optimize edilmiştir ve [**Turbopack**](https://nextjs.org/docs/architecture/turbopack) ile tam uyumludur.
|
|
56
|
+
|
|
57
|
+
Intlayer ile şunları yapabilirsiniz:
|
|
58
|
+
|
|
59
|
+
- **Çevirileri kolayca yönetin**: bileşen seviyesinde deklaratif sözlükler kullanarak.
|
|
60
|
+
- **Meta verilerini, rotaları ve içeriği dinamik olarak yerelleştirin**.
|
|
61
|
+
- **İstemci ve sunucu tarafı bileşenlerinde çevirilere erişin**.
|
|
62
|
+
- **TypeScript desteğini sağlayın**; otomatik oluşturulan tiplerle otomatik tamamlama ve hata tespitini iyileştirin.
|
|
63
|
+
- **Gelişmiş özelliklerden yararlanın**, dinamik locale algılama ve geçiş gibi.
|
|
64
|
+
|
|
65
|
+
> Intlayer, Next.js 12, 13, 14 ve 16 ile uyumludur. Eğer Next.js Page Router kullanıyorsanız, bu [rehbere](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_with_nextjs_page_router.md) bakabilirsiniz. App Router ile Next.js 12, 13, 14 kullanıyorsanız, bu [rehbere](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_with_nextjs_14.md) bakın.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Next.js Uygulamasında Intlayer Kurulumuna Adım Adım Rehber
|
|
70
|
+
|
|
71
|
+
### Adım 1: Bağımlılıkları Yükleyin
|
|
72
|
+
|
|
73
|
+
Gerekli paketleri npm kullanarak yükleyin:
|
|
74
|
+
|
|
75
|
+
```bash packageManager="npm"
|
|
76
|
+
npm install intlayer next-intlayer
|
|
77
|
+
npx intlayer init
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```bash packageManager="pnpm"
|
|
81
|
+
pnpm add intlayer next-intlayer
|
|
82
|
+
pnpm intlayer init
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```bash packageManager="yarn"
|
|
86
|
+
yarn add intlayer next-intlayer
|
|
87
|
+
yarn intlayer init
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```bash packageManager="bun"
|
|
91
|
+
bun add intlayer next-intlayer
|
|
92
|
+
bunx intlayer init
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **intlayer**
|
|
96
|
+
|
|
97
|
+
Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/content_file.md), transpilation ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/cli/index.md) için uluslararasılaştırma araçlarını sağlayan çekirdek paket.
|
|
98
|
+
|
|
99
|
+
- **next-intlayer**
|
|
100
|
+
|
|
101
|
+
Intlayer'ı Next.js ile entegre eden paket. Next.js için uluslararasılaştırma amacıyla context provider'ları ve hook'lar sağlar. Ayrıca Intlayer'ı [Webpack](https://webpack.js.org/) veya [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack) ile entegre etmek için Next.js eklentisini ve kullanıcının tercih ettiği dili algılamak, çerezleri yönetmek ve URL yönlendirmesini gerçekleştirmek için bir proxy içerir.
|
|
102
|
+
|
|
103
|
+
### Adım 2: Projenizi Yapılandırın
|
|
104
|
+
|
|
105
|
+
İşte oluşturacağımız son yapı:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
.
|
|
109
|
+
├── src
|
|
110
|
+
│ ├── app
|
|
111
|
+
│ │ ├── layout.tsx
|
|
112
|
+
│ │ ├── page.content.ts
|
|
113
|
+
│ │ └── page.tsx
|
|
114
|
+
│ ├── components
|
|
115
|
+
│ │ ├── clientComponentExample
|
|
116
|
+
│ │ │ ├── client-component-example.content.ts
|
|
117
|
+
│ │ │ └── ClientComponentExample.tsx
|
|
118
|
+
│ │ ├── localeSwitcher
|
|
119
|
+
│ │ │ ├── localeSwitcher.content.ts
|
|
120
|
+
│ │ │ └── LocaleSwitcher.tsx
|
|
121
|
+
│ │ └── serverComponentExample
|
|
122
|
+
│ │ ├── server-component-example.content.ts
|
|
123
|
+
│ │ └── ServerComponentExample.tsx
|
|
124
|
+
│ └── proxy.ts
|
|
125
|
+
├── intlayer.config.ts
|
|
126
|
+
├── next.config.ts
|
|
127
|
+
├── package.json
|
|
128
|
+
└── tsconfig.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> Eğer locale yönlendirmesi istemiyorsanız, intlayer basit bir provider / hook olarak kullanılabilir. Daha fazla ayrıntı için [bu rehbere](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_with_nextjs_no_locale_path.md) bakın.
|
|
132
|
+
|
|
133
|
+
Uygulamanızın dillerini yapılandırmak için bir config dosyası oluşturun:
|
|
134
|
+
|
|
135
|
+
```typescript fileName="intlayer.config.ts" codeFormat="typescript"
|
|
136
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
137
|
+
|
|
138
|
+
const config: IntlayerConfig = {
|
|
139
|
+
internationalization: {
|
|
140
|
+
locales: [
|
|
141
|
+
Locales.ENGLISH,
|
|
142
|
+
Locales.FRENCH,
|
|
143
|
+
Locales.SPANISH,
|
|
144
|
+
// Diğer yereller (locales)
|
|
145
|
+
],
|
|
146
|
+
defaultLocale: Locales.ENGLISH,
|
|
147
|
+
},
|
|
148
|
+
routing: {
|
|
149
|
+
mode: "search-params", // veya `no-prefix` - middleware tespiti için kullanışlı
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default config;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```javascript fileName="intlayer.config.mjs" codeFormat="esm"
|
|
157
|
+
import { Locales } from "intlayer";
|
|
158
|
+
|
|
159
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
160
|
+
const config = {
|
|
161
|
+
internationalization: {
|
|
162
|
+
locales: [
|
|
163
|
+
Locales.ENGLISH,
|
|
164
|
+
Locales.FRENCH,
|
|
165
|
+
Locales.SPANISH,
|
|
166
|
+
// Diğer yereller (locales)
|
|
167
|
+
],
|
|
168
|
+
defaultLocale: Locales.ENGLISH,
|
|
169
|
+
},
|
|
170
|
+
routing: {
|
|
171
|
+
mode: "search-params", // veya `no-prefix` - middleware tespiti için kullanışlı
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
export default config;
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
|
|
179
|
+
const { Locales } = require("intlayer");
|
|
180
|
+
|
|
181
|
+
/** @type {import('intlayer').IntlayerConfig} */
|
|
182
|
+
const config = {
|
|
183
|
+
internationalization: {
|
|
184
|
+
locales: [
|
|
185
|
+
Locales.ENGLISH,
|
|
186
|
+
Locales.FRENCH,
|
|
187
|
+
Locales.SPANISH,
|
|
188
|
+
// Diğer yerelleriniz
|
|
189
|
+
],
|
|
190
|
+
defaultLocale: Locales.ENGLISH,
|
|
191
|
+
},
|
|
192
|
+
routing: {
|
|
193
|
+
mode: "search-params", // veya `no-prefix` - Middleware tespiti için kullanışlıdır
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
module.exports = config;
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
> Bu yapılandırma dosyası aracılığıyla, yerelleştirilmiş URL'leri, proxy yönlendirmesini, çerez adlarını, içerik bildirimlerinizin konumunu ve uzantısını, Intlayer günlüklerini konsolda devre dışı bırakmayı ve daha fazlasını ayarlayabilirsiniz. Kullanılabilir tüm parametrelerin eksiksiz listesi için [yapılandırma belgelerine](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/configuration.md) bakın.
|
|
201
|
+
|
|
202
|
+
### Adım 3: Intlayer'ı Next.js Yapılandırmanıza Entegre Edin
|
|
203
|
+
|
|
204
|
+
Next.js kurulumunuzu Intlayer kullanacak şekilde yapılandırın:
|
|
205
|
+
|
|
206
|
+
```typescript fileName="next.config.ts" codeFormat="typescript"
|
|
207
|
+
import type { NextConfig } from "next";
|
|
208
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
209
|
+
|
|
210
|
+
const nextConfig: NextConfig = {
|
|
211
|
+
/* yapılandırma seçenekleri burada */
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export default withIntlayer(nextConfig);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
```typescript fileName="next.config.mjs" codeFormat="esm"
|
|
218
|
+
import { withIntlayer } from "next-intlayer/server";
|
|
219
|
+
|
|
220
|
+
/** @type {import('next').NextConfig} */
|
|
221
|
+
const nextConfig = {
|
|
222
|
+
/* yapılandırma seçenekleri burada */
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
export default withIntlayer(nextConfig);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
```typescript fileName="next.config.cjs" codeFormat="commonjs"
|
|
229
|
+
const { withIntlayer } = require("next-intlayer/server");
|
|
230
|
+
|
|
231
|
+
/** @type {import('next').NextConfig} */
|
|
232
|
+
const nextConfig = {
|
|
233
|
+
/* yapılandırma seçenekleri burada */
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
module.exports = withIntlayer(nextConfig);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
> `withIntlayer()` Next.js eklentisi, Intlayer'ı Next.js ile entegre etmek için kullanılır. İçerik bildirim (content declaration) dosyalarının oluşturulmasını sağlar ve geliştirme modunda bunları izler. [Webpack](https://webpack.js.org/) veya [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack) ortamlarında Intlayer ortam değişkenlerini tanımlar. Ayrıca performansı optimize etmek için alias'lar sağlar ve sunucu bileşenleriyle uyumluluğu garanti eder.
|
|
240
|
+
|
|
241
|
+
> `withIntlayer()` fonksiyonu bir promise fonksiyonudur. Derleme başlamadan önce intlayer sözlüklerini hazırlamanıza olanak tanır. Diğer eklentilerle birlikte kullanmak istiyorsanız, onu await edebilirsiniz. Örnek:
|
|
242
|
+
>
|
|
243
|
+
> ```ts
|
|
244
|
+
> const nextConfig = await withIntlayer(nextConfig);
|
|
245
|
+
> const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
|
|
246
|
+
>
|
|
247
|
+
> export default nextConfigWithOtherPlugins;
|
|
248
|
+
> ```
|
|
249
|
+
|
|
250
|
+
> Eğer senkron olarak kullanmak isterseniz, `withIntlayerSync()` fonksiyonunu kullanabilirsiniz. Örnek:
|
|
251
|
+
>
|
|
252
|
+
> ```ts
|
|
253
|
+
> const nextConfig = withIntlayerSync(nextConfig);
|
|
254
|
+
> const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
|
|
255
|
+
>
|
|
256
|
+
> export default nextConfigWithOtherPlugins;
|
|
257
|
+
> ```
|
|
258
|
+
|
|
259
|
+
> Intlayer, proje komut satırı bayrakları `--webpack`, `--turbo` veya `--turbopack` ile ve mevcut **Next.js sürümünüz**e göre projenizin **webpack** mi yoksa **Turbopack** mi kullandığını otomatik olarak algılar.
|
|
260
|
+
>
|
|
261
|
+
> `next>=16` olduğunda, eğer **Rspack** kullanıyorsanız, Turbopack'i devre dışı bırakarak Intlayer'ın webpack yapılandırmasını kullanmasını açıkça zorlamalısınız:
|
|
262
|
+
>
|
|
263
|
+
> ```ts
|
|
264
|
+
> withRspack(withIntlayer(nextConfig, { enableTurbopack: false }));
|
|
265
|
+
> ```
|
|
266
|
+
|
|
267
|
+
### Adım 4: Dinamik Locale Rotalarını Tanımlayın
|
|
268
|
+
|
|
269
|
+
RootLayout içindeki her şeyi kaldırın ve aşağıdaki kodla değiştirin:
|
|
270
|
+
|
|
271
|
+
```tsx {3} fileName="src/app/layout.tsx" codeFormat="typescript"
|
|
272
|
+
import type { Metadata } from "next";
|
|
273
|
+
import type { ReactNode } from "react";
|
|
274
|
+
import "./globals.css";
|
|
275
|
+
import { IntlayerClientProvider, LocalPromiseParams } from "next-intlayer";
|
|
276
|
+
import { getHTMLTextDir, getIntlayer } from "intlayer";
|
|
277
|
+
import { getLocale } from "next-intlayer/server";
|
|
278
|
+
export { generateStaticParams } from "next-intlayer";
|
|
279
|
+
|
|
280
|
+
export const generateMetadata = async ({
|
|
281
|
+
params,
|
|
282
|
+
}: LocalPromiseParams): Promise<Metadata> => {
|
|
283
|
+
const { locale } = await params;
|
|
284
|
+
const { title, description, keywords } = getIntlayer("metadata", locale);
|
|
285
|
+
|
|
286
|
+
return {
|
|
287
|
+
title,
|
|
288
|
+
description,
|
|
289
|
+
keywords,
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const RootLayout = async ({
|
|
294
|
+
children,
|
|
295
|
+
}: Readonly<{
|
|
296
|
+
children: ReactNode;
|
|
297
|
+
}>) => {
|
|
298
|
+
const locale = await getLocale();
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
302
|
+
<IntlayerClientProvider defaultLocale={locale}>
|
|
303
|
+
<body>{children}</body>
|
|
304
|
+
</IntlayerClientProvider>
|
|
305
|
+
</html>
|
|
306
|
+
);
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export default RootLayout;
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
```jsx {3} fileName="src/app/layout.mjx" codeFormat="esm"
|
|
313
|
+
import "./globals.css";
|
|
314
|
+
import { IntlayerClientProvider } from "next-intlayer";
|
|
315
|
+
import { getHTMLTextDir, getIntlayer } from "intlayer";
|
|
316
|
+
import { getLocale } from "next-intlayer/server";
|
|
317
|
+
export { generateStaticParams } from "next-intlayer";
|
|
318
|
+
|
|
319
|
+
export const generateMetadata = async ({ params }) => {
|
|
320
|
+
const { locale } = await params;
|
|
321
|
+
const { title, description, keywords } = getIntlayer("metadata", locale);
|
|
322
|
+
|
|
323
|
+
return {
|
|
324
|
+
title,
|
|
325
|
+
description,
|
|
326
|
+
keywords,
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const RootLayout = async ({ children }) => {
|
|
331
|
+
const locale = await getLocale();
|
|
332
|
+
|
|
333
|
+
return (
|
|
334
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
335
|
+
<IntlayerClientProvider defaultLocale={locale}>
|
|
336
|
+
<body>{children}</body>
|
|
337
|
+
</IntlayerClientProvider>
|
|
338
|
+
</html>
|
|
339
|
+
);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export default RootLayout;
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```jsx {1,8} fileName="src/app/layout.csx" codeFormat="commonjs"
|
|
346
|
+
require("./globals.css");
|
|
347
|
+
const { IntlayerClientProvider } = require("next-intlayer");
|
|
348
|
+
const { getHTMLTextDir, getIntlayer } = require("intlayer");
|
|
349
|
+
const { getLocale } = require("next-intlayer/server");
|
|
350
|
+
const { generateStaticParams } = require("next-intlayer");
|
|
351
|
+
|
|
352
|
+
const generateMetadata = async ({ params }) => {
|
|
353
|
+
const { locale } = await params;
|
|
354
|
+
const { title, description, keywords } = getIntlayer("metadata", locale);
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
title,
|
|
358
|
+
description,
|
|
359
|
+
keywords,
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const RootLayout = async ({ children }) => {
|
|
364
|
+
const locale = await getLocale();
|
|
365
|
+
|
|
366
|
+
return (
|
|
367
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
368
|
+
<IntlayerClientProvider defaultLocale={locale}>
|
|
369
|
+
<body>{children}</body>
|
|
370
|
+
</IntlayerClientProvider>
|
|
371
|
+
</html>
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
module.exports = {
|
|
376
|
+
default: RootLayout,
|
|
377
|
+
generateStaticParams,
|
|
378
|
+
generateMetadata,
|
|
379
|
+
};
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### Adım 5: İçeriğinizi Deklare Edin
|
|
383
|
+
|
|
384
|
+
Çevirileri saklamak için içerik deklarasyonlarınızı oluşturun ve yönetin:
|
|
385
|
+
|
|
386
|
+
```tsx fileName="src/app/metadata.content.ts" contentDeclarationFormat="typescript"
|
|
387
|
+
import { t, type Dictionary } from "intlayer";
|
|
388
|
+
import { Metadata } from "next";
|
|
389
|
+
|
|
390
|
+
const metadataContent = {
|
|
391
|
+
key: "metadata",
|
|
392
|
+
content: {
|
|
393
|
+
title: t({
|
|
394
|
+
tr: "Projemin Başlığı",
|
|
395
|
+
en: "My Project Title",
|
|
396
|
+
fr: "Le Titre de mon Projet",
|
|
397
|
+
es: "El Título de mi Proyecto",
|
|
398
|
+
}),
|
|
399
|
+
|
|
400
|
+
description: t({
|
|
401
|
+
tr: "İş akışınızı sadeleştirmek ve verimliliği artırmak için tasarlanmış yenilikçi platformumuzu keşfedin.",
|
|
402
|
+
en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
403
|
+
fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
404
|
+
es: "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
|
|
405
|
+
}),
|
|
406
|
+
|
|
407
|
+
keywords: t({
|
|
408
|
+
tr: ["yenilik", "verimlilik", "iş akışı", "SaaS"],
|
|
409
|
+
en: ["innovation", "productivity", "workflow", "SaaS"],
|
|
410
|
+
tr: ["yenilik", "verimlilik", "iş akışı", "SaaS"],
|
|
411
|
+
fr: ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
412
|
+
es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
|
|
413
|
+
}),
|
|
414
|
+
},
|
|
415
|
+
} as Dictionary<Metadata>;
|
|
416
|
+
|
|
417
|
+
export default metadataContent;
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
```tsx fileName="src/app/metadata.content.mjs" contentDeclarationFormat="typescript"
|
|
421
|
+
import { t, type Dictionary } from "intlayer";
|
|
422
|
+
|
|
423
|
+
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
424
|
+
const metadataContent = {
|
|
425
|
+
key: "metadata",
|
|
426
|
+
content: {
|
|
427
|
+
title: t({
|
|
428
|
+
en: "My Project Title",
|
|
429
|
+
fr: "Le Titre de mon Projet",
|
|
430
|
+
es: "El Título de mi Proyecto",
|
|
431
|
+
}),
|
|
432
|
+
|
|
433
|
+
description: t({
|
|
434
|
+
en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
435
|
+
tr: "İş akışınızı kolaylaştırmak ve verimliliğinizi artırmak için tasarlanmış yenilikçi platformumuzu keşfedin.",
|
|
436
|
+
fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
437
|
+
es: "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
|
|
438
|
+
}),
|
|
439
|
+
|
|
440
|
+
keywords: t({
|
|
441
|
+
tr: ["inovasyon", "verimlilik", "iş akışı", "SaaS"],
|
|
442
|
+
en: ["innovation", "productivity", "workflow", "SaaS"],
|
|
443
|
+
fr: ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
444
|
+
es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
|
|
445
|
+
}),
|
|
446
|
+
},
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
export default metadataContent;
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
```javascript fileName="src/app/metadata.content.cjs" contentDeclarationFormat="commonjs"
|
|
453
|
+
const { t } = require("intlayer");
|
|
454
|
+
|
|
455
|
+
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
456
|
+
const metadataContent = {
|
|
457
|
+
key: "metadata",
|
|
458
|
+
content: {
|
|
459
|
+
title: t({
|
|
460
|
+
tr: "Projemin Başlığı",
|
|
461
|
+
en: "My Project Title",
|
|
462
|
+
fr: "Le Titre de mon Projet",
|
|
463
|
+
es: "El Título de mi Proyecto",
|
|
464
|
+
}),
|
|
465
|
+
|
|
466
|
+
description: t({
|
|
467
|
+
tr: "İş akışınızı kolaylaştırmak ve verimliliği artırmak için tasarlanmış yenilikçi platformumuzu keşfedin.",
|
|
468
|
+
en: "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
469
|
+
fr: "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
470
|
+
es: "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad.",
|
|
471
|
+
}),
|
|
472
|
+
|
|
473
|
+
keywords: t({
|
|
474
|
+
tr: ["inovasyon", "verimlilik", "iş akışı", "SaaS"],
|
|
475
|
+
en: ["innovation", "productivity", "workflow", "SaaS"],
|
|
476
|
+
fr: ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
477
|
+
es: ["innovación", "productividad", "flujo de trabajo", "SaaS"],
|
|
478
|
+
}),
|
|
479
|
+
},
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
module.exports = metadataContent;
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
```json fileName="src/app/metadata.content.json" contentDeclarationFormat="json"
|
|
486
|
+
{
|
|
487
|
+
"key": "metadata",
|
|
488
|
+
"content": {
|
|
489
|
+
"title": {
|
|
490
|
+
"nodeType": "translation",
|
|
491
|
+
"translation": {
|
|
492
|
+
"tr": "Projemin Başlığı",
|
|
493
|
+
"en": "My Project Title",
|
|
494
|
+
"fr": "Le Titre de mon Projet",
|
|
495
|
+
"es": "El Título de mi Proyecto"
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
"description": {
|
|
499
|
+
"nodeType": "translation",
|
|
500
|
+
"translation": {
|
|
501
|
+
"tr": "İş akışınızı kolaylaştırmak ve verimliliği artırmak için tasarlanmış yenilikçi platformumuzu keşfedin.",
|
|
502
|
+
"en": "Discover our innovative platform designed to streamline your workflow and boost productivity.",
|
|
503
|
+
"fr": "Découvrez notre plateforme innovante conçue pour simplifier votre flux de travail et booster votre productivité.",
|
|
504
|
+
"es": "Descubra nuestra plataforma innovadora diseñada para simplificar su flujo de trabajo y aumentar su productividad."
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
"keywords": {
|
|
508
|
+
"nodeType": "translation",
|
|
509
|
+
"translation": {
|
|
510
|
+
"tr": ["yenilik", "verimlilik", "iş akışı", "SaaS"],
|
|
511
|
+
"en": ["innovation", "productivity", "workflow", "SaaS"],
|
|
512
|
+
"fr": ["innovation", "productivité", "flux de travail", "SaaS"],
|
|
513
|
+
"es": ["innovación", "productividad", "flujo de trabajo", "SaaS"]
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
```tsx fileName="src/app/page.content.ts" contentDeclarationFormat="typescript"
|
|
521
|
+
import { t, type Dictionary } from "intlayer";
|
|
522
|
+
|
|
523
|
+
const pageContent = {
|
|
524
|
+
key: "page",
|
|
525
|
+
content: {
|
|
526
|
+
getStarted: {
|
|
527
|
+
main: t({
|
|
528
|
+
tr: "Düzenleyerek başlayın",
|
|
529
|
+
en: "Get started by editing",
|
|
530
|
+
fr: "Commencez par éditer",
|
|
531
|
+
es: "Comience por editar",
|
|
532
|
+
}),
|
|
533
|
+
pageLink: "src/app/page.tsx",
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
} satisfies Dictionary;
|
|
537
|
+
|
|
538
|
+
export default pageContent;
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
```javascript fileName="src/app/page.content.mjs" contentDeclarationFormat="esm"
|
|
542
|
+
import { t } from "intlayer";
|
|
543
|
+
|
|
544
|
+
/** @type {import('intlayer').Dictionary} */
|
|
545
|
+
// Tür: import('intlayer').Dictionary
|
|
546
|
+
const pageContent = {
|
|
547
|
+
key: "page",
|
|
548
|
+
content: {
|
|
549
|
+
getStarted: {
|
|
550
|
+
main: t({
|
|
551
|
+
tr: "Düzenleyerek başlayın",
|
|
552
|
+
en: "Get started by editing",
|
|
553
|
+
fr: "Commencez par éditer",
|
|
554
|
+
es: "Comience por editar",
|
|
555
|
+
}),
|
|
556
|
+
pageLink: "src/app/page.tsx",
|
|
557
|
+
},
|
|
558
|
+
},
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
export default pageContent;
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
```javascript fileName="src/app/page.content.cjs" contentDeclarationFormat="commonjs"
|
|
565
|
+
const { t } = require("intlayer");
|
|
566
|
+
|
|
567
|
+
/** @type {import('intlayer').Dictionary} */
|
|
568
|
+
// Tür: import('intlayer').Dictionary
|
|
569
|
+
const pageContent = {
|
|
570
|
+
key: "page",
|
|
571
|
+
content: {
|
|
572
|
+
getStarted: {
|
|
573
|
+
main: t({
|
|
574
|
+
tr: "Düzenleyerek başlayın",
|
|
575
|
+
en: "Get started by editing",
|
|
576
|
+
fr: "Commencez par éditer",
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
tr: "Düzenleyerek başlayın",
|
|
580
|
+
es: "Comience por editar",
|
|
581
|
+
}),
|
|
582
|
+
pageLink: "src/app/page.tsx",
|
|
583
|
+
},
|
|
584
|
+
|
|
585
|
+
},
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
module.exports = pageContent;
|
|
589
|
+
|
|
590
|
+
````
|
|
591
|
+
|
|
592
|
+
```json fileName="src/app/page.content.json" contentDeclarationFormat="json"
|
|
593
|
+
{
|
|
594
|
+
"$schema": "https://intlayer.org/schema.json",
|
|
595
|
+
"key": "page",
|
|
596
|
+
"content": {
|
|
597
|
+
"getStarted": {
|
|
598
|
+
"nodeType": "translation",
|
|
599
|
+
"translation": {
|
|
600
|
+
"tr": "Düzenleyerek başlayın",
|
|
601
|
+
"en": "Get started by editing",
|
|
602
|
+
"fr": "Commencez par éditer",
|
|
603
|
+
"es": "Comience por editar"
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
"pageLink": "src/app/page.tsx"
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
````
|
|
610
|
+
|
|
611
|
+
> İçerik deklarasyonlarınız, `contentDir` dizinine (varsayılan olarak `./src`) dahil edildikleri sürece uygulamanızda herhangi bir yerde tanımlanabilir. Ve içerik deklarasyon dosya uzantısıyla eşleşmelidir (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`).
|
|
612
|
+
|
|
613
|
+
> Daha fazla ayrıntı için [içerik deklarasyonu dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/content_file.md) bakın.
|
|
614
|
+
|
|
615
|
+
### Adım 6: İçeriği Kodunuzda Kullanın
|
|
616
|
+
|
|
617
|
+
Uygulamanız genelinde içerik sözlüklerinize erişin:
|
|
618
|
+
|
|
619
|
+
```tsx fileName="src/app/page.tsx" codeFormat="typescript"
|
|
620
|
+
import type { FC } from "react";
|
|
621
|
+
import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
|
|
622
|
+
import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
|
|
623
|
+
import {
|
|
624
|
+
IntlayerServerProvider,
|
|
625
|
+
useIntlayer,
|
|
626
|
+
getLocale,
|
|
627
|
+
} from "next-intlayer/server";
|
|
628
|
+
import { NextPage } from "next";
|
|
629
|
+
import { headers, cookies } from "next/headers";
|
|
630
|
+
|
|
631
|
+
const PageContent: FC = () => {
|
|
632
|
+
const content = useIntlayer("page");
|
|
633
|
+
|
|
634
|
+
return (
|
|
635
|
+
<>
|
|
636
|
+
<p>{content.getStarted.main}</p>
|
|
637
|
+
<code>{content.getStarted.pageLink}</code>
|
|
638
|
+
</>
|
|
639
|
+
);
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
const Page: NextPage = async () => {
|
|
643
|
+
const locale = await getLocale();
|
|
644
|
+
|
|
645
|
+
return (
|
|
646
|
+
<IntlayerServerProvider locale={locale}>
|
|
647
|
+
<PageContent />
|
|
648
|
+
<ServerComponentExample />
|
|
649
|
+
<ClientComponentExample />
|
|
650
|
+
</IntlayerServerProvider>
|
|
651
|
+
);
|
|
652
|
+
};
|
|
653
|
+
|
|
654
|
+
export default Page;
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
```jsx fileName="src/app/page.mjx" codeFormat="esm"
|
|
658
|
+
import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
|
|
659
|
+
import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
|
|
660
|
+
import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
|
|
661
|
+
import { getLocale } from "intlayer";
|
|
662
|
+
import { headers, cookies } from "next/headers";
|
|
663
|
+
import { NextPage } from "next";
|
|
664
|
+
|
|
665
|
+
const Page: NextPage = async () => {
|
|
666
|
+
const content = useIntlayer("page");
|
|
667
|
+
|
|
668
|
+
return (
|
|
669
|
+
<>
|
|
670
|
+
<p>{content.getStarted.main}</p>
|
|
671
|
+
<code>{content.getStarted.pageLink}</code>
|
|
672
|
+
</>
|
|
673
|
+
);
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
const Page = async () => {
|
|
677
|
+
|
|
678
|
+
const locale = await getLocale();
|
|
679
|
+
|
|
680
|
+
return (
|
|
681
|
+
<IntlayerServerProvider locale={locale}>
|
|
682
|
+
<PageContent />
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
<ServerComponentExample />
|
|
686
|
+
<ClientComponentExample />
|
|
687
|
+
</IntlayerServerProvider>
|
|
688
|
+
|
|
689
|
+
);
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
export default Page;
|
|
693
|
+
|
|
694
|
+
````
|
|
695
|
+
|
|
696
|
+
```jsx fileName="src/app/page.csx" codeFormat="commonjs"
|
|
697
|
+
import { ClientComponentExample } from "@components/clientComponentExample/ClientComponentExample";
|
|
698
|
+
import { ServerComponentExample } from "@components/serverComponentExample/ServerComponentExample";
|
|
699
|
+
import { IntlayerServerProvider, useIntlayer, getLocale } from "next-intlayer/server";
|
|
700
|
+
import { NextPage } from "next";
|
|
701
|
+
import { headers, cookies } from "next/headers";
|
|
702
|
+
|
|
703
|
+
const Page: NextPage = async () => {
|
|
704
|
+
const content = useIntlayer("page");
|
|
705
|
+
|
|
706
|
+
return (
|
|
707
|
+
<>
|
|
708
|
+
<p>{content.getStarted.main}</p>
|
|
709
|
+
<code>{content.getStarted.pageLink}</code>
|
|
710
|
+
</>
|
|
711
|
+
);
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
const Page: NextPage = async () => {
|
|
715
|
+
const locale = await getLocale();
|
|
716
|
+
|
|
717
|
+
return (
|
|
718
|
+
<IntlayerServerProvider locale={locale}>
|
|
719
|
+
<PageContent />
|
|
720
|
+
<ServerComponentExample />
|
|
721
|
+
<ClientComponentExample />
|
|
722
|
+
</IntlayerServerProvider>
|
|
723
|
+
);
|
|
724
|
+
};
|
|
725
|
+
````
|
|
726
|
+
|
|
727
|
+
- **`IntlayerClientProvider`** istemci tarafı bileşenlerine locale sağlamak için kullanılır. Layout dahil herhangi bir üst bileşene yerleştirilebilir. Ancak, Next.js'in layout kodunu sayfalar arasında paylaştığı ve bu nedenle daha verimli olduğu için bir layout içine yerleştirilmesi önerilir. `IntlayerClientProvider`'ı layout'ta kullanarak, her sayfa için yeniden oluşturulmasını önleyerek performansı artırır ve uygulamanız boyunca tutarlı bir yerelleştirme bağlamı sağlar.
|
|
728
|
+
- **`IntlayerServerProvider`** sunucu çocuklarına locale sağlamak için kullanılır. Layout içinde ayarlanamaz.
|
|
729
|
+
|
|
730
|
+
> Layout ve page ortak bir server context paylaşamaz çünkü server context sistemi her isteğe özel bir veri deposuna (React'in cache mekanizması aracılığıyla) dayanır, bu da uygulamanın farklı segmentleri için her "context"in yeniden oluşturulmasına neden olur. Sağlayıcıyı paylaşılan bir layout'a yerleştirmek bu izolasyonu bozacak ve server bileşenlerinize server context değerlerinin doğru şekilde iletilmesini engelleyecektir.
|
|
731
|
+
|
|
732
|
+
```tsx {4,7} fileName="src/components/clientComponentExample/ClientComponentExample.tsx" codeFormat="typescript"
|
|
733
|
+
"use client";
|
|
734
|
+
|
|
735
|
+
import type { FC } from "react";
|
|
736
|
+
import { useIntlayer } from "next-intlayer";
|
|
737
|
+
|
|
738
|
+
export const ClientComponentExample: FC = () => {
|
|
739
|
+
const content = useIntlayer("client-component-example"); // İlgili içerik tanımını oluştur
|
|
740
|
+
|
|
741
|
+
return (
|
|
742
|
+
<div>
|
|
743
|
+
<h2>{content.title}</h2>
|
|
744
|
+
<p>{content.content}</p>
|
|
745
|
+
</div>
|
|
746
|
+
);
|
|
747
|
+
};
|
|
748
|
+
```
|
|
749
|
+
|
|
750
|
+
```jsx {3,6} fileName="src/components/clientComponentExample/ClientComponentExample.mjx" codeFormat="esm"
|
|
751
|
+
"use client";
|
|
752
|
+
|
|
753
|
+
import { useIntlayer } from "next-intlayer";
|
|
754
|
+
|
|
755
|
+
const ClientComponentExample = () => {
|
|
756
|
+
const content = useIntlayer("client-component-example"); // İlgili içerik tanımını oluştur
|
|
757
|
+
|
|
758
|
+
return (
|
|
759
|
+
<div>
|
|
760
|
+
<h2>{content.title}</h2>
|
|
761
|
+
<p>{content.content}</p>
|
|
762
|
+
</div>
|
|
763
|
+
);
|
|
764
|
+
};
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
```jsx {3,6} fileName="src/components/clientComponentExample/ClientComponentExample.csx" codeFormat="commonjs"
|
|
768
|
+
"use client";
|
|
769
|
+
|
|
770
|
+
const { useIntlayer } = require("next-intlayer");
|
|
771
|
+
|
|
772
|
+
const ClientComponentExample = () => {
|
|
773
|
+
const content = useIntlayer("client-component-example"); // İlgili içerik bildirimi oluştur
|
|
774
|
+
|
|
775
|
+
return (
|
|
776
|
+
<div>
|
|
777
|
+
<h2>{content.title}</h2>
|
|
778
|
+
<p>{content.content}</p>
|
|
779
|
+
</div>
|
|
780
|
+
);
|
|
781
|
+
};
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
```tsx {2} fileName="src/components/serverComponentExample/ServerComponentExample.tsx" codeFormat="typescript"
|
|
785
|
+
import type { FC } from "react";
|
|
786
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
787
|
+
|
|
788
|
+
export const ServerComponentExample: FC = () => {
|
|
789
|
+
const content = useIntlayer("server-component-example"); // İlgili içerik bildirimi oluştur
|
|
790
|
+
|
|
791
|
+
return (
|
|
792
|
+
<div>
|
|
793
|
+
<h2>{content.title}</h2>
|
|
794
|
+
<p>{content.content}</p>
|
|
795
|
+
</div>
|
|
796
|
+
);
|
|
797
|
+
};
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
```jsx {1} fileName="src/components/serverComponentExample/ServerComponentExample.mjx" codeFormat="esm"
|
|
801
|
+
import { useIntlayer } from "next-intlayer/server";
|
|
802
|
+
|
|
803
|
+
const ServerComponentExample = () => {
|
|
804
|
+
const content = useIntlayer("server-component-example"); // İlgili içerik bildirimi oluştur
|
|
805
|
+
|
|
806
|
+
return (
|
|
807
|
+
<div>
|
|
808
|
+
<h2>{content.title}</h2>
|
|
809
|
+
<p>{content.content}</p>
|
|
810
|
+
</div>
|
|
811
|
+
);
|
|
812
|
+
};
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
```jsx {1} fileName="src/components/serverComponentExample/ServerComponentExample.csx" codeFormat="commonjs"
|
|
816
|
+
const { useIntlayer } = require("next-intlayer/server");
|
|
817
|
+
|
|
818
|
+
const ServerComponentExample = () => {
|
|
819
|
+
const content = useIntlayer("server-component-example"); // İlgili içerik bildirimi oluştur
|
|
820
|
+
|
|
821
|
+
return (
|
|
822
|
+
<div>
|
|
823
|
+
<h2>{content.title}</h2>
|
|
824
|
+
<p>{content.content}</p>
|
|
825
|
+
</div>
|
|
826
|
+
);
|
|
827
|
+
};
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
> İçeriğinizi bir `string` özniteliğinde kullanmak istiyorsanız; ör. `alt`, `title`, `href`, `aria-label` vb., fonksiyonun değerini çağırmalısınız, örneğin:
|
|
831
|
+
|
|
832
|
+
> ```jsx
|
|
833
|
+
> <img src={content.image.src.value} alt={content.image.value} />
|
|
834
|
+
> ```
|
|
835
|
+
|
|
836
|
+
> `useIntlayer` hook'u hakkında daha fazla bilgi edinmek için [belgelere](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/useIntlayer.md) bakın.
|
|
837
|
+
|
|
838
|
+
### (İsteğe Bağlı) Adım 7: Locale Algılama için Proxy'yu Yapılandırma
|
|
839
|
+
|
|
840
|
+
Kullanıcının tercih ettiği locale'i algılamak için proxy'yu yapılandırın:
|
|
841
|
+
|
|
842
|
+
```typescript fileName="src/proxy.ts" codeFormat="typescript"
|
|
843
|
+
export { intlayerProxy as proxy } from "next-intlayer/proxy";
|
|
844
|
+
|
|
845
|
+
export const config = {
|
|
846
|
+
matcher:
|
|
847
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
848
|
+
};
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
```javascript fileName="src/proxy.mjs" codeFormat="esm"
|
|
852
|
+
export { intlayerProxy as proxy } from "next-intlayer/proxy";
|
|
853
|
+
|
|
854
|
+
export const config = {
|
|
855
|
+
matcher:
|
|
856
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
857
|
+
};
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
```javascript fileName="src/proxy.cjs" codeFormat="commonjs"
|
|
861
|
+
const { intlayerProxy } = require("next-intlayer/proxy");
|
|
862
|
+
|
|
863
|
+
const config = {
|
|
864
|
+
matcher:
|
|
865
|
+
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
module.exports = { proxy: intlayerProxy, config };
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
> `intlayerProxy`, kullanıcının tercih ettiği yerel dili algılamak ve onları [yapılandırmada](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/configuration.md) belirtildiği gibi uygun URL'ye yönlendirmek için kullanılır. Ayrıca, kullanıcının tercih ettiği yerel dili bir çerezde kaydetmeyi sağlar.
|
|
872
|
+
|
|
873
|
+
> Birden fazla proxy'yi birbirine zincirlemeniz gerekiyorsa (örneğin, kimlik doğrulama veya özel proxy'lerle `intlayerProxy`), Intlayer artık `multipleProxies` adlı bir yardımcı sağlar.
|
|
874
|
+
|
|
875
|
+
```ts
|
|
876
|
+
import { multipleProxies, intlayerProxy } from "next-intlayer/proxy";
|
|
877
|
+
import { customProxy } from "@utils/customProxy";
|
|
878
|
+
|
|
879
|
+
export const proxy = multipleProxies([intlayerProxy, customProxy]);
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
### (İsteğe Bağlı) Adım 8: İçeriğinizin dilini değiştirin
|
|
883
|
+
|
|
884
|
+
Next.js'te içeriğinizin dilini değiştirmek için önerilen yol, kullanıcıları uygun yerelleştirilmiş sayfaya yönlendirmek amacıyla `Link` bileşenini kullanmaktır. `Link` bileşeni sayfanın önceden getirilmesini (prefetching) sağlar; bu da tam sayfa yeniden yüklemesini önlemeye yardımcı olur.
|
|
885
|
+
|
|
886
|
+
```tsx fileName="src/components/localeSwitcher/LocaleSwitcher.tsx" codeFormat="typescript"
|
|
887
|
+
"use client";
|
|
888
|
+
|
|
889
|
+
import type { FC } from "react";
|
|
890
|
+
import { Locales, getHTMLTextDir, getLocaleName } from "intlayer";
|
|
891
|
+
import { useLocale } from "next-intlayer";
|
|
892
|
+
|
|
893
|
+
export const LocaleSwitcher: FC = () => {
|
|
894
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
895
|
+
onChange: () => window.location.reload(),
|
|
896
|
+
});
|
|
897
|
+
|
|
898
|
+
return (
|
|
899
|
+
<div>
|
|
900
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
901
|
+
<div id="localePopover" popover="auto">
|
|
902
|
+
{availableLocales.map((localeItem) => (
|
|
903
|
+
<button
|
|
904
|
+
key={localeItem}
|
|
905
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
906
|
+
onClick={() => setLocale(localeItem)}
|
|
907
|
+
>
|
|
908
|
+
<span>
|
|
909
|
+
{/* Yerel (Locale) - örn. FR */}
|
|
910
|
+
{localeItem}
|
|
911
|
+
</span>
|
|
912
|
+
<span>
|
|
913
|
+
{/* Dil kendi yerelinde - örn. Français */}
|
|
914
|
+
{getLocaleName(localeItem, locale)}
|
|
915
|
+
</span>
|
|
916
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
917
|
+
{/* Dil mevcut locale'de - örn. mevcut locale Locales.SPANISH ise "Francés" */}
|
|
918
|
+
{getLocaleName(localeItem)}
|
|
919
|
+
</span>
|
|
920
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
921
|
+
{/* İngilizce dil adı - örn. French */}
|
|
922
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
923
|
+
</span>
|
|
924
|
+
</button>
|
|
925
|
+
))}
|
|
926
|
+
</div>
|
|
927
|
+
</div>
|
|
928
|
+
);
|
|
929
|
+
};
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
```jsx fileName="src/components/localeSwitcher/LocaleSwitcher.msx" codeFormat="esm"
|
|
933
|
+
"use client";
|
|
934
|
+
|
|
935
|
+
import { Locales, getHTMLTextDir, getLocaleName } from "intlayer";
|
|
936
|
+
import { useLocale } from "next-intlayer";
|
|
937
|
+
|
|
938
|
+
export const LocaleSwitcher = () => {
|
|
939
|
+
const { locale, availableLocales, setLocale } = useLocale({
|
|
940
|
+
onChange: () => window.location.reload(),
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
return (
|
|
944
|
+
<div>
|
|
945
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
946
|
+
<div id="localePopover" popover="auto">
|
|
947
|
+
{availableLocales.map((localeItem) => (
|
|
948
|
+
<button
|
|
949
|
+
key={localeItem}
|
|
950
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
951
|
+
onClick={() => setLocale(localeItem)}
|
|
952
|
+
>
|
|
953
|
+
<span>
|
|
954
|
+
{/* Yerel - ör. FR */}
|
|
955
|
+
{localeItem}
|
|
956
|
+
</span>
|
|
957
|
+
<span>
|
|
958
|
+
{/* Dil kendi yerelinde - ör. Français */}
|
|
959
|
+
{getLocaleName(localeItem, locale)}
|
|
960
|
+
</span>
|
|
961
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
962
|
+
{/* Dil mevcut locale'de - ör. mevcut locale Locales.SPANISH iken: Francés */}
|
|
963
|
+
{getLocaleName(localeItem)}
|
|
964
|
+
</span>
|
|
965
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
966
|
+
{/* Dil İngilizce olarak - ör. French */}
|
|
967
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
968
|
+
</span>
|
|
969
|
+
</button>
|
|
970
|
+
))}
|
|
971
|
+
</div>
|
|
972
|
+
</div>
|
|
973
|
+
);
|
|
974
|
+
};
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
```jsx fileName="src/components/localeSwitcher/LocaleSwitcher.csx" codeFormat="commonjs"
|
|
978
|
+
"use client";
|
|
979
|
+
|
|
980
|
+
const { Locales, getHTMLTextDir, getLocaleName } = require("intlayer");
|
|
981
|
+
const { useLocale } = require("next-intlayer");
|
|
982
|
+
|
|
983
|
+
export const LocaleSwitcher = () => {
|
|
984
|
+
const path
|
|
985
|
+
const { locale availableLocales, setLocale } = useLocale({
|
|
986
|
+
onChange: ()=> window.location.reload(),
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
return (
|
|
990
|
+
<div>
|
|
991
|
+
<button popoverTarget="localePopover">{getLocaleName(locale)}</button>
|
|
992
|
+
<div id="localePopover" popover="auto">
|
|
993
|
+
{availableLocales.map((localeItem) => (
|
|
994
|
+
<button
|
|
995
|
+
key={localeItem}
|
|
996
|
+
aria-current={locale === localeItem ? "page" : undefined}
|
|
997
|
+
onClick={() => setLocale(localeItem)}
|
|
998
|
+
>
|
|
999
|
+
<span>
|
|
1000
|
+
{/* Locale - ör. FR */}
|
|
1001
|
+
{localeItem}
|
|
1002
|
+
</span>
|
|
1003
|
+
<span>
|
|
1004
|
+
{/* Dil kendi locale'inde - ör. Français */}
|
|
1005
|
+
{getLocaleName(localeItem, locale)}
|
|
1006
|
+
</span>
|
|
1007
|
+
<span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
|
|
1008
|
+
{/* Dil mevcut locale'de - ör. Mevcut locale Locales.SPANISH iken: Francés */}
|
|
1009
|
+
{getLocaleName(localeItem)}
|
|
1010
|
+
</span>
|
|
1011
|
+
<span dir="ltr" lang={Locales.ENGLISH}>
|
|
1012
|
+
{/* İngilizce'de dil - ör. French */}
|
|
1013
|
+
{getLocaleName(localeItem, Locales.ENGLISH)}
|
|
1014
|
+
</span>
|
|
1015
|
+
</button>
|
|
1016
|
+
))}
|
|
1017
|
+
</div>
|
|
1018
|
+
</div>
|
|
1019
|
+
);
|
|
1020
|
+
};
|
|
1021
|
+
```
|
|
1022
|
+
|
|
1023
|
+
> Alternatif bir yol, `useLocale` hook'unun sağladığı `setLocale` fonksiyonunu kullanmaktır. Bu fonksiyon sayfanın prefetching yapılmasına izin vermez. Daha fazla bilgi için [`useLocale` hook dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/useLocale.md) bakın.
|
|
1024
|
+
|
|
1025
|
+
> Dokümantasyon referansları:
|
|
1026
|
+
>
|
|
1027
|
+
> - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/useLocale.md)
|
|
1028
|
+
> - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/getLocaleName.md)
|
|
1029
|
+
> - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/getLocalizedUrl.md)
|
|
1030
|
+
> - [`getHTMLTextDir` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/intlayer/getHTMLTextDir.md)
|
|
1031
|
+
> - [`hrefLang` özniteliği](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
|
|
1032
|
+
> - [`lang` özniteliği](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
|
|
1033
|
+
> - [`dir` özniteliği](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
|
|
1034
|
+
> - [`aria-current` özniteliği](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
|
|
1035
|
+
|
|
1036
|
+
### (İsteğe Bağlı) Adım 9: Sunucu eylemlerinde geçerli yereli (locale) alın
|
|
1037
|
+
|
|
1038
|
+
Eğer bir sunucu eylemi içinde aktif yerel ayara (örn. e-postaları yerelleştirmek veya yerel duyarlı mantık çalıştırmak için) ihtiyacınız varsa, `next-intlayer/server` içinden `getLocale`'i çağırın:
|
|
1039
|
+
|
|
1040
|
+
```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
|
|
1041
|
+
"use server";
|
|
1042
|
+
|
|
1043
|
+
import { getLocale } from "next-intlayer/server";
|
|
1044
|
+
|
|
1045
|
+
export const myServerAction = async () => {
|
|
1046
|
+
const locale = await getLocale();
|
|
1047
|
+
|
|
1048
|
+
// locale ile bir şeyler yap
|
|
1049
|
+
};
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
> `getLocale` fonksiyonu kullanıcının yerel ayarını belirlemek için kademeli bir strateji izler:
|
|
1053
|
+
>
|
|
1054
|
+
> 1. Öncelikle, proksi tarafından ayarlanmış olabilecek bir locale değerini kontrol etmek için istek başlıklarını (request headers) kontrol eder
|
|
1055
|
+
> 2. Başlıklarda locale bulunamazsa, çerezlerde (cookies) saklanan bir locale arar
|
|
1056
|
+
> 3. Çerez bulunamazsa, kullanıcının tarayıcı ayarlarından tercih edilen dili tespit etmeye çalışır
|
|
1057
|
+
> 4. Son çare olarak uygulamanın yapılandırılmış varsayılan locale değerine döner
|
|
1058
|
+
>
|
|
1059
|
+
> Bu, kullanılabilir bağlama göre en uygun yerelin seçilmesini sağlar.
|
|
1060
|
+
|
|
1061
|
+
### (İsteğe bağlı) Adım 10: Paket boyutunuzu optimize edin
|
|
1062
|
+
|
|
1063
|
+
`next-intlayer` kullanıldığında, sözlükler varsayılan olarak her sayfanın bundle'ına dahil edilir. Paket boyutunu optimize etmek için Intlayer, makrolar kullanarak `useIntlayer` çağrılarını akıllıca değiştiren isteğe bağlı bir SWC eklentisi sağlar. Bu, sözlüklerin yalnızca bunları gerçekten kullanan sayfaların bundle'larına dahil edilmesini sağlar.
|
|
1064
|
+
|
|
1065
|
+
Bu optimizasyonu etkinleştirmek için `@intlayer/swc` paketini yükleyin. Yüklendikten sonra `next-intlayer` eklentiyi otomatik olarak algılar ve kullanır:
|
|
1066
|
+
|
|
1067
|
+
```bash packageManager="npm"
|
|
1068
|
+
npm install @intlayer/swc --save-dev
|
|
1069
|
+
npx intlayer init
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
```bash packageManager="pnpm"
|
|
1073
|
+
pnpm add @intlayer/swc --save-dev
|
|
1074
|
+
pnpm intlayer init
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
```bash packageManager="yarn"
|
|
1078
|
+
yarn add @intlayer/swc --save-dev
|
|
1079
|
+
yarn intlayer init
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
```bash packageManager="bun"
|
|
1083
|
+
bun add @intlayer/swc --dev
|
|
1084
|
+
bunx intlayer init
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
> Not: Bu optimizasyon yalnızca Next.js 13 ve üzeri için kullanılabilir.
|
|
1088
|
+
|
|
1089
|
+
> Not: Bu paket varsayılan olarak yüklenmez çünkü SWC eklentileri Next.js üzerinde hâlâ deneysel durumdadır. İleride değişebilir.
|
|
1090
|
+
|
|
1091
|
+
> Not: Eğer seçeneği `importMode: 'dynamic'` veya `importMode: 'live'` olarak ayarlarsanız, bu Suspense'e dayanır; bu nedenle `useIntlayer` çağrılarınızı bir `Suspense` sınırı içine almanız gerekir. Bu, `useIntlayer`'ı Sayfa / Layout bileşeninizin en üst düzeyinde doğrudan kullanamayacağınız anlamına gelir.
|
|
1092
|
+
|
|
1093
|
+
### Turbopack'ta sözlük değişikliklerini izleme
|
|
1094
|
+
|
|
1095
|
+
next dev komutunu kullanarak geliştirme sunucunuz olarak Turbopack'i kullandığınızda, sözlük değişiklikleri varsayılan olarak otomatik algılanmaz.
|
|
1096
|
+
|
|
1097
|
+
Bu sınırlama, Turbopack'in içerik dosyalarınızdaki değişiklikleri izlemek için webpack eklentilerini paralel olarak çalıştıramamasından kaynaklanır. Bunu aşmak için geliştirme sunucusunu ve Intlayer derleme izleyicisini aynı anda çalıştırmak üzere `intlayer watch` komutunu kullanmanız gerekir.
|
|
1098
|
+
|
|
1099
|
+
```json5 fileName="package.json"
|
|
1100
|
+
{
|
|
1101
|
+
// ... Mevcut package.json yapılandırmalarınız
|
|
1102
|
+
"scripts": {
|
|
1103
|
+
// ... Mevcut scripts yapılandırmalarınız
|
|
1104
|
+
"dev": "intlayer watch --with 'next dev'",
|
|
1105
|
+
},
|
|
1106
|
+
}
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
> Eğer next-intlayer@<=6.x.x kullanıyorsanız, Next.js 16 uygulamasının Turbopack ile doğru çalışması için `--turbopack` bayrağını tutmanız gerekir. Bu sınırlamadan kaçınmak için next-intlayer@>=7.x.x kullanmanızı öneririz.
|
|
1110
|
+
|
|
1111
|
+
### TypeScript'i Yapılandırma
|
|
1112
|
+
|
|
1113
|
+
Intlayer, TypeScript'in avantajlarından yararlanmak ve kod tabanınızı güçlendirmek için module augmentation kullanır.
|
|
1114
|
+
|
|
1115
|
+

|
|
1116
|
+
|
|
1117
|
+

|
|
1118
|
+
|
|
1119
|
+
TypeScript yapılandırmanızın otomatik oluşturulmuş tipleri içerdiğinden emin olun.
|
|
1120
|
+
|
|
1121
|
+
```json5 fileName="tsconfig.json"
|
|
1122
|
+
{
|
|
1123
|
+
// ... Mevcut TypeScript yapılandırmalarınız
|
|
1124
|
+
"include": [
|
|
1125
|
+
// ... Mevcut TypeScript yapılandırmalarınız
|
|
1126
|
+
".intlayer/**/*.ts", // Otomatik oluşturulan türleri dahil et
|
|
1127
|
+
],
|
|
1128
|
+
}
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
### Git Yapılandırması
|
|
1132
|
+
|
|
1133
|
+
Intlayer tarafından oluşturulan dosyaları yoksaymanız önerilir. Bu, bu dosyaları Git deponuza commit etmekten kaçınmanızı sağlar.
|
|
1134
|
+
|
|
1135
|
+
Bunu yapmak için `.gitignore` dosyanıza aşağıdaki satırları ekleyebilirsiniz:
|
|
1136
|
+
|
|
1137
|
+
```plaintext fileName=".gitignore"
|
|
1138
|
+
# Intlayer tarafından oluşturulan dosyaları yoksay
|
|
1139
|
+
.intlayer
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
### VS Code Uzantısı
|
|
1143
|
+
|
|
1144
|
+
Intlayer ile geliştirme deneyiminizi iyileştirmek için resmi **Intlayer VS Code Uzantısını** yükleyebilirsiniz.
|
|
1145
|
+
|
|
1146
|
+
[VS Code Marketplace'ten Yükleyin](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
1147
|
+
|
|
1148
|
+
Bu uzantı şunları sağlar:
|
|
1149
|
+
|
|
1150
|
+
- **Otomatik tamamlama** çeviri anahtarları için.
|
|
1151
|
+
- Eksik çeviriler için **gerçek zamanlı hata tespiti**.
|
|
1152
|
+
- **Satır içi önizlemeler** — çevrilmiş içeriğin önizlemeleri.
|
|
1153
|
+
- **Hızlı eylemler** — çevirileri kolayca oluşturup güncellemek için.
|
|
1154
|
+
|
|
1155
|
+
Daha fazla ayrıntı için uzantının nasıl kullanılacağına dair [Intlayer VS Code Extension belgelerine](https://intlayer.org/doc/vs-code-extension) bakın.
|
|
1156
|
+
|
|
1157
|
+
### Daha İleri
|
|
1158
|
+
|
|
1159
|
+
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ışsallaştırabilirsiniz.
|