@intlayer/docs 7.0.0-canary.1 → 7.0.0-canary.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/cjs/common.cjs.map +1 -1
  2. package/dist/esm/common.mjs.map +1 -1
  3. package/dist/types/common.d.ts +5 -0
  4. package/dist/types/common.d.ts.map +1 -1
  5. package/docs/ar/intlayer_with_nextjs_16.md +1652 -0
  6. package/docs/ar/releases/v7.md +486 -0
  7. package/docs/de/intlayer_with_nextjs_16.md +1662 -0
  8. package/docs/de/releases/v7.md +503 -0
  9. package/docs/en/intlayer_with_nextjs_15.md +5 -2
  10. package/docs/en/intlayer_with_nextjs_16.md +4 -4
  11. package/docs/en-GB/intlayer_with_nextjs_16.md +1642 -0
  12. package/docs/en-GB/releases/v7.md +486 -0
  13. package/docs/es/intlayer_with_nextjs_16.md +1670 -0
  14. package/docs/es/releases/v7.md +503 -0
  15. package/docs/fr/intlayer_with_nextjs_16.md +1692 -0
  16. package/docs/fr/releases/v7.md +504 -0
  17. package/docs/hi/intlayer_with_nextjs_16.md +1618 -0
  18. package/docs/hi/releases/v7.md +486 -0
  19. package/docs/id/intlayer_with_nextjs_16.md +1604 -0
  20. package/docs/id/releases/v7.md +503 -0
  21. package/docs/it/intlayer_with_nextjs_16.md +1600 -0
  22. package/docs/it/releases/v7.md +505 -0
  23. package/docs/ja/intlayer_CMS.md +0 -9
  24. package/docs/ja/intlayer_with_nextjs_16.md +1788 -0
  25. package/docs/ja/releases/v7.md +504 -0
  26. package/docs/ko/intlayer_with_nextjs_16.md +1641 -0
  27. package/docs/ko/releases/v7.md +504 -0
  28. package/docs/pl/intlayer_with_nextjs_16.md +1645 -0
  29. package/docs/pl/releases/v7.md +486 -0
  30. package/docs/pt/intlayer_with_nextjs_16.md +1646 -0
  31. package/docs/pt/introduction.md +0 -15
  32. package/docs/pt/releases/v7.md +486 -0
  33. package/docs/ru/intlayer_with_nextjs_16.md +1610 -0
  34. package/docs/ru/releases/v7.md +486 -0
  35. package/docs/tr/intlayer_with_nextjs_16.md +1599 -0
  36. package/docs/tr/releases/v7.md +486 -0
  37. package/docs/vi/intlayer_with_nextjs_16.md +1597 -0
  38. package/docs/vi/releases/v7.md +486 -0
  39. package/docs/zh/intlayer_CMS.md +0 -23
  40. package/docs/zh/intlayer_with_nextjs_16.md +1628 -0
  41. package/docs/zh/releases/v7.md +487 -0
  42. package/package.json +14 -14
  43. package/src/common.ts +5 -0
@@ -0,0 +1,1599 @@
1
+ ---
2
+ createdAt: 2024-12-06
3
+ updatedAt: 2025-10-09
4
+ title: Next.js 16 uygulamanızı nasıl çevirirsiniz – i18n rehberi 2025
5
+ description: Next.js 16 web sitenizi çok dilli hale nasıl getireceğinizi keşfedin. Uluslararasılaştırma (i18n) ve çeviri için dokümantasyonu takip edin.
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
+ applicationTemplate: https://github.com/aymericzip/intlayer-next-16-template
18
+ youtubeVideo: https://www.youtube.com/watch?v=e_PPG7PTqGU
19
+ history:
20
+ - version: 7.0.0
21
+ date: 2025-06-29
22
+ changes: Başlangıç geçmişi
23
+ ---
24
+
25
+ # Intlayer kullanarak Next.js 16 web sitenizi çevirin | Uluslararasılaştırma (i18n)
26
+
27
+ <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&amp;origin=http://intlayer.org&amp;controls=0&amp;rel=1"/>
28
+
29
+ GitHub'da [Uygulama Şablonunu](https://github.com/aymericzip/intlayer-next-16-template) inceleyin.
30
+
31
+ ## Intlayer Nedir?
32
+
33
+ **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 son **Next.js 16** çerçevesiyle sorunsuz bir şekilde 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.
34
+
35
+ Intlayer ile şunları yapabilirsiniz:
36
+
37
+ - Bileşen seviyesinde bildirimsel sözlükler kullanarak **çevirileri kolayca yönetmek**.
38
+ - **Meta verileri, rotaları ve içeriği dinamik olarak yerelleştirmek**.
39
+ - **Hem istemci tarafı hem de sunucu tarafı bileşenlerinde çevirilere erişmek**.
40
+ - Otomatik oluşturulan tiplerle **TypeScript desteğini sağlamak**, otomatik tamamlama ve hata tespitini iyileştirmek.
41
+ - **Dinamik yerel ayar algılama ve değiştirme gibi gelişmiş özelliklerden yararlanın**.
42
+
43
+ > Intlayer, Next.js 12, 13, 14 ve 16 ile uyumludur. Next.js Page Router kullanıyorsanız, bu [kılavuza](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_with_nextjs_page_router.md) bakabilirsiniz. Next.js 12, 13, 14 App Router ile kullanıyorsanız, bu [kılavuza](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_with_nextjs_14.md) başvurun.
44
+
45
+ ---
46
+
47
+ ## Next.js Uygulamasında Intlayer Kurulumu Adım Adım Rehber
48
+
49
+ ### Adım 1: Bağımlılıkları Yükleyin
50
+
51
+ Gerekli paketleri npm ile yükleyin:
52
+
53
+ ```bash packageManager="npm"
54
+ npm install intlayer next-intlayer
55
+ ```
56
+
57
+ ```bash packageManager="pnpm"
58
+ pnpm add intlayer next-intlayer
59
+ ```
60
+
61
+ ```bash packageManager="yarn"
62
+ yarn add intlayer next-intlayer
63
+ ```
64
+
65
+ - **intlayer**
66
+
67
+ Yapılandırma yönetimi, çeviri, [içerik bildirimi](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/content_file.md), dönüştürme ve [CLI komutları](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/intlayer_cli.md) için uluslararasılaştırma araçları sağlayan temel paket.
68
+
69
+ - **next-intlayer**
70
+
71
+ Intlayer'ı Next.js ile entegre eden paket. Next.js uluslararasılaştırması için bağlam sağlayıcıları ve kancalar sunar. 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, kullanıcının tercih ettiği dili algılamak, çerezleri yönetmek ve URL yönlendirmesini işlemek için proxy'yi içerir.
72
+
73
+ ### Adım 2: Projenizi Yapılandırın
74
+
75
+ Uygulamanızın dillerini yapılandırmak için bir yapılandırma dosyası oluşturun:
76
+
77
+ ```typescript fileName="intlayer.config.ts" codeFormat="typescript"
78
+ import { Locales, type IntlayerConfig } from "intlayer";
79
+
80
+ const config: IntlayerConfig = {
81
+ internationalization: {
82
+ locales: [
83
+ Locales.ENGLISH,
84
+ Locales.FRENCH,
85
+ Locales.SPANISH,
86
+ // Diğer dilleriniz
87
+ ],
88
+ defaultLocale: Locales.ENGLISH,
89
+ },
90
+ };
91
+
92
+ export default config;
93
+ ```
94
+
95
+ ```javascript fileName="intlayer.config.mjs" codeFormat="esm"
96
+ import { Locales } from "intlayer";
97
+
98
+ /** @type {import('intlayer').IntlayerConfig} */
99
+ const config = {
100
+ internationalization: {
101
+ locales: [
102
+ Locales.ENGLISH,
103
+ Locales.FRENCH,
104
+ Locales.SPANISH,
105
+ // Diğer dilleriniz
106
+ ],
107
+ defaultLocale: Locales.ENGLISH,
108
+ },
109
+ };
110
+
111
+ export default config;
112
+ ```
113
+
114
+ ```javascript fileName="intlayer.config.cjs" codeFormat="commonjs"
115
+ const { Locales } = require("intlayer");
116
+
117
+ /** @type {import('intlayer').IntlayerConfig} */
118
+ const config = {
119
+ internationalization: {
120
+ locales: [
121
+ Locales.ENGLISH,
122
+ Locales.FRENCH,
123
+ Locales.SPANISH,
124
+ // Diğer dilleriniz
125
+ ],
126
+ defaultLocale: Locales.ENGLISH,
127
+ },
128
+ };
129
+
130
+ module.exports = config;
131
+ ```
132
+
133
+ > Bu yapılandırma dosyası aracılığıyla, yerelleştirilmiş URL'ler, proxy yönlendirmesi, çerez isimleri, içerik bildirimlerinizin konumu ve uzantısı, Intlayer günlüklerini konsolda devre dışı bırakma ve daha fazlasını ayarlayabilirsiniz. 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.
134
+
135
+ ### Adım 3: Intlayer'ı Next.js Yapılandırmanıza Entegre Edin
136
+
137
+ Next.js kurulumunuzu Intlayer kullanacak şekilde yapılandırın:
138
+
139
+ ```typescript fileName="next.config.ts" codeFormat="typescript"
140
+ import type { NextConfig } from "next";
141
+ import { withIntlayer } from "next-intlayer/server";
142
+
143
+ const nextConfig: NextConfig = {
144
+ /* yapılandırma seçenekleri buraya */
145
+ };
146
+
147
+ export default withIntlayer(nextConfig);
148
+ ```
149
+
150
+ ```typescript fileName="next.config.mjs" codeFormat="esm"
151
+ import { withIntlayer } from "next-intlayer/server";
152
+
153
+ /** @type {import('next').NextConfig} */
154
+ const nextConfig = {
155
+ /* yapılandırma seçenekleri buraya */
156
+ };
157
+
158
+ export default withIntlayer(nextConfig);
159
+ ```
160
+
161
+ ```typescript fileName="next.config.cjs" codeFormat="commonjs"
162
+ const { withIntlayer } = require("next-intlayer/server");
163
+
164
+ /** @type {import('next').NextConfig} */
165
+ const nextConfig = {
166
+ /* yapılandırma seçenekleri buraya */
167
+ };
168
+
169
+ module.exports = withIntlayer(nextConfig);
170
+ ```
171
+
172
+ > `withIntlayer()` Next.js eklentisi, Intlayer'ı Next.js ile entegre etmek için kullanılır. İçerik bildirim dosyalarının oluşturulmasını sağlar ve geliştirme modunda bunları izler. Intlayer ortam değişkenlerini [Webpack](https://webpack.js.org/) veya [Turbopack](https://nextjs.org/docs/app/api-reference/turbopack) ortamlarında tanımlar. Ayrıca, performansı optimize etmek için takma adlar sağlar ve sunucu bileşenleri ile uyumluluğu garanti eder.
173
+
174
+ > `withIntlayer()` fonksiyonu bir promise fonksiyonudur. Yapı başlamadan önce intlayer sözlüklerini hazırlamaya olanak tanır. Başka eklentilerle birlikte kullanmak isterseniz, onu await edebilirsiniz. Örnek:
175
+ >
176
+ > ```tsx
177
+ > const nextConfig = await withIntlayer(nextConfig);
178
+ > const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
179
+ > ```
180
+
181
+ > export default nextConfigWithOtherPlugins;
182
+ >
183
+ > ````
184
+ >
185
+ > Eşzamanlı kullanmak isterseniz, `withIntlayerSync()` fonksiyonunu kullanabilirsiniz. Örnek:
186
+ >
187
+ > ```tsx
188
+ > const nextConfig = withIntlayerSync(nextConfig);
189
+ > const nextConfigWithOtherPlugins = withOtherPlugins(nextConfig);
190
+ >
191
+ > export default nextConfigWithOtherPlugins;
192
+ > ````
193
+
194
+ ### Adım 4: Dinamik Yerel Rotaları Tanımlayın
195
+
196
+ `RootLayout` içindeki her şeyi kaldırın ve aşağıdaki kodla değiştirin:
197
+
198
+ ```tsx {3} fileName="src/app/layout.tsx" codeFormat="typescript"
199
+ import type { PropsWithChildren, FC } from "react";
200
+ import "./globals.css";
201
+
202
+ const RootLayout: FC<PropsWithChildren> = ({ children }) => (
203
+ // Çocukları hala diğer sağlayıcılarla sarabilirsiniz, örneğin `next-themes`, `react-query`, `framer-motion` vb.
204
+ <>{children}</>
205
+ );
206
+
207
+ export default RootLayout;
208
+ ```
209
+
210
+ ```jsx {3} fileName="src/app/layout.mjx" codeFormat="esm"
211
+ import "./globals.css";
212
+
213
+ const RootLayout = ({ children }) => (
214
+ // Çocukları hala `next-themes`, `react-query`, `framer-motion` gibi diğer sağlayıcılarla sarmalayabilirsiniz.
215
+ <>{children}</>
216
+ );
217
+
218
+ export default RootLayout;
219
+ ```
220
+
221
+ ```jsx {1,8} fileName="src/app/layout.csx" codeFormat="commonjs"
222
+ require("./globals.css");
223
+
224
+ const RootLayout = ({ children }) => (
225
+ // Çocukları hala `next-themes`, `react-query`, `framer-motion` gibi diğer sağlayıcılarla sarmalayabilirsiniz.
226
+ <>{children}</>
227
+ );
228
+
229
+ module.exports = {
230
+ default: RootLayout,
231
+ generateStaticParams,
232
+ };
233
+ ```
234
+
235
+ > `RootLayout` bileşenini boş tutmak, `<html>` etiketi için [`lang`](https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/lang) ve [`dir`](https://developer.mozilla.org/fr/docs/Web/HTML/Global_attributes/dir) özniteliklerini ayarlamaya olanak tanır.
236
+
237
+ Dinamik yönlendirmeyi uygulamak için, `[locale]` dizininize yeni bir layout ekleyerek yerel yolunu sağlayın:
238
+
239
+ ```tsx fileName="src/app/[locale]/layout.tsx" codeFormat="typescript"
240
+ import type { NextLayoutIntlayer } from "next-intlayer";
241
+ import { Inter } from "next/font/google";
242
+ import { getHTMLTextDir } from "intlayer";
243
+
244
+ const inter = Inter({ subsets: ["latin"] });
245
+
246
+ const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
247
+ const { locale } = await params;
248
+ return (
249
+ <html lang={locale} dir={getHTMLTextDir(locale)}>
250
+ <body className={inter.className}>{children}</body>
251
+ </html>
252
+ );
253
+ };
254
+
255
+ export default LocaleLayout;
256
+ ```
257
+
258
+ ```jsx fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
259
+ import { getHTMLTextDir } from "intlayer";
260
+
261
+ const inter = Inter({ subsets: ["latin"] });
262
+
263
+ const LocaleLayout = async ({ children, params: { locale } }) => {
264
+ const { locale } = await params;
265
+ return (
266
+ <html lang={locale} dir={getHTMLTextDir(locale)}>
267
+ <body className={inter.className}>{children}</body>
268
+ </html>
269
+ );
270
+ };
271
+
272
+ export default LocaleLayout;
273
+ ```
274
+
275
+ ```jsx fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
276
+ const { Inter } = require("next/font/google");
277
+ const { getHTMLTextDir } = require("intlayer");
278
+
279
+ const inter = Inter({ subsets: ["latin"] });
280
+
281
+ const LocaleLayout = async ({ children, params: { locale } }) => {
282
+ const { locale } = await params;
283
+ return (
284
+ <html lang={locale} dir={getHTMLTextDir(locale)}>
285
+ <body className={inter.className}>{children}</body>
286
+ </html>
287
+ );
288
+ };
289
+
290
+ module.exports = LocaleLayout;
291
+ ```
292
+
293
+ > `[locale]` yol segmenti, yerel ayarı tanımlamak için kullanılır. Örnek: `/en-US/about` `en-US`'ye, `/fr/about` ise `fr`'ye karşılık gelir.
294
+
295
+ > Bu aşamada, şu hatayla karşılaşacaksınız: `Error: Missing <html> and <body> tags in the root layout.`. Bu beklenen bir durumdur çünkü `/app/page.tsx` dosyası artık kullanılmamaktadır ve kaldırılabilir. Bunun yerine, `[locale]` yol segmenti `/app/[locale]/page.tsx` sayfasını etkinleştirecektir. Sonuç olarak, tarayıcınızda sayfalara `/en`, `/fr`, `/es` gibi yollar üzerinden erişilebilecektir. Varsayılan dili kök sayfa olarak ayarlamak için, 7. adımdaki `proxy` ayarına bakınız.
296
+
297
+ Sonrasında, uygulamanızın Layout bileşeninde `generateStaticParams` fonksiyonunu uygulayın.
298
+
299
+ ```tsx {1} fileName="src/app/[locale]/layout.tsx" codeFormat="typescript"
300
+ export { generateStaticParams } from "next-intlayer"; // Eklenecek satır
301
+
302
+ const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
303
+ /*... Kodun geri kalanı */
304
+ };
305
+
306
+ export default LocaleLayout;
307
+ ```
308
+
309
+ ```jsx {1} fileName="src/app/[locale]/layout.mjx" codeFormat="esm"
310
+ export { generateStaticParams } from "next-intlayer"; // Eklenecek satır
311
+
312
+ const LocaleLayout = async ({ children, params: { locale } }) => {
313
+ /*... Kodun geri kalanı */
314
+ };
315
+
316
+ // ... Kodun geri kalanı
317
+ ```
318
+
319
+ ```jsx {1,7} fileName="src/app/[locale]/layout.csx" codeFormat="commonjs"
320
+ const { generateStaticParams } = require("next-intlayer"); // Eklenecek satır
321
+
322
+ const LocaleLayout = async ({ children, params: { locale } }) => {
323
+ /*... Kodun geri kalanı */
324
+ };
325
+
326
+ module.exports = { default: LocaleLayout, generateStaticParams };
327
+ ```
328
+
329
+ > `generateStaticParams`, uygulamanızın tüm yereller için gerekli sayfaları önceden oluşturmasını sağlar, böylece çalışma zamanı hesaplamalarını azaltır ve kullanıcı deneyimini iyileştirir. Daha fazla detay için [Next.js generateStaticParams dokümantasyonuna](https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic-rendering#generate-static-params) bakabilirsiniz.
330
+
331
+ > Intlayer, sayfaların tüm yereller için önceden oluşturulmasını sağlamak amacıyla `export const dynamic = 'force-static';` ile çalışır.
332
+
333
+ ### Adım 5: İçeriğinizi Bildirin
334
+
335
+ Çevirileri depolamak için içerik bildirimlerinizi oluşturun ve yönetin:
336
+
337
+ ```tsx fileName="src/app/[locale]/page.content.ts" contentDeclarationFormat="typescript"
338
+ import { t, type Dictionary } from "intlayer";
339
+
340
+ const pageContent = {
341
+ key: "page",
342
+ content: {
343
+ getStarted: {
344
+ main: t({
345
+ en: "Get started by editing",
346
+ fr: "Commencez par éditer",
347
+ es: "Comience por editar",
348
+ }),
349
+ pageLink: "src/app/page.tsx",
350
+ },
351
+ },
352
+ } satisfies Dictionary;
353
+
354
+ export default pageContent;
355
+ ```
356
+
357
+ ```javascript fileName="src/app/[locale]/page.content.mjs" contentDeclarationFormat="esm"
358
+ import { t } from "intlayer";
359
+
360
+ /** @type {import('intlayer').Dictionary} */
361
+ const pageContent = {
362
+ key: "page",
363
+ content: {
364
+ getStarted: {
365
+ main: t({
366
+ en: "Get started by editing",
367
+ fr: "Commencez par éditer",
368
+ es: "Comience por editar",
369
+ }),
370
+ pageLink: "src/app/page.tsx",
371
+ },
372
+ },
373
+ };
374
+
375
+ export default pageContent;
376
+ ```
377
+
378
+ ```javascript fileName="src/app/[locale]/page.content.cjs" contentDeclarationFormat="commonjs"
379
+ const { t } = require("intlayer");
380
+
381
+ /** @type {import('intlayer').Dictionary} */
382
+ const pageContent = {
383
+ key: "page",
384
+ content: {
385
+ getStarted: {
386
+ main: t({
387
+ en: "Get started by editing",
388
+ fr: "Commencez par éditer",
389
+ es: "Comience por editar",
390
+ }),
391
+ pageLink: "src/app/page.tsx",
392
+ },
393
+ },
394
+ };
395
+
396
+ module.exports = pageContent;
397
+ ```
398
+
399
+ ```json fileName="src/app/[locale]/page.content.json" contentDeclarationFormat="json"
400
+ {
401
+ "$schema": "https://intlayer.org/schema.json",
402
+ "key": "page",
403
+ "content": {
404
+ "getStarted": {
405
+ "nodeType": "translation",
406
+ "translation": {
407
+ "en": "Get started by editing",
408
+ "fr": "Commencez par éditer",
409
+ "es": "Comience por editar"
410
+ }
411
+ },
412
+ "pageLink": "src/app/page.tsx"
413
+ }
414
+ }
415
+ ```
416
+
417
+ > İçerik bildirimleriniz, uygulamanızda herhangi bir yerde tanımlanabilir; yeter ki `contentDir` dizinine (varsayılan olarak `./src`) dahil edilmiş olsun. Ve içerik bildirim dosya uzantısıyla (varsayılan olarak `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`) eşleşmelidir.
418
+
419
+ > Daha fazla detay için, [içerik bildirim dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/dictionary/content_file.md) bakınız.
420
+
421
+ ### Adım 6: İçeriği Kodunuzda Kullanın
422
+
423
+ Uygulamanız boyunca içerik sözlüklerinize erişin:
424
+
425
+ ```tsx fileName="src/app/[locale]/page.tsx" codeFormat="typescript"
426
+ import type { FC } from "react";
427
+ import { ClientComponentExample } from "@components/ClientComponentExample";
428
+ import { ServerComponentExample } from "@components/ServerComponentExample";
429
+ import { type NextPageIntlayer, IntlayerClientProvider } from "next-intlayer";
430
+ import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
431
+
432
+ const PageContent: FC = () => {
433
+ const content = useIntlayer("page");
434
+
435
+ return (
436
+ <>
437
+ <p>{content.getStarted.main}</p>
438
+ <code>{content.getStarted.pageLink}</code>
439
+ </>
440
+ );
441
+ };
442
+
443
+ const Page: NextPageIntlayer = async ({ params }) => {
444
+ const { locale } = await params;
445
+
446
+ return (
447
+ <IntlayerServerProvider locale={locale}>
448
+ <PageContent />
449
+ <ServerComponentExample />
450
+
451
+ <IntlayerClientProvider locale={locale}>
452
+ <ClientComponentExample />
453
+ </IntlayerClientProvider>
454
+ </IntlayerServerProvider>
455
+ );
456
+ };
457
+
458
+ export default Page;
459
+ ```
460
+
461
+ ```jsx fileName="src/app/[locale]/page.mjx" codeFormat="esm"
462
+ import { ClientComponentExample } from "@components/ClientComponentExample";
463
+ import { ServerComponentExample } from "@components/ServerComponentExample";
464
+ import { IntlayerClientProvider } from "next-intlayer";
465
+ import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
466
+
467
+ const PageContent = () => {
468
+ const content = useIntlayer("page");
469
+
470
+ return (
471
+ <>
472
+ <p>{content.getStarted.main}</p>
473
+ <code>{content.getStarted.pageLink}</code>
474
+ </>
475
+ );
476
+ };
477
+
478
+ const Page = async ({ params }) => {
479
+ const { locale } = await params;
480
+
481
+ return (
482
+ <IntlayerServerProvider locale={locale}>
483
+ <PageContent />
484
+ <ServerComponentExample />
485
+
486
+ <IntlayerClientProvider locale={locale}>
487
+ <ClientComponentExample />
488
+ </IntlayerClientProvider>
489
+ </IntlayerServerProvider>
490
+ );
491
+ };
492
+
493
+ export default Page;
494
+ ```
495
+
496
+ ```jsx fileName="src/app/[locale]/page.csx" codeFormat="commonjs"
497
+ import { ClientComponentExample } from "@components/ClientComponentExample";
498
+ import { ServerComponentExample } from "@components/ServerComponentExample";
499
+ import { IntlayerClientProvider } from "next-intlayer";
500
+ import { IntlayerServerProvider, useIntlayer } from "next-intlayer/server";
501
+
502
+ const PageContent = () => {
503
+ const content = useIntlayer("page");
504
+
505
+ return (
506
+ <>
507
+ <p>{content.getStarted.main}</p>
508
+ <code>{content.getStarted.pageLink}</code>
509
+ </>
510
+ );
511
+ };
512
+
513
+ const Page = async ({ params }) => {
514
+ const { locale } = await params;
515
+
516
+ return (
517
+ <IntlayerServerProvider locale={locale}>
518
+ <PageContent />
519
+ <ServerComponentExample />
520
+
521
+ <IntlayerClientProvider locale={locale}>
522
+ <ClientComponentExample />
523
+ </IntlayerClientProvider>
524
+ </IntlayerServerProvider>
525
+ );
526
+ };
527
+ ```
528
+
529
+ - **`IntlayerClientProvider`**, istemci tarafı bileşenlere yerel ayarı sağlamak için kullanılır. Herhangi bir üst bileşende, layout dahil olmak üzere yerleştirilebilir. Ancak, Next.js'in layout kodunu sayfalar arasında paylaştığı ve bu nedenle daha verimli olduğu için, bunu bir layout içinde yerleştirmek önerilir. `IntlayerClientProvider`'ı layout içinde kullanarak, her sayfa için yeniden başlatılmasını önler, performansı artırır ve uygulamanız boyunca tutarlı bir yerelleştirme bağlamı sağlar.
530
+ - **`IntlayerServerProvider`**, sunucu tarafındaki alt bileşenlere yerel ayarı sağlamak için kullanılır. Layout içinde ayarlanamaz.
531
+
532
+ > Layout ve sayfa ortak bir sunucu bağlamını paylaşamaz çünkü sunucu bağlam sistemi, her istek için veri deposuna (React'in [cache](https://react.dev/reference/react/cache) mekanizması aracılığıyla) dayanır ve bu, uygulamanın farklı segmentleri için her "bağlamın" yeniden oluşturulmasına neden olur. Sağlayıcıyı paylaşılan bir layout içinde yerleştirmek bu izolasyonu bozacak ve sunucu bağlam değerlerinin sunucu bileşenlerinize doğru şekilde iletilmesini engelleyecektir.
533
+
534
+ ```tsx {4,7} fileName="src/components/ClientComponentExample.tsx" codeFormat="typescript"
535
+ "use client";
536
+
537
+ import type { FC } from "react";
538
+ import { useIntlayer } from "next-intlayer";
539
+
540
+ export const ClientComponentExample: FC = () => {
541
+ const content = useIntlayer("client-component-example"); // İlgili içerik bildirimi oluştur
542
+ return (
543
+ <div>
544
+ <h2>{content.title}</h2>
545
+ <p>{content.content}</p>
546
+ </div>
547
+ );
548
+ };
549
+ ```
550
+
551
+ ```jsx {3,6} fileName="src/components/ClientComponentExample.mjx" codeFormat="esm"
552
+ "use client";
553
+
554
+ import { useIntlayer } from "next-intlayer";
555
+
556
+ const ClientComponentExample = () => {
557
+ const content = useIntlayer("client-component-example"); // İlgili içerik bildirimi oluştur
558
+
559
+ return (
560
+ <div>
561
+ <h2>{content.title}</h2>
562
+ <p>{content.content}</p>
563
+ </div>
564
+ );
565
+ };
566
+ ```
567
+
568
+ ```jsx {3,6} fileName="src/components/ClientComponentExample.csx" codeFormat="commonjs"
569
+ "use client";
570
+
571
+ const { useIntlayer } = require("next-intlayer");
572
+
573
+ const ClientComponentExample = () => {
574
+ const content = useIntlayer("client-component-example"); // İlgili içerik bildirimi oluştur
575
+
576
+ return (
577
+ <div>
578
+ <h2>{content.title}</h2>
579
+ <p>{content.content}</p>
580
+ </div>
581
+ );
582
+ };
583
+ ```
584
+
585
+ ```tsx {2} fileName="src/components/ServerComponentExample.tsx" codeFormat="typescript"
586
+ import type { FC } from "react";
587
+ import { useIntlayer } from "next-intlayer/server";
588
+
589
+ export const ServerComponentExample: FC = () => {
590
+ const content = useIntlayer("server-component-example"); // İlgili içerik bildirimi oluştur
591
+
592
+ return (
593
+ <div>
594
+ <h2>{content.title}</h2>
595
+ <p>{content.content}</p>
596
+ </div>
597
+ );
598
+ };
599
+ ```
600
+
601
+ ```jsx {1} fileName="src/components/ServerComponentExample.mjx" codeFormat="esm"
602
+ import { useIntlayer } from "next-intlayer/server";
603
+
604
+ const ServerComponentExample = () => {
605
+ const content = useIntlayer("server-component-example"); // İlgili içerik bildirimi oluştur
606
+
607
+ return (
608
+ <div>
609
+ <h2>{content.title}</h2>
610
+ <p>{content.content}</p>
611
+ </div>
612
+ );
613
+ };
614
+ ```
615
+
616
+ ```jsx {1} fileName="src/components/ServerComponentExample.csx" codeFormat="commonjs"
617
+ const { useIntlayer } = require("next-intlayer/server");
618
+
619
+ const ServerComponentExample = () => {
620
+ const content = useIntlayer("server-component-example"); // İlgili içerik bildirimi oluştur
621
+
622
+ return (
623
+ <div>
624
+ <h2>{content.title}</h2>
625
+ <p>{content.content}</p>
626
+ </div>
627
+ );
628
+ };
629
+ ```
630
+
631
+ > İçeriğinizi `alt`, `title`, `href`, `aria-label` gibi bir `string` özniteliğinde kullanmak istiyorsanız, fonksiyonun değerini şu şekilde çağırmalısınız:
632
+
633
+ > ```jsx
634
+ > <img src={content.image.src.value} alt={content.image.value} />
635
+ > ```
636
+
637
+ > `useIntlayer` kancasını daha fazla öğrenmek için, [belgelere](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/useIntlayer.md) bakınız.
638
+
639
+ ### (İsteğe Bağlı) Adım 7: Yerel Algılama için Proxy Yapılandırması
640
+
641
+ Kullanıcının tercih ettiği yereli algılamak için proxy kurun:
642
+
643
+ ```typescript fileName="src/proxy.ts" codeFormat="typescript"
644
+ export { intlayerProxy as proxy } from "next-intlayer/proxy";
645
+
646
+ export const config = {
647
+ matcher:
648
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
649
+ };
650
+ ```
651
+
652
+ ```javascript fileName="src/proxy.mjs" codeFormat="esm"
653
+ export { intlayerProxy as proxy } from "next-intlayer/proxy";
654
+
655
+ export const config = {
656
+ matcher:
657
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
658
+ };
659
+ ```
660
+
661
+ ```javascript fileName="src/proxy.cjs" codeFormat="commonjs"
662
+ const { intlayerProxy } = require("next-intlayer/proxy");
663
+
664
+ const config = {
665
+ matcher:
666
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
667
+ };
668
+
669
+ module.exports = { proxy: intlayerProxy, config };
670
+ ```
671
+
672
+ > `intlayerProxy`, kullanıcının tercih ettiği yereli algılamak ve onları [yapılandırmada](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/configuration.md) belirtilen uygun URL'ye yönlendirmek için kullanılır. Ayrıca, kullanıcının tercih ettiği yerelin bir çerezde saklanmasını sağlar.
673
+
674
+ > Birden fazla proxy'yi zincirlemek (örneğin, `intlayerProxy` ile kimlik doğrulama veya özel proxy'ler) gerekiyorsa, Intlayer artık `multipleProxies` adlı bir yardımcı sağlar.
675
+
676
+ ```ts
677
+ import { multipleProxies, intlayerProxy } from "next-intlayer/proxy";
678
+ import { customProxy } from "@utils/customProxy";
679
+
680
+ export const proxy = multipleProxies([intlayerProxy, customProxy]);
681
+ ```
682
+
683
+ ### (İsteğe Bağlı) Adım 8: Meta verilerinizin uluslararasılaştırılması
684
+
685
+ Sayfanızın başlığı gibi meta verilerinizi uluslararasılaştırmak isterseniz, Next.js tarafından sağlanan `generateMetadata` fonksiyonunu kullanabilirsiniz. İçerisinde, meta verilerinizi çevirmek için `getIntlayer` fonksiyonundan içeriği alabilirsiniz.
686
+
687
+ ```typescript fileName="src/app/[locale]/metadata.content.ts" contentDeclarationFormat="typescript"
688
+ import { type Dictionary, t } from "intlayer";
689
+ import { Metadata } from "next";
690
+
691
+ const metadataContent = {
692
+ key: "page-metadata",
693
+ content: {
694
+ title: t({
695
+ en: "Create Next App",
696
+ fr: "Créer une application Next.js",
697
+ es: "Crear una aplicación Next.js",
698
+ }),
699
+ description: t({
700
+ en: "Generated by create next app",
701
+ fr: "Généré par create next app",
702
+ es: "Generado por create next app",
703
+ }),
704
+ },
705
+ } satisfies Dictionary<Metadata>;
706
+
707
+ export default metadataContent;
708
+ ```
709
+
710
+ ```javascript fileName="src/app/[locale]/metadata.content.mjs" contentDeclarationFormat="esm"
711
+ import { t } from "intlayer";
712
+
713
+ /** @type {import('intlayer').Dictionary<import('next').Metadata>} */
714
+ const metadataContent = {
715
+ key: "page-metadata",
716
+ content: {
717
+ title: t({
718
+ en: "Create Next App",
719
+ fr: "Créer une application Next.js",
720
+ es: "Crear una aplicación Next.js",
721
+ }),
722
+ description: t({
723
+ en: "create next app tarafından oluşturuldu",
724
+ fr: "Généré par create next app",
725
+ es: "Generado por create next app",
726
+ }),
727
+ },
728
+ };
729
+
730
+ export default metadataContent;
731
+ fr: "create next app tarafından oluşturuldu",
732
+ es: "create next app tarafından oluşturuldu",
733
+ }),
734
+ },
735
+ };
736
+
737
+ export default metadataContent;
738
+ ```
739
+
740
+ ```javascript fileName="src/app/[locale]/metadata.content.cjs" contentDeclarationFormat="commonjs"
741
+ const { t } = require("intlayer");
742
+
743
+ /** @type {import('intlayer').Dictionary<import('next').Metadata>} */
744
+ const metadataContent = {
745
+ key: "page-metadata",
746
+ content: {
747
+ title: t({
748
+ en: "Create Next App",
749
+ fr: "Créer une application Next.js",
750
+ es: "Crear una aplicación Next.js",
751
+ }),
752
+ description: t({
753
+ en: "create next app tarafından oluşturuldu",
754
+ fr: "create next app tarafından oluşturuldu",
755
+ es: "create next app tarafından oluşturuldu",
756
+ }),
757
+ },
758
+ };
759
+
760
+ module.exports = metadataContent;
761
+ ```
762
+
763
+ ```json fileName="src/app/[locale]/metadata.content.json" contentDeclarationFormat="json"
764
+ {
765
+ "key": "page-metadata",
766
+ "content": {
767
+ "title": {
768
+ "nodeType": "translation",
769
+ "translation": {
770
+ "en": "Preact logo",
771
+ "fr": "Logo Preact",
772
+ "es": "Logo Preact",
773
+ "tr": "Preact logosu"
774
+ }
775
+ },
776
+ "description": {
777
+ "nodeType": "translation",
778
+ "translation": {
779
+ "en": "Generated by create next app",
780
+ "fr": "Généré par create next app",
781
+ "es": "Generado por create next app",
782
+ "tr": "create next app tarafından oluşturuldu"
783
+ }
784
+ }
785
+ }
786
+ }
787
+ ```
788
+
789
+ ````typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
790
+ import { getIntlayer, getMultilingualUrls } from "intlayer";
791
+ import type { Metadata } from "next";
792
+ import type { LocalPromiseParams } from "next-intlayer";
793
+
794
+ export const generateMetadata = async ({
795
+ params,
796
+ }: LocalPromiseParams): Promise<Metadata> => {
797
+ const { locale } = await params;
798
+
799
+ const metadata = getIntlayer("page-metadata", locale);
800
+
801
+ /**
802
+ * Her yerel dil için tüm URL'leri içeren bir nesne oluşturur.
803
+ *
804
+ * Örnek:
805
+ * ```ts
806
+ * getMultilingualUrls('/about');
807
+ *
808
+ * // Döner
809
+ * // {
810
+ * // en: '/about',
811
+ * // fr: '/fr/about',
812
+ * // es: '/es/about',
813
+ * // }
814
+ * ```
815
+ */
816
+ const multilingualUrls = getMultilingualUrls("/");
817
+
818
+ return {
819
+ ...metadata,
820
+ alternates: {
821
+ canonical: multilingualUrls[locale as keyof typeof multilingualUrls],
822
+ languages: { ...multilingualUrls, "x-default": "/" },
823
+ },
824
+ openGraph: {
825
+ url: multilingualUrls[locale],
826
+ },
827
+ };
828
+ };
829
+
830
+ // ... Kodun geri kalanı
831
+ ````
832
+
833
+ ````javascript fileName="src/app/[locale]/layout.mjs or src/app/[locale]/page.mjs" codeFormat="esm"
834
+ import { getIntlayer, getMultilingualUrls } from "intlayer";
835
+
836
+ export const generateMetadata = async ({ params }) => {
837
+ const { locale } = await params;
838
+
839
+ const metadata = getIntlayer("page-metadata", locale);
840
+
841
+ /**
842
+ * Her yerel için tüm URL'leri içeren bir nesne oluşturur.
843
+ *
844
+ * Örnek:
845
+ * ```ts
846
+ * getMultilingualUrls('/about');
847
+ *
848
+ * // Döner
849
+ * // {
850
+ * // en: '/about',
851
+ * // fr: '/fr/about',
852
+ * // es: '/es/about'
853
+ * // }
854
+ * ```
855
+ */
856
+ const multilingualUrls = getMultilingualUrls("/");
857
+
858
+ return {
859
+ ...metadata,
860
+ alternates: {
861
+ canonical: multilingualUrls[locale],
862
+ languages: { ...multilingualUrls, "x-default": "/" },
863
+ },
864
+ openGraph: {
865
+ url: multilingualUrls[locale],
866
+ },
867
+ };
868
+ };
869
+
870
+ // ... Kodun geri kalanı
871
+ ````
872
+
873
+ ````javascript fileName="src/app/[locale]/layout.cjs or src/app/[locale]/page.cjs" codeFormat="commonjs"
874
+ const { getIntlayer, getMultilingualUrls } = require("intlayer");
875
+
876
+ const generateMetadata = async ({ params }) => {
877
+ const { locale } = await params;
878
+
879
+ const metadata = getIntlayer("page-metadata", locale);
880
+
881
+ /**
882
+ * Her yerel dil için tüm URL'leri içeren bir nesne oluşturur.
883
+ *
884
+ * Örnek:
885
+ * ```ts
886
+ * getMultilingualUrls('/about');
887
+ *
888
+ * // Döner
889
+ * // {
890
+ * // en: '/about',
891
+ * // fr: '/fr/about',
892
+ * // es: '/es/about'
893
+ * // }
894
+ * ```
895
+ */
896
+ const multilingualUrls = getMultilingualUrls("/");
897
+
898
+ return {
899
+ ...metadata,
900
+ alternates: {
901
+ canonical: multilingualUrls[locale],
902
+ languages: { ...multilingualUrls, "x-default": "/" },
903
+ },
904
+ openGraph: {
905
+ url: multilingualUrls[locale],
906
+ },
907
+ };
908
+ };
909
+
910
+ module.exports = { generateMetadata };
911
+
912
+ // ... Kodun geri kalanı
913
+ ````
914
+
915
+ > `next-intlayer`'dan içe aktarılan `getIntlayer` fonksiyonunun, içeriğinizi bir `IntlayerNode` içinde döndürdüğünü ve bu sayede görsel editörle entegrasyon sağladığını unutmayın. Buna karşılık, `intlayer`'dan içe aktarılan `getIntlayer` fonksiyonu, içeriğinizi ek özellikler olmadan doğrudan döndürür.
916
+
917
+ Alternatif olarak, meta verilerinizi bildirmek için `getTranslation` fonksiyonunu kullanabilirsiniz. Ancak, meta verilerinizin çevirisini otomatikleştirmek ve içeriği bir noktada dışa aktarmak için içerik bildirim dosyalarını kullanmanız önerilir.
918
+
919
+ ```typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
920
+ import {
921
+ type IConfigLocales,
922
+ getTranslation,
923
+ getMultilingualUrls,
924
+ } from "intlayer";
925
+ import type { Metadata } from "next";
926
+ import type { LocalPromiseParams } from "next-intlayer";
927
+
928
+ export const generateMetadata = async ({
929
+ params,
930
+ }: LocalPromiseParams): Promise<Metadata> => {
931
+ const { locale } = await params;
932
+ const t = <T>(content: IConfigLocales<T>) => getTranslation(content, locale);
933
+
934
+ return {
935
+ title: t<string>({
936
+ en: "My title",
937
+ fr: "Mon titre",
938
+ es: "Mi título",
939
+ }),
940
+ description: t({
941
+ en: "Açıklamam",
942
+ fr: "Ma description",
943
+ es: "Mi descripción",
944
+ }),
945
+ };
946
+ };
947
+
948
+ // ... Kodun geri kalanı
949
+ ```
950
+
951
+ ```javascript fileName="src/app/[locale]/layout.mjs or src/app/[locale]/page.mjs" codeFormat="esm"
952
+ import { getTranslation, getMultilingualUrls } from "intlayer";
953
+
954
+ export const generateMetadata = async ({ params }) => {
955
+ const { locale } = await params;
956
+ const t = (content) => getTranslation(content, locale);
957
+
958
+ return {
959
+ title: t({
960
+ en: "Başlığım",
961
+ fr: "Mon titre",
962
+ es: "Mi título",
963
+ }),
964
+ description: t({
965
+ en: "Açıklamam",
966
+ fr: "Ma description",
967
+ es: "Mi descripción",
968
+ }),
969
+ };
970
+ };
971
+
972
+ // ... Kodun geri kalanı
973
+ ```
974
+
975
+ ```javascript fileName="src/app/[locale]/layout.cjs or src/app/[locale]/page.cjs" codeFormat="commonjs"
976
+ const { getTranslation, getMultilingualUrls } = require("intlayer");
977
+
978
+ const generateMetadata = async ({ params }) => {
979
+ const { locale } = await params;
980
+
981
+ const t = (content) => getTranslation(content, locale);
982
+
983
+ return {
984
+ title: t({
985
+ en: "My title",
986
+ fr: "Mon titre",
987
+ es: "Mi título",
988
+ }),
989
+ description: t({
990
+ en: "Açıklamam",
991
+ fr: "Ma description",
992
+ es: "Mi descripción",
993
+ }),
994
+ };
995
+ };
996
+
997
+ module.exports = { generateMetadata };
998
+
999
+ // ... Kodun geri kalanı
1000
+ ```
1001
+
1002
+ > Metadata optimizasyonu hakkında daha fazla bilgi edinin [resmi Next.js dokümantasyonunda](https://nextjs.org/docs/app/building-your-application/optimizing/metadata).
1003
+
1004
+ ### (İsteğe Bağlı) Adım 9: sitemap.xml ve robots.txt dosyalarınızın uluslararasılaştırılması
1005
+
1006
+ `sitemap.xml` ve `robots.txt` dosyalarınızı uluslararasılaştırmak için Intlayer tarafından sağlanan `getMultilingualUrls` fonksiyonunu kullanabilirsiniz. Bu fonksiyon, sitemap'iniz için çok dilli URL'ler oluşturmanıza olanak tanır.
1007
+
1008
+ ```tsx fileName="src/app/sitemap.ts" codeFormat="typescript"
1009
+ import { getMultilingualUrls } from "intlayer";
1010
+ import type { MetadataRoute } from "next";
1011
+
1012
+ const sitemap = (): MetadataRoute.Sitemap => [
1013
+ {
1014
+ url: "https://example.com",
1015
+ alternates: {
1016
+ languages: { ...getMultilingualUrls("https://example.com") },
1017
+ },
1018
+ },
1019
+ {
1020
+ url: "https://example.com/login",
1021
+ alternates: {
1022
+ languages: { ...getMultilingualUrls("https://example.com/login") },
1023
+ },
1024
+ },
1025
+ {
1026
+ url: "https://example.com/register",
1027
+ alternates: {
1028
+ languages: { ...getMultilingualUrls("https://example.com/register") },
1029
+ },
1030
+ },
1031
+ ];
1032
+
1033
+ export default sitemap;
1034
+ ```
1035
+
1036
+ ```jsx fileName="src/app/sitemap.mjx" codeFormat="esm"
1037
+ import { getMultilingualUrls } from "intlayer";
1038
+
1039
+ const sitemap = () => [
1040
+ {
1041
+ url: "https://example.com",
1042
+ alternates: {
1043
+ languages: { ...getMultilingualUrls("https://example.com") },
1044
+ },
1045
+ },
1046
+ {
1047
+ url: "https://example.com/login",
1048
+ alternates: {
1049
+ languages: { ...getMultilingualUrls("https://example.com/login") },
1050
+ },
1051
+ },
1052
+ {
1053
+ url: "https://example.com/register",
1054
+ alternates: {
1055
+ languages: { ...getMultilingualUrls("https://example.com/register") },
1056
+ },
1057
+ },
1058
+ ];
1059
+
1060
+ export default sitemap;
1061
+ ```
1062
+
1063
+ ```jsx fileName="src/app/sitemap.csx" codeFormat="commonjs"
1064
+ const { getMultilingualUrls } = require("intlayer");
1065
+
1066
+ // Çok dilli URL'leri almak için sitemap fonksiyonu
1067
+ const sitemap = () => [
1068
+ {
1069
+ url: "https://example.com",
1070
+ alternates: {
1071
+ languages: { ...getMultilingualUrls("https://example.com") },
1072
+ },
1073
+ },
1074
+ {
1075
+ url: "https://example.com/login",
1076
+ alternates: {
1077
+ languages: { ...getMultilingualUrls("https://example.com/login") },
1078
+ },
1079
+ },
1080
+ {
1081
+ url: "https://example.com/register",
1082
+ alternates: {
1083
+ languages: { ...getMultilingualUrls("https://example.com/register") },
1084
+ },
1085
+ },
1086
+ ];
1087
+
1088
+ module.exports = sitemap;
1089
+ ```
1090
+
1091
+ ```tsx fileName="src/app/robots.ts" codeFormat="typescript"
1092
+ import type { MetadataRoute } from "next";
1093
+ import { getMultilingualUrls } from "intlayer";
1094
+
1095
+ const getAllMultilingualUrls = (urls: string[]) =>
1096
+ urls.flatMap((url) => Object.values(getMultilingualUrls(url)) as string[]);
1097
+
1098
+ // Tüm çok dilli URL'leri almak için fonksiyon
1099
+ const robots = (): MetadataRoute.Robots => ({
1100
+ rules: {
1101
+ userAgent: "*", // Tüm kullanıcı ajanlarına izin ver
1102
+ allow: ["/"], // Ana sayfaya izin ver
1103
+ disallow: getAllMultilingualUrls(["/login", "/register"]), // Giriş ve kayıt sayfalarını engelle
1104
+ },
1105
+ host: "https://example.com",
1106
+ sitemap: `https://example.com/sitemap.xml`, // Site haritası URL'si
1107
+ });
1108
+
1109
+ export default robots;
1110
+ ```
1111
+
1112
+ ```jsx fileName="src/app/robots.mjx" codeFormat="esm"
1113
+ import { getMultilingualUrls } from "intlayer";
1114
+
1115
+ // Tüm çok dilli URL'leri almak için fonksiyon
1116
+ const getAllMultilingualUrls = (urls) =>
1117
+ urls.flatMap((url) => Object.values(getMultilingualUrls(url)));
1118
+
1119
+ const robots = () => ({
1120
+ rules: {
1121
+ userAgent: "*", // Tüm kullanıcı ajanlarına izin ver
1122
+ allow: ["/"], // Ana sayfaya izin ver
1123
+ disallow: getAllMultilingualUrls(["/login", "/register"]), // Giriş ve kayıt sayfalarını engelle
1124
+ },
1125
+ host: "https://example.com",
1126
+ sitemap: `https://example.com/sitemap.xml`,
1127
+ });
1128
+
1129
+ export default robots;
1130
+ ```
1131
+
1132
+ ```jsx fileName="src/app/robots.csx" codeFormat="commonjs"
1133
+ const { getMultilingualUrls } = require("intlayer");
1134
+
1135
+ const getAllMultilingualUrls = (urls) =>
1136
+ urls.flatMap((url) => Object.values(getMultilingualUrls(url)));
1137
+
1138
+ const robots = () => ({
1139
+ rules: {
1140
+ userAgent: "*",
1141
+ allow: ["/"],
1142
+ disallow: getAllMultilingualUrls(["/login", "/register"]),
1143
+ },
1144
+ host: "https://example.com",
1145
+ sitemap: `https://example.com/sitemap.xml`,
1146
+ });
1147
+
1148
+ module.exports = robots;
1149
+ ```
1150
+
1151
+ > Site haritası optimizasyonu hakkında daha fazla bilgi için [resmi Next.js dokümantasyonuna](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap) bakabilirsiniz. robots.txt optimizasyonu hakkında daha fazla bilgi için [resmi Next.js dokümantasyonuna](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/robots) göz atabilirsiniz.
1152
+
1153
+ ### (İsteğe Bağlı) Adım 10: İçeriğinizin Dilini Değiştirme
1154
+
1155
+ Next.js'te içeriğinizin dilini değiştirmek için önerilen yöntem, kullanıcıları uygun yerelleştirilmiş sayfaya yönlendirmek amacıyla `Link` bileşenini kullanmaktır. `Link` bileşeni, sayfanın önceden yüklenmesini (prefetch) sağlar, bu da tam sayfa yeniden yüklemesini önlemeye yardımcı olur.
1156
+
1157
+ ```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat="typescript"
1158
+ "use client";
1159
+
1160
+ import type { FC } from "react";
1161
+ import {
1162
+ Locales,
1163
+ getHTMLTextDir,
1164
+ getLocaleName,
1165
+ getLocalizedUrl,
1166
+ } from "intlayer";
1167
+ import { useLocale } from "next-intlayer";
1168
+ import Link from "next/link";
1169
+
1170
+ export const LocaleSwitcher: FC = () => {
1171
+ const { locale, pathWithoutLocale, availableLocales, setLocale } =
1172
+ useLocale();
1173
+
1174
+ return (
1175
+ <div>
1176
+ <button popoverTarget="localePopover">{getLocaleName(locale)}</button>
1177
+ <div id="localePopover" popover="auto">
1178
+ {availableLocales.map((localeItem) => (
1179
+ <Link
1180
+ href={getLocalizedUrl(pathWithoutLocale, localeItem)}
1181
+ key={localeItem}
1182
+ aria-current={locale === localeItem ? "page" : undefined}
1183
+ onClick={() => setLocale(localeItem)}
1184
+ replace // "Geri git" tarayıcı düğmesinin önceki sayfaya yönlendirmesini sağlar
1185
+ >
1186
+ <span>
1187
+ {/* Yerel Ayar - örn. FR */}
1188
+ {localeItem}
1189
+ </span>
1190
+ <span>
1191
+ {/* Dil kendi Yerel Ayarında - örn. Français */}
1192
+ {getLocaleName(localeItem, locale)}
1193
+ </span>
1194
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
1195
+ {/* Dil mevcut Yerel Ayarda - örn. Locales.SPANISH olarak ayarlanmış mevcut yerel ayarla Francés */}
1196
+ {getLocaleName(localeItem)}
1197
+ </span>
1198
+ <span dir="ltr" lang={Locales.ENGLISH}>
1199
+ {/* İngilizce dilinde - örn. French */}
1200
+ {getLocaleName(localeItem, Locales.ENGLISH)}
1201
+ </span>
1202
+ </Link>
1203
+ ))}
1204
+ </div>
1205
+ </div>
1206
+ );
1207
+ };
1208
+ ```
1209
+
1210
+ ```jsx fileName="src/components/LocaleSwitcher.msx" codeFormat="esm"
1211
+ "use client";
1212
+
1213
+ import {
1214
+ Locales,
1215
+ getHTMLTextDir,
1216
+ getLocaleName,
1217
+ getLocalizedUrl,
1218
+ } from "intlayer";
1219
+ import { useLocale } from "next-intlayer";
1220
+ import Link from "next/link";
1221
+
1222
+ export const LocaleSwitcher = () => {
1223
+ const { locale, pathWithoutLocale, availableLocales, setLocale } =
1224
+ useLocale();
1225
+
1226
+ return (
1227
+ <div>
1228
+ <button popoverTarget="localePopover">{getLocaleName(locale)}</button>
1229
+ <div id="localePopover" popover="auto">
1230
+ {availableLocales.map((localeItem) => (
1231
+ <Link
1232
+ href={getLocalizedUrl(pathWithoutLocale, localeItem)}
1233
+ key={localeItem}
1234
+ aria-current={locale === localeItem ? "page" : undefined}
1235
+ onClick={() => setLocale(localeItem)}
1236
+ replace // "geri git" tarayıcı düğmesinin önceki sayfaya yönlendirmesini sağlar
1237
+ >
1238
+ <span>
1239
+ {/* Yerel - örn. FR */}
1240
+ {localeItem}
1241
+ </span>
1242
+ <span>
1243
+ {/* Dil kendi yerelinde - örn. Français */}
1244
+ {getLocaleName(localeItem, locale)}
1245
+ </span>
1246
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
1247
+ {/* Mevcut yerelde dil - örn. Locales.SPANISH olarak ayarlanmış mevcut yerelle Francés */}
1248
+ {getLocaleName(localeItem)}
1249
+ </span>
1250
+ <span dir="ltr" lang={Locales.ENGLISH}>
1251
+ {/* İngilizce dil - örn. French */}
1252
+ {getLocaleName(localeItem, Locales.ENGLISH)}
1253
+ </span>
1254
+ </Link>
1255
+ ))}
1256
+ </div>
1257
+ </div>
1258
+ );
1259
+ };
1260
+ ```
1261
+
1262
+ ```jsx fileName="src/components/LocaleSwitcher.csx" codeFormat="commonjs"
1263
+ "use client";
1264
+
1265
+ const {
1266
+ Locales,
1267
+ getHTMLTextDir,
1268
+ getLocaleName,
1269
+ getLocalizedUrl,
1270
+ } = require("intlayer");
1271
+ const { useLocale } = require("next-intlayer");
1272
+ const Link = require("next/link");
1273
+
1274
+ export const LocaleSwitcher = () => {
1275
+ const { locale, pathWithoutLocale, availableLocales, setLocale } =
1276
+ useLocale();
1277
+
1278
+ return (
1279
+ <div>
1280
+ <button popoverTarget="localePopover">{getLocaleName(locale)}</button>
1281
+ <div id="localePopover" popover="auto">
1282
+ {availableLocales.map((localeItem) => (
1283
+ <Link
1284
+ href={getLocalizedUrl(pathWithoutLocale, localeItem)}
1285
+ key={localeItem}
1286
+ aria-current={locale === localeItem ? "sayfa" : undefined}
1287
+ onClick={() => setLocale(localeItem)}
1288
+ replace // "Geri dön" tarayıcı düğmesinin önceki sayfaya yönlendirmesini sağlar
1289
+ >
1290
+ <span>
1291
+ {/* Yerel - örn. FR */}
1292
+ {localeItem}
1293
+ </span>
1294
+ <span>
1295
+ {/* Dil kendi yerelinde - örn. Français */}
1296
+ {getLocaleName(localeItem, locale)}
1297
+ </span>
1298
+ <span dir={getHTMLTextDir(localeItem)} lang={localeItem}>
1299
+ {/* Mevcut yerelde dil - örn. Locales.SPANISH olarak ayarlanmış mevcut yerel ile Francés */}
1300
+ {getLocaleName(localeItem)}
1301
+ </span>
1302
+ <span dir="ltr" lang={Locales.ENGLISH}>
1303
+ {/* İngilizce dilinde - örn. French */}
1304
+ {getLocaleName(localeItem, Locales.ENGLISH)}
1305
+ </span>
1306
+ </Link>
1307
+ ))}
1308
+ </div>
1309
+ </div>
1310
+ );
1311
+ };
1312
+ ```
1313
+
1314
+ > Alternatif bir yöntem, `useLocale` kancasının sağladığı `setLocale` fonksiyonunu kullanmaktır. Bu fonksiyon sayfanın önceden getirilmesine (prefetch) izin vermez. Daha fazla detay için [`useLocale` kancası dokümantasyonuna](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/useLocale.md) bakabilirsiniz.
1315
+
1316
+ > Ayrıca, `onLocaleChange` seçeneğinde, dil değiştiğinde özel bir fonksiyon tetiklemek için bir fonksiyon ayarlayabilirsiniz.
1317
+
1318
+ ```tsx fileName="src/components/LocaleSwitcher.tsx"
1319
+ "use client";
1320
+
1321
+ import { useRouter } from "next/navigation";
1322
+ import { useLocale } from "next-intlayer";
1323
+ import { getLocalizedUrl } from "intlayer";
1324
+
1325
+ // ... Kodun geri kalanı
1326
+
1327
+ const router = useRouter();
1328
+ const { setLocale } = useLocale({
1329
+ onLocaleChange: (locale) => {
1330
+ router.push(getLocalizedUrl(pathWithoutLocale, locale));
1331
+ },
1332
+ });
1333
+
1334
+ return (
1335
+ <button onClick={() => setLocale(Locales.FRENCH)}>Fransızcaya Geç</button>
1336
+ );
1337
+ ```
1338
+
1339
+ > Dokümantasyon referansları:
1340
+ >
1341
+ > - [`useLocale` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/next-intlayer/useLocale.md)
1342
+ > - [`getLocaleName` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/intlayer/getLocaleName.md)
1343
+ > - [`getLocalizedUrl` hook](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/intlayer/getLocalizedUrl.md)
1344
+ > - [`getHTMLTextDir` kancası](https://github.com/aymericzip/intlayer/blob/main/docs/docs/tr/packages/intlayer/getHTMLTextDir.md)
1345
+ > - [`hrefLang` özniteliği](https://developers.google.com/search/docs/specialty/international/localized-versions?hl=fr)
1346
+ > - [`lang` özniteliği](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)
1347
+ > - [`dir` özniteliği](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir)
1348
+ > - [`aria-current` özniteliği](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current)
1349
+
1350
+ ### (İsteğe Bağlı) Adım 11: Yerelleştirilmiş Bir Link Bileşeni Oluşturma
1351
+
1352
+ Uygulamanızın navigasyonunun mevcut yerel ayara uygun olmasını sağlamak için özel bir `Link` bileşeni oluşturabilirsiniz. Bu bileşen, dahili URL'lerin önüne otomatik olarak mevcut dili ekler. Örneğin, Fransızca konuşan bir kullanıcı "Hakkında" sayfasına tıkladığında, `/about` yerine `/fr/about` adresine yönlendirilir.
1353
+
1354
+ Bu davranış birkaç nedenle faydalıdır:
1355
+
1356
+ - **SEO ve Kullanıcı Deneyimi**: Yerelleştirilmiş URL'ler, arama motorlarının dil bazlı sayfaları doğru şekilde indekslemesine yardımcı olur ve kullanıcılara tercih ettikleri dilde içerik sunar.
1357
+ - **Tutarlılık**: Uygulamanızda yerelleştirilmiş linkler kullanarak, navigasyonun mevcut yerel ayar içinde kalmasını garanti eder, beklenmedik dil değişimlerini önlersiniz.
1358
+ - **Bakım Kolaylığı**: Yerelleştirme mantığını tek bir bileşende merkezileştirmek, URL yönetimini basitleştirir ve uygulamanız büyüdükçe kod tabanınızı daha kolay bakım yapılabilir ve genişletilebilir hale getirir.
1359
+
1360
+ Aşağıda TypeScript ile yerelleştirilmiş bir `Link` bileşeninin uygulanması bulunmaktadır:
1361
+
1362
+ ```tsx fileName="src/components/Link.tsx" codeFormat="typescript"
1363
+ "use client";
1364
+
1365
+ import { getLocalizedUrl } from "intlayer";
1366
+ import NextLink, { type LinkProps as NextLinkProps } from "next/link";
1367
+ import { useLocale } from "next-intlayer";
1368
+ import type { PropsWithChildren, FC } from "react";
1369
+
1370
+ /**
1371
+ * Verilen URL'nin harici olup olmadığını kontrol eden yardımcı fonksiyon.
1372
+ * URL http:// veya https:// ile başlıyorsa, harici olarak kabul edilir.
1373
+ */
1374
+ export const checkIsExternalLink = (href?: string): boolean =>
1375
+ /^https?:\/\//.test(href ?? "");
1376
+
1377
+ /**
1378
+ * Mevcut yerel ayara göre href özniteliğini uyarlayan özel bir Link bileşeni.
1379
+ * Dahili bağlantılar için, URL'nin önüne yerel ayarı eklemek üzere `getLocalizedUrl` kullanılır (örneğin, /fr/about).
1380
+ * Bu, gezinmenin aynı yerel bağlam içinde kalmasını sağlar.
1381
+ */
1382
+ export const Link: FC<PropsWithChildren<NextLinkProps>> = ({
1383
+ href,
1384
+ children,
1385
+ ...props
1386
+ }) => {
1387
+ const { locale } = useLocale();
1388
+ const isExternalLink = checkIsExternalLink(href.toString());
1389
+
1390
+ // Bağlantı dahili ve geçerli bir href sağlanmışsa, yerelleştirilmiş URL alınır.
1391
+ const hrefI18n: NextLinkProps["href"] =
1392
+ href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
1393
+
1394
+ return (
1395
+ <NextLink href={hrefI18n} {...props}>
1396
+ {children}
1397
+ </NextLink>
1398
+ );
1399
+ };
1400
+ ```
1401
+
1402
+ ```jsx fileName="src/components/Link.mjx" codeFormat="esm"
1403
+ "use client";
1404
+
1405
+ import { getLocalizedUrl } from "intlayer";
1406
+ import NextLink from "next/link";
1407
+ import { useLocale } from "next-intlayer";
1408
+
1409
+ /**
1410
+ * Verilen URL'nin harici olup olmadığını kontrol eden yardımcı fonksiyon.
1411
+ * URL http:// veya https:// ile başlıyorsa, harici olarak kabul edilir.
1412
+ */
1413
+ export const checkIsExternalLink = (href) => /^https?:\/\//.test(href ?? "");
1414
+
1415
+ /**
1416
+ * Geçerli yerel ayara göre href özniteliğini uyarlayan özel Link bileşeni.
1417
+ * Dahili bağlantılar için, URL'yi yerel ek ile öneklemek üzere `getLocalizedUrl` kullanılır (örneğin, /fr/about).
1418
+ * Bu, gezinmenin aynı yerel bağlam içinde kalmasını sağlar.
1419
+ */
1420
+ export const Link = ({ href, children, ...props }) => {
1421
+ const { locale } = useLocale();
1422
+ const isExternalLink = checkIsExternalLink(href.toString());
1423
+
1424
+ // Bağlantı dahiliyse ve geçerli bir href sağlanmışsa, yerelleştirilmiş URL alınır.
1425
+ const hrefI18n =
1426
+ href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
1427
+
1428
+ return (
1429
+ <NextLink href={hrefI18n} {...props}>
1430
+ {children}
1431
+ </NextLink>
1432
+ );
1433
+ };
1434
+ ```
1435
+
1436
+ ```jsx fileName="src/components/Link.csx" codeFormat="commonjs"
1437
+ "use client";
1438
+
1439
+ const { getLocalizedUrl } = require("intlayer");
1440
+ const NextLink = require("next/link");
1441
+ const { useLocale } = require("next-intlayer");
1442
+
1443
+ /**
1444
+ * Verilen URL'nin harici olup olmadığını kontrol eden yardımcı fonksiyon.
1445
+ * URL http:// veya https:// ile başlıyorsa, harici kabul edilir.
1446
+ */
1447
+ const checkIsExternalLink = (href) => /^https?:\/\//.test(href ?? "");
1448
+
1449
+ /**
1450
+ * Mevcut yerel ayara göre href özniteliğini uyarlayan özel bir Link bileşeni.
1451
+ * Dahili bağlantılar için, URL'yi yerel ayar ile öneklemek amacıyla `getLocalizedUrl` kullanılır (örneğin, /fr/about).
1452
+ * Bu, gezinmenin aynı yerel bağlam içinde kalmasını sağlar.
1453
+ */
1454
+ const Link = ({ href, children, ...props }) => {
1455
+ const { locale } = useLocale();
1456
+ const isExternalLink = checkIsExternalLink(href.toString());
1457
+
1458
+ // Bağlantı dahili ve geçerli bir href sağlanmışsa, yerelleştirilmiş URL'yi al.
1459
+ const hrefI18n =
1460
+ href && !isExternalLink ? getLocalizedUrl(href.toString(), locale) : href;
1461
+
1462
+ return (
1463
+ <NextLink href={hrefI18n} {...props}>
1464
+ {children}
1465
+ </NextLink>
1466
+ );
1467
+ };
1468
+ ```
1469
+
1470
+ #### Nasıl Çalışır
1471
+
1472
+ - **Harici Bağlantıları Tespit Etme**:
1473
+ Yardımcı fonksiyon `checkIsExternalLink`, bir URL'nin harici olup olmadığını belirler. Harici bağlantılar, yerelleştirmeye gerek olmadığı için değiştirilmeden bırakılır.
1474
+
1475
+ - **Geçerli Yerel Ayarın Alınması**:
1476
+ `useLocale` kancası, geçerli yerel ayarı sağlar (örneğin, Fransızca için `fr`).
1477
+
1478
+ - **URL'nin Yerelleştirilmesi**:
1479
+ Dahili bağlantılar (yani harici olmayanlar) için, `getLocalizedUrl` URL'yi otomatik olarak geçerli yerel ayarla ön ekler. Bu, kullanıcınız Fransızca ise, `href` olarak `/about` verilirse bunun `/fr/about` olarak dönüşeceği anlamına gelir.
1480
+
1481
+ - **Bağlantının Döndürülmesi**:
1482
+ Bileşen, yerelleştirilmiş URL ile bir `<a>` öğesi döndürür ve böylece gezinmenin yerel ayarla tutarlı olmasını sağlar.
1483
+
1484
+ Bu `Link` bileşenini uygulamanızın tamamında entegre ederek, tutarlı ve dil farkındalığı olan bir kullanıcı deneyimi sağlarken aynı zamanda geliştirilmiş SEO ve kullanılabilirlikten de faydalanırsınız.
1485
+
1486
+ ### (İsteğe Bağlı) Adım 12: Sunucu Eylemlerinde (Server Actions) geçerli yerel ayarı (locale) alın
1487
+
1488
+ Eğer bir Sunucu Eylemi içinde aktif yerel ayara ihtiyacınız varsa (örneğin, e-postaları yerelleştirmek veya yerel ayara duyarlı mantık çalıştırmak için), `next-intlayer/server`'dan `getLocale` fonksiyonunu çağırın:
1489
+
1490
+ ```tsx fileName="src/app/actions/getLocale.ts" codeFormat="typescript"
1491
+ "use server";
1492
+
1493
+ import { getLocale } from "next-intlayer/server";
1494
+
1495
+ export const myServerAction = async () => {
1496
+ const locale = await getLocale();
1497
+
1498
+ // Yerel ayar ile bir şeyler yap
1499
+ };
1500
+ ```
1501
+
1502
+ > `getLocale` fonksiyonu, kullanıcının yerel ayarını belirlemek için kademeli (cascading) bir strateji izler:
1503
+ >
1504
+ > 1. İlk olarak, proxy tarafından ayarlanmış olabilecek bir yerel değer için istek başlıklarını kontrol eder
1505
+ > 2. Başlıklarda yerel bulunamazsa, çerezlerde saklanan bir yerel arar
1506
+ > 3. Çerez bulunamazsa, kullanıcının tercih ettiği dili tarayıcı ayarlarından tespit etmeye çalışır
1507
+ > 4. Son çare olarak, uygulamanın yapılandırılmış varsayılan yereline geri döner
1508
+ >
1509
+ > Bu, mevcut bağlama göre en uygun yerelin seçilmesini sağlar.
1510
+
1511
+ ### (İsteğe Bağlı) Adım 13: Paket boyutunuzu optimize edin
1512
+
1513
+ `next-intlayer` kullanıldığında, sözlükler varsayılan olarak her sayfanın paketine dahil edilir. Paket boyutunu optimize etmek için, Intlayer, `useIntlayer` çağrılarını makrolar kullanarak akıllıca değiştiren isteğe bağlı bir SWC eklentisi sağlar. Bu, sözlüklerin yalnızca gerçekten kullanan sayfaların paketlerine dahil edilmesini garanti eder.
1514
+
1515
+ Bu optimizasyonu etkinleştirmek için `@intlayer/swc` paketini yükleyin. Yüklendikten sonra, `next-intlayer` eklentiyi otomatik olarak algılar ve kullanır:
1516
+
1517
+ ```bash packageManager="npm"
1518
+ npm install @intlayer/swc --save-dev
1519
+ ```
1520
+
1521
+ ```bash packageManager="pnpm"
1522
+ pnpm add @intlayer/swc --save-dev
1523
+ ```
1524
+
1525
+ ```bash packageManager="yarn"
1526
+ yarn add @intlayer/swc --save-dev
1527
+ ```
1528
+
1529
+ > Not: Bu optimizasyon yalnızca Next.js 13 ve üzeri sürümler için kullanılabilir.
1530
+
1531
+ > Not: Bu paket varsayılan olarak kurulmaz çünkü SWC eklentileri Next.js üzerinde hâlâ deneysel durumdadır. Gelecekte değişebilir.
1532
+
1533
+ ### Turbopack üzerinde sözlük değişikliklerini izleme
1534
+
1535
+ `next dev` komutuyla geliştirme sunucusu olarak Turbopack kullanıldığında, sözlük değişiklikleri varsayılan olarak otomatik algılanmaz.
1536
+
1537
+ Bu kısıtlama, Turbopack'in içerik dosyalarınızdaki değişiklikleri izlemek için webpack eklentilerini paralel olarak çalıştıramamasından kaynaklanır. Bunun üstesinden gelmek için, geliştirme sunucusunu ve Intlayer derleme izleyicisini aynı anda çalıştırmak üzere `intlayer watch` komutunu kullanmanız gerekir.
1538
+
1539
+ ```json5 fileName="package.json"
1540
+ {
1541
+ // ... Mevcut package.json yapılandırmalarınız
1542
+ "scripts": {
1543
+ // ... Mevcut script yapılandırmalarınız
1544
+ "dev": "intlayer watch --with 'next dev'",
1545
+ },
1546
+ }
1547
+ ```
1548
+
1549
+ > 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ı korumanız gerekir. Bu sınırlamadan kaçınmak için next-intlayer@>=7.x.x kullanmanızı öneririz.
1550
+
1551
+ ### TypeScript'i Yapılandırma
1552
+
1553
+ 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.
1554
+
1555
+ ![Otomatik Tamamlama](https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true)
1556
+
1557
+ ![Çeviri Hatası](https://github.com/aymericzip/intlayer/blob/main/docs/assets/translation_error.png?raw=true)
1558
+
1559
+ TypeScript yapılandırmanızın otomatik oluşturulan türleri içerdiğinden emin olun.
1560
+
1561
+ ```json5 fileName="tsconfig.json"
1562
+ {
1563
+ // ... Mevcut TypeScript yapılandırmalarınız
1564
+ "include": [
1565
+ // ... Mevcut TypeScript yapılandırmalarınız
1566
+ ".intlayer/**/*.ts", // Otomatik oluşturulan türleri dahil et
1567
+ ],
1568
+ }
1569
+ ```
1570
+
1571
+ ### Git Yapılandırması
1572
+
1573
+ Intlayer tarafından oluşturulan dosyaların göz ardı edilmesi önerilir. Bu, bu dosyaların Git deposuna eklenmesini önlemenize olanak tanır.
1574
+
1575
+ Bunu yapmak için, `.gitignore` dosyanıza aşağıdaki talimatları ekleyebilirsiniz:
1576
+
1577
+ ```plaintext fileName=".gitignore"
1578
+ # Intlayer tarafından oluşturulan dosyaları göz ardı et
1579
+ .intlayer
1580
+ ```
1581
+
1582
+ ### VS Code Eklentisi
1583
+
1584
+ Intlayer ile geliştirme deneyiminizi iyileştirmek için resmi **Intlayer VS Code Eklentisi**ni yükleyebilirsiniz.
1585
+
1586
+ [VS Code Marketplace'ten Yükleyin](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
1587
+
1588
+ Bu eklenti şunları sağlar:
1589
+
1590
+ - Çeviri anahtarları için **Otomatik Tamamlama**.
1591
+ - Eksik çeviriler için **Gerçek Zamanlı Hata Tespiti**.
1592
+ - Çevrilmiş içeriğin **satır içi önizlemeleri**.
1593
+ - Çevirileri kolayca oluşturmak ve güncellemek için **hızlı işlemler**.
1594
+
1595
+ 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.
1596
+
1597
+ ### Daha İleri Gitmek
1598
+
1599
+ 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.