@intlayer/docs 7.1.0 → 7.1.1-canary.1
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/internationalization_and_SEO.md +0 -4
- package/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +2 -2
- package/blog/de/internationalization_and_SEO.md +0 -2
- package/blog/en/internationalization_and_SEO.md +0 -2
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +2 -2
- package/blog/en-GB/internationalization_and_SEO.md +0 -2
- package/blog/es/internationalization_and_SEO.md +0 -4
- package/blog/fr/internationalization_and_SEO.md +0 -2
- package/blog/hi/internationalization_and_SEO.md +0 -2
- package/blog/id/next-i18next_vs_next-intl_vs_intlayer.md +2 -2
- package/blog/it/internationalization_and_SEO.md +0 -2
- package/blog/ja/internationalization_and_SEO.md +0 -2
- package/blog/ko/internationalization_and_SEO.md +0 -2
- package/blog/pl/next-i18next_vs_next-intl_vs_intlayer.md +2 -2
- package/blog/pt/internationalization_and_SEO.md +0 -4
- package/blog/ru/internationalization_and_SEO.md +0 -4
- package/blog/vi/next-i18next_vs_next-intl_vs_intlayer.md +2 -2
- package/blog/zh/internationalization_and_SEO.md +0 -4
- package/docs/ar/intlayer_with_nextjs_14.md +9 -9
- package/docs/ar/intlayer_with_nextjs_15.md +9 -8
- package/docs/ar/intlayer_with_nextjs_16.md +2 -56
- package/docs/ar/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/ar/intlayer_with_react_router_v7.md +6 -6
- package/docs/ar/intlayer_with_tanstack.md +46 -31
- package/docs/ar/intlayer_with_vite+preact.md +7 -7
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/de/intlayer_with_nextjs_14.md +9 -9
- package/docs/de/intlayer_with_nextjs_15.md +9 -8
- package/docs/de/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/de/intlayer_with_react_router_v7.md +6 -6
- package/docs/de/intlayer_with_tanstack.md +46 -31
- package/docs/de/intlayer_with_vite+preact.md +7 -7
- package/docs/de/intlayer_with_vite+react.md +7 -7
- package/docs/de/intlayer_with_vite+vue.md +9 -9
- package/docs/en/interest_of_intlayer.md +1 -1
- package/docs/en/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/en/intlayer_with_react_router_v7.md +6 -6
- package/docs/en/intlayer_with_tanstack.md +57 -33
- package/docs/en/intlayer_with_vite+preact.md +8 -8
- package/docs/en/intlayer_with_vite+react.md +8 -8
- package/docs/en/intlayer_with_vite+vue.md +8 -8
- package/docs/en/releases/v6.md +1 -1
- package/docs/en-GB/intlayer_with_nextjs_14.md +9 -9
- package/docs/en-GB/intlayer_with_nextjs_15.md +9 -8
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/en-GB/intlayer_with_react_router_v7.md +6 -6
- package/docs/en-GB/intlayer_with_tanstack.md +46 -31
- package/docs/en-GB/intlayer_with_vite+preact.md +7 -7
- package/docs/en-GB/intlayer_with_vite+react.md +7 -7
- package/docs/en-GB/intlayer_with_vite+vue.md +9 -9
- package/docs/es/intlayer_with_nextjs_14.md +9 -9
- package/docs/es/intlayer_with_nextjs_15.md +9 -8
- package/docs/es/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/es/intlayer_with_react_router_v7.md +6 -6
- package/docs/es/intlayer_with_tanstack.md +15 -10
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/intlayer_with_nextjs_14.md +9 -9
- package/docs/fr/intlayer_with_nextjs_15.md +9 -8
- package/docs/fr/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/fr/intlayer_with_react_router_v7.md +6 -6
- package/docs/fr/intlayer_with_tanstack.md +46 -31
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/hi/intlayer_with_nextjs_14.md +9 -9
- package/docs/hi/intlayer_with_nextjs_15.md +9 -8
- package/docs/hi/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/hi/intlayer_with_react_router_v7.md +6 -6
- package/docs/hi/intlayer_with_tanstack.md +15 -10
- package/docs/hi/intlayer_with_vite+preact.md +7 -7
- package/docs/hi/intlayer_with_vite+react.md +7 -7
- package/docs/hi/intlayer_with_vite+vue.md +9 -9
- package/docs/id/interest_of_intlayer.md +1 -1
- package/docs/id/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/id/intlayer_with_react_router_v7.md +6 -6
- package/docs/id/intlayer_with_tanstack.md +15 -10
- package/docs/id/intlayer_with_vite+preact.md +9 -9
- package/docs/id/intlayer_with_vite+react.md +8 -8
- package/docs/id/intlayer_with_vite+vue.md +8 -8
- package/docs/id/releases/v6.md +1 -1
- package/docs/it/intlayer_with_nextjs_14.md +9 -9
- package/docs/it/intlayer_with_nextjs_15.md +9 -8
- package/docs/it/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/it/intlayer_with_react_router_v7.md +6 -6
- package/docs/it/intlayer_with_tanstack.md +46 -31
- package/docs/it/intlayer_with_vite+preact.md +7 -7
- package/docs/it/intlayer_with_vite+react.md +7 -7
- package/docs/it/intlayer_with_vite+vue.md +9 -9
- package/docs/ja/intlayer_with_nextjs_14.md +9 -9
- package/docs/ja/intlayer_with_nextjs_15.md +9 -8
- package/docs/ja/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/ja/intlayer_with_react_router_v7.md +6 -6
- package/docs/ja/intlayer_with_tanstack.md +16 -10
- package/docs/ja/intlayer_with_vite+preact.md +7 -7
- package/docs/ja/intlayer_with_vite+react.md +7 -7
- package/docs/ja/intlayer_with_vite+vue.md +9 -9
- package/docs/ko/intlayer_with_nextjs_14.md +9 -9
- package/docs/ko/intlayer_with_nextjs_15.md +9 -8
- package/docs/ko/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/ko/intlayer_with_react_router_v7.md +6 -6
- package/docs/ko/intlayer_with_tanstack.md +46 -31
- package/docs/ko/intlayer_with_vite+preact.md +7 -7
- package/docs/ko/intlayer_with_vite+react.md +7 -7
- package/docs/ko/intlayer_with_vite+vue.md +9 -9
- package/docs/pl/interest_of_intlayer.md +1 -1
- package/docs/pl/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/pl/intlayer_with_react_router_v7.md +6 -6
- package/docs/pl/intlayer_with_tanstack.md +15 -10
- package/docs/pl/intlayer_with_vite+preact.md +10 -10
- package/docs/pl/intlayer_with_vite+react.md +8 -8
- package/docs/pl/intlayer_with_vite+vue.md +8 -8
- package/docs/pl/releases/v6.md +1 -1
- package/docs/pt/intlayer_with_nextjs_14.md +9 -9
- package/docs/pt/intlayer_with_nextjs_15.md +9 -8
- package/docs/pt/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/pt/intlayer_with_react_router_v7.md +2 -2
- package/docs/pt/intlayer_with_tanstack.md +46 -31
- package/docs/pt/intlayer_with_vite+preact.md +7 -7
- package/docs/pt/intlayer_with_vite+react.md +7 -7
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/ru/intlayer_with_nextjs_14.md +9 -9
- package/docs/ru/intlayer_with_nextjs_15.md +9 -8
- package/docs/ru/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/ru/intlayer_with_react_router_v7.md +6 -6
- package/docs/ru/intlayer_with_tanstack.md +15 -10
- package/docs/ru/intlayer_with_vite+preact.md +7 -7
- package/docs/ru/intlayer_with_vite+react.md +7 -7
- package/docs/ru/intlayer_with_vite+vue.md +9 -9
- package/docs/tr/interest_of_intlayer.md +1 -1
- package/docs/tr/intlayer_with_nextjs_15.md +9 -8
- package/docs/tr/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/tr/intlayer_with_react_router_v7.md +6 -6
- package/docs/tr/intlayer_with_tanstack.md +46 -31
- package/docs/tr/intlayer_with_vite+preact.md +8 -8
- package/docs/tr/intlayer_with_vite+react.md +8 -8
- package/docs/tr/intlayer_with_vite+vue.md +8 -8
- package/docs/vi/interest_of_intlayer.md +1 -1
- package/docs/vi/intlayer_with_nextjs_15.md +1 -0
- package/docs/vi/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/vi/intlayer_with_react_router_v7.md +6 -6
- package/docs/vi/intlayer_with_tanstack.md +46 -31
- package/docs/vi/intlayer_with_vite+preact.md +9 -9
- package/docs/vi/intlayer_with_vite+react.md +8 -8
- package/docs/vi/intlayer_with_vite+vue.md +8 -8
- package/docs/vi/releases/v6.md +1 -1
- package/docs/zh/intlayer_with_nextjs_14.md +9 -9
- package/docs/zh/intlayer_with_nextjs_15.md +9 -8
- package/docs/zh/intlayer_with_nextjs_page_router.md +7 -10
- package/docs/zh/intlayer_with_react_router_v7.md +6 -6
- package/docs/zh/intlayer_with_tanstack.md +14 -8
- package/docs/zh/intlayer_with_vite+preact.md +7 -7
- package/docs/zh/intlayer_with_vite+react.md +7 -7
- package/docs/zh/intlayer_with_vite+vue.md +7 -7
- package/frequent_questions/ar/domain_routing.md +1 -1
- package/frequent_questions/de/domain_routing.md +1 -1
- package/frequent_questions/en/domain_routing.md +1 -1
- package/frequent_questions/en/package_version_error.md +29 -1
- package/frequent_questions/en-GB/domain_routing.md +1 -1
- package/frequent_questions/es/domain_routing.md +1 -1
- package/frequent_questions/fr/domain_routing.md +1 -1
- package/frequent_questions/hi/domain_routing.md +1 -1
- package/frequent_questions/id/domain_routing.md +1 -1
- package/frequent_questions/it/domain_routing.md +1 -1
- package/frequent_questions/it/package_version_error.md +4 -4
- package/frequent_questions/ja/domain_routing.md +1 -1
- package/frequent_questions/ko/domain_routing.md +1 -1
- package/frequent_questions/pl/domain_routing.md +1 -1
- package/frequent_questions/pt/domain_routing.md +1 -1
- package/frequent_questions/ru/domain_routing.md +1 -1
- package/frequent_questions/tr/domain_routing.md +1 -1
- package/frequent_questions/vi/domain_routing.md +1 -1
- package/frequent_questions/zh/domain_routing.md +1 -1
- package/package.json +7 -14
|
@@ -35,13 +35,11 @@ slugs:
|
|
|
35
35
|
إذا قررت أن يكون لديك نسخ متعددة للغة، ستحتاج إلى وسيلة واضحة ومتسقة لتنظيم عناوين URL الخاصة بموقعك. يجب أن يكون لكل لغة (أو منطقة) "عنوان" فريد خاص بها على الإنترنت. وفيما يلي ثلاث طرق شائعة لهيكلة المواقع متعددة اللغات:
|
|
36
36
|
|
|
37
37
|
1. **نطاقات المستوى العلوي برمز الدولة (ccTLDs)**
|
|
38
|
-
|
|
39
38
|
- مثال: `example.fr`، `example.de`
|
|
40
39
|
- **الإيجابيات:** ترسل إشارة قوية إلى محركات البحث حول البلد الذي يستهدفه المحتوى (مثل: `.fr` = فرنسا).
|
|
41
40
|
- **السلبيات:** إدارة مجالات متعددة قد تكون أكثر تكلفة وتعقيدًا.
|
|
42
41
|
|
|
43
42
|
2. **النطاقات الفرعية**
|
|
44
|
-
|
|
45
43
|
- **مثال:** `fr.example.com`، `de.example.com`
|
|
46
44
|
- **الإيجابيات:** كل لغة "تعيش" على نطاق فرعي خاص بها، مما يجعل من السهل نسبيًا إضافة أو إزالة اللغات.
|
|
47
45
|
- **السلبيات:** أحيانًا تعالج محركات البحث النطاقات الفرعية كمواقع منفصلة، لذلك يمكن أن تُخفف من سلطة النطاق الرئيسي.
|
|
@@ -111,7 +109,6 @@ slugs:
|
|
|
111
109
|
- **التوطين** يعني تكييف تنسيق المحتوى، والعملة، والقياسات، والمراجع الثقافية لجمهور محلي. على سبيل المثال، إذا كنت تستهدف فرنسا، ستستخدم `€` بدلاً من `You are an expert in internationalization and content management. Your task is to translate the following documentation into the specified locales.
|
|
112
110
|
|
|
113
111
|
1. **Requirement:**
|
|
114
|
-
|
|
115
112
|
- You should only translate the text, and titles of the file.
|
|
116
113
|
- You should not alter the structure of the file.
|
|
117
114
|
- You should not alter the code logic of code elements.
|
|
@@ -123,7 +120,6 @@ slugs:
|
|
|
123
120
|
- You should be sure to do not forgot to translate any content
|
|
124
121
|
|
|
125
122
|
2. **Locales:**
|
|
126
|
-
|
|
127
123
|
- Base file locale: en: English (US)
|
|
128
124
|
- Desired Locales: {{locale}} : {{localeName}}
|
|
129
125
|
|
|
@@ -1399,9 +1399,9 @@ export const config = {
|
|
|
1399
1399
|
Intlayer provides built-in middleware handling through the `next-intlayer` package configuration.
|
|
1400
1400
|
|
|
1401
1401
|
```ts fileName="src/middleware.ts"
|
|
1402
|
-
import {
|
|
1402
|
+
import { intlayerProxy } from "next-intlayer/proxy";
|
|
1403
1403
|
|
|
1404
|
-
export const middleware =
|
|
1404
|
+
export const middleware = intlayerProxy();
|
|
1405
1405
|
|
|
1406
1406
|
// applies this middleware only to files in the app directory
|
|
1407
1407
|
export const config = {
|
|
@@ -35,13 +35,11 @@ Wenn Sie dies richtig machen, schaffen Sie ein benutzerfreundlicheres Erlebnis f
|
|
|
35
35
|
Wenn Sie sich entscheiden, mehrere Sprachversionen zu haben, benötigen Sie einen klaren, konsistenten Weg, um die URLs Ihrer Website zu organisieren. Jede Sprache (oder Region) sollte ihre eigene einzigartige „Adresse“ im Internet haben. Im Folgenden finden Sie drei gängige Möglichkeiten, mehrsprachige Websites zu strukturieren:
|
|
36
36
|
|
|
37
37
|
1. Länderspezifische Top-Level-Domains (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- Beispiel: `example.fr`, `example.de`
|
|
40
39
|
- **Vorteile:** Sendet ein starkes Signal an Suchmaschinen, welches Land der Inhalt anspricht (z.B. `.fr` = Frankreich).
|
|
41
40
|
- **Nachteile:** Die Verwaltung mehrerer Domains kann teurer und komplizierter sein.
|
|
42
41
|
|
|
43
42
|
2. **Subdomains**
|
|
44
|
-
|
|
45
43
|
- **Beispiel:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Vorteile:** Jede Sprache „lebt“ auf ihrer eigenen Subdomain, was es relativ einfach macht, Sprachen hinzuzufügen oder zu entfernen.
|
|
47
45
|
- **Nachteile:** Suchmaschinen behandeln Subdomains manchmal als separate Seiten, was die Autorität Ihrer Hauptdomain verwässern kann.
|
|
@@ -35,13 +35,11 @@ When you do this right, you’ll create a far more user-friendly experience for
|
|
|
35
35
|
If you decide to have multiple language versions, you’ll need a clear, consistent way to organize your site’s URLs. Each language (or region) should have its own unique “address” on the internet. Below are three common ways to structure multilingual websites:
|
|
36
36
|
|
|
37
37
|
1. Country-Code Top-Level Domains (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- Example: `example.fr`, `example.de`
|
|
40
39
|
- **Pros:** Sends a strong signal to search engines about which country the content targets (e.g., `.fr` = France).
|
|
41
40
|
- **Cons:** Managing multiple domains can be more expensive and complicated.
|
|
42
41
|
|
|
43
42
|
2. **Subdomains**
|
|
44
|
-
|
|
45
43
|
- **Example:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Pros:** Each language “lives” on its own subdomain, making it relatively easy to add or remove languages.
|
|
47
45
|
- **Cons:** Search engines sometimes treat subdomains as separate sites, so it can dilute your main domain’s authority.
|
|
@@ -1396,9 +1396,9 @@ export const config = {
|
|
|
1396
1396
|
Intlayer provides built-in middleware handling through the `next-intlayer` package configuration.
|
|
1397
1397
|
|
|
1398
1398
|
```ts fileName="src/middleware.ts"
|
|
1399
|
-
import {
|
|
1399
|
+
import { intlayerProxy } from "next-intlayer/proxy";
|
|
1400
1400
|
|
|
1401
|
-
export const middleware =
|
|
1401
|
+
export const middleware = intlayerProxy();
|
|
1402
1402
|
|
|
1403
1403
|
// applies this middleware only to files in the app directory
|
|
1404
1404
|
export const config = {
|
|
@@ -35,13 +35,11 @@ When you do this right, you’ll create a far more user-friendly experience for
|
|
|
35
35
|
If you decide to have multiple language versions, you’ll need a clear, consistent way to organise your site’s URLs. Each language (or region) should have its own unique “address” on the internet. Below are three common ways to structure multilingual websites:
|
|
36
36
|
|
|
37
37
|
1. Country-Code Top-Level Domains (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- Example: `example.fr`, `example.de`
|
|
40
39
|
- **Pros:** Sends a strong signal to search engines about which country the content targets (e.g., `.fr` = France).
|
|
41
40
|
- **Cons:** Managing multiple domains can be more expensive and complicated.
|
|
42
41
|
|
|
43
42
|
2. **Subdomains**
|
|
44
|
-
|
|
45
43
|
- **Example:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Pros:** Each language “lives” on its own subdomain, making it relatively easy to add or remove languages.
|
|
47
45
|
- **Cons:** Search engines sometimes treat subdomains as separate sites, so it can dilute your main domain’s authority.
|
|
@@ -35,13 +35,11 @@ Cuando lo haces bien, crearás una experiencia mucho más amigable para los habl
|
|
|
35
35
|
Si decides tener varias versiones en idiomas, necesitarás una manera clara y consistente de organizar las URLs de tu sitio. Cada idioma (o región) debería tener su propia “dirección” única en internet. A continuación, se presentan tres formas comunes de estructurar sitios web multilingües:
|
|
36
36
|
|
|
37
37
|
1. Dominios de Nivel Superior de Código de País (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- Ejemplo: `example.fr`, `example.de`
|
|
40
39
|
- **Pros:** Envía una fuerte señal a los motores de búsqueda sobre a qué país está destinado el contenido (por ejemplo, `.fr` = Francia).
|
|
41
40
|
- **Contras:** Gestionar múltiples dominios puede ser más costoso y complicado.
|
|
42
41
|
|
|
43
42
|
2. **Subdominios**
|
|
44
|
-
|
|
45
43
|
- **Ejemplo:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Pros:** Cada idioma “vive” en su propio subdominio, lo que facilita agregar o eliminar idiomas.
|
|
47
45
|
- **Contras:** A veces, los motores de búsqueda tratan a los subdominios como sitios separados, lo que puede diluir la autoridad de tu dominio principal.
|
|
@@ -95,7 +93,6 @@ En tu HTML, agregarás algo como:
|
|
|
95
93
|
- **Localización** significa adaptar el formato del contenido, la moneda, las medidas y las referencias culturales para una audiencia local. Por ejemplo, si estás apuntando a Francia, usarías `€` en lugar de `You are an expert in internationalization and content management. Your task is to translate the following documentation into the specified locales.
|
|
96
94
|
|
|
97
95
|
1. **Requirement:**
|
|
98
|
-
|
|
99
96
|
- Solo debes traducir el texto y los títulos del archivo.
|
|
100
97
|
- No debes alterar la estructura del archivo.
|
|
101
98
|
- No debes alterar la lógica del código de los elementos de código.
|
|
@@ -107,7 +104,6 @@ En tu HTML, agregarás algo como:
|
|
|
107
104
|
- Debes asegurarte de no olvidar traducir ningún contenido
|
|
108
105
|
|
|
109
106
|
2. **Locales:**
|
|
110
|
-
|
|
111
107
|
- Archivo de base: en: Inglés (EE.UU.)
|
|
112
108
|
- Locales deseados: {{locale}} : {{localeName}}
|
|
113
109
|
|
|
@@ -35,13 +35,11 @@ Lorsque vous faites cela correctement, vous créerez une expérience beaucoup pl
|
|
|
35
35
|
Si vous décidez d'avoir plusieurs versions linguistiques, vous aurez besoin d'un moyen clair et cohérent d'organiser les URLs de votre site. Chaque langue (ou région) doit avoir sa propre "adresse" unique sur Internet. Voici trois manières courantes de structurer des sites Web multilingues :
|
|
36
36
|
|
|
37
37
|
1. Domaines de Premier Niveau par Code Pays (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- Exemple : `example.fr`, `example.de`
|
|
40
39
|
- **Avantages :** Envoie un signal fort aux moteurs de recherche quant à quel pays le contenu cible (par exemple, `.fr` = France).
|
|
41
40
|
- **Inconvénients :** Gérer plusieurs domaines peut être plus coûteux et compliqué.
|
|
42
41
|
|
|
43
42
|
2. **Sous-domaines**
|
|
44
|
-
|
|
45
43
|
- **Exemple :** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Avantages :** Chaque langue "vit" sur son propre sous-domaine, ce qui rend relativement facile d'ajouter ou de retirer des langues.
|
|
47
45
|
- **Inconvénients :** Les moteurs de recherche traitent parfois les sous-domaines comme des sites séparés, ce qui peut diluer l'autorité de votre domaine principal.
|
|
@@ -35,13 +35,11 @@ slugs:
|
|
|
35
35
|
यदि आप कई भाषा संस्करण रखने का निर्णय लेते हैं, तो आपको अपनी साइट के URLs को व्यवस्थित करने का एक स्पष्ट, सुसंगत तरीका चाहिए। प्रत्येक भाषा (या क्षेत्र) का इंटरनेट पर अपना अनूठा "पता" होना चाहिए। बहुभाषी वेबसाइटों की संरचना के लिए तीन सामान्य तरीके नीचे दिए गए हैं:
|
|
36
36
|
|
|
37
37
|
1. देश-कोड शीर्ष स्तर डोमेन (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- उदाहरण: `example.fr`, `example.de`
|
|
40
39
|
- **लाभ:** खोज इंजनों को यह स्पष्ट संकेत भेजता है कि सामग्री किस देश को लक्षित करती है (जैसे, `.fr` = फ्रांस)।
|
|
41
40
|
- **हानि:** कई डोमेन प्रबंधित करना महंगा और जटिल हो सकता है।
|
|
42
41
|
|
|
43
42
|
2. **सबडोमेन**
|
|
44
|
-
|
|
45
43
|
- **उदाहरण:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **लाभ:** प्रत्येक भाषा का "जीवन" अपने उपडोमेन पर होता है, जिससे भाषाएँ जोड़ना या हटाना अपेक्षाकृत आसान होता है।
|
|
47
45
|
- **हानि:** कभी-कभी खोज इंजन उपडोमेन को अलग साइटों के रूप में मानते हैं, इसलिए यह आपके मुख्य डोमेन की प्राधिकरण को कमजोर कर सकता है।
|
|
@@ -1398,9 +1398,9 @@ export const config = {
|
|
|
1398
1398
|
Intlayer menyediakan penanganan middleware bawaan melalui konfigurasi paket `next-intlayer`.
|
|
1399
1399
|
|
|
1400
1400
|
```ts fileName="src/middleware.ts"
|
|
1401
|
-
import {
|
|
1401
|
+
import { intlayerProxy } from "next-intlayer/proxy";
|
|
1402
1402
|
|
|
1403
|
-
export const middleware =
|
|
1403
|
+
export const middleware = intlayerProxy();
|
|
1404
1404
|
|
|
1405
1405
|
// menerapkan middleware ini hanya pada file di direktori app
|
|
1406
1406
|
export const config = {
|
|
@@ -35,13 +35,11 @@ Quando fai questo nel modo giusto, creerai un'esperienza molto più user-friendl
|
|
|
35
35
|
Se decidi di avere più versioni linguistiche, avrai bisogno di un modo chiaro e coerente per organizzare gli URL del tuo sito. Ogni lingua (o regione) dovrebbe avere il proprio “indirizzo” unico su Internet. Ecco tre modi comuni per strutturare siti web multilingue:
|
|
36
36
|
|
|
37
37
|
1. Domini di primo livello con codice paese (ccTLD)
|
|
38
|
-
|
|
39
38
|
- Esempio: `example.fr`, `example.de`
|
|
40
39
|
- **Pro:** Invia un forte segnale ai motori di ricerca riguardo a quale paese è destinato il contenuto (ad esempio, `.fr` = Francia).
|
|
41
40
|
- **Contro:** Gestire più domini può essere più costoso e complicato.
|
|
42
41
|
|
|
43
42
|
2. **Sottodomini**
|
|
44
|
-
|
|
45
43
|
- **Esempio:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Pro:** Ogni lingua “vive” su un proprio sottodominio, rendendo relativamente facile aggiungere o rimuovere lingue.
|
|
47
45
|
- **Contro:** A volte i motori di ricerca trattano i sottodomini come siti separati, quindi può diluire l'autorità del tuo dominio principale.
|
|
@@ -35,13 +35,11 @@ slugs:
|
|
|
35
35
|
複数の言語バージョンを持つことを決定した場合、サイトのURLを整理するための明確で一貫した方法が必要です。各言語(または地域)は、インターネット上で独自の「アドレス」を持つべきです。以下は、多言語ウェブサイトを構築するための一般的な3つの方法です。
|
|
36
36
|
|
|
37
37
|
1. 国別コードのトップレベルドメイン(ccTLD)
|
|
38
|
-
|
|
39
38
|
- 例: `example.fr`, `example.de`
|
|
40
39
|
- **利点:** コンテンツが対象としている国について検索エンジンに強い信号を送ります(例: `.fr` = フランス)。
|
|
41
40
|
- **欠点:** 複数のドメインを管理することは、より高価で複雑になる可能性があります。
|
|
42
41
|
|
|
43
42
|
2. **サブドメイン**
|
|
44
|
-
|
|
45
43
|
- **例:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **利点:** 各言語が独自のサブドメインに存在するため、言語を追加または削除するのが比較的簡単です。
|
|
47
45
|
- **欠点:** 検索エンジンはサブドメインを別のサイトとして扱うことがあり、メインドメインの権威を薄める可能性があります。
|
|
@@ -35,13 +35,11 @@ slugs:
|
|
|
35
35
|
여러 언어 버전을 만들기로 결정했다면, 사이트의 URL을 정리하는 명확하고 일관된 방법이 필요합니다. 각 언어(또는 지역)는 고유한 "주소"를 인터넷에서 가져야 합니다. 다국어 웹사이트를 구조화하는 세 가지 일반적인 방법은 다음과 같습니다:
|
|
36
36
|
|
|
37
37
|
1. 국가 코드 최상위 도메인 (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- 예: `example.fr`, `example.de`
|
|
40
39
|
- **장점:** 검색 엔진에 콘텐츠가 어떤 국가를 대상으로 하는지를 강하게 신호 보냅니다(예: `.fr` = 프랑스).
|
|
41
40
|
- **단점:** 여러 도메인을 관리하는 것은 더 비용이 들고 복잡할 수 있습니다.
|
|
42
41
|
|
|
43
42
|
2. **서브도메인**
|
|
44
|
-
|
|
45
43
|
- **예:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **장점:** 각 언어가 자신의 서브도메인에서 "존재"하므로 언어를 추가하거나 제거하기가 상대적으로 쉽습니다.
|
|
47
45
|
- **단점:** 검색 엔진이 때때로 서브도메인을 별도의 사이트로 처리하므로 주요 도메인의 권한을 희석할 수 있습니다.
|
|
@@ -1399,9 +1399,9 @@ export const config = {
|
|
|
1399
1399
|
Intlayer zapewnia wbudowane zarządzanie middleware za pomocą konfiguracji pakietu `next-intlayer`.
|
|
1400
1400
|
|
|
1401
1401
|
```ts fileName="src/middleware.ts"
|
|
1402
|
-
import {
|
|
1402
|
+
import { intlayerProxy } from "next-intlayer/proxy";
|
|
1403
1403
|
|
|
1404
|
-
export const middleware =
|
|
1404
|
+
export const middleware = intlayerProxy();
|
|
1405
1405
|
|
|
1406
1406
|
// stosuje ten middleware tylko do plików w katalogu app
|
|
1407
1407
|
export const config = {
|
|
@@ -35,13 +35,11 @@ Quando você faz isso corretamente, criará uma experiência muito mais amigáve
|
|
|
35
35
|
Se você decidir ter múltiplas versões de idioma, precisará de uma maneira clara e consistente de organizar as URLs do seu site. Cada idioma (ou região) deve ter seu próprio “endereço” único na internet. Abaixo estão três maneiras comuns de estruturar sites multilíngues:
|
|
36
36
|
|
|
37
37
|
1. Domínios de Nível Superior com Código de País (ccTLDs)
|
|
38
|
-
|
|
39
38
|
- Exemplo: `example.fr`, `example.de`
|
|
40
39
|
- **Prós:** Envia um sinal forte para os mecanismos de busca sobre qual país o conteúdo é direcionado (por exemplo, `.fr` = França).
|
|
41
40
|
- **Contras:** Gerenciar múltiplos domínios pode ser mais caro e complicado.
|
|
42
41
|
|
|
43
42
|
2. **Subdomínios**
|
|
44
|
-
|
|
45
43
|
- **Exemplo:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Prós:** Cada idioma “vive” em seu próprio subdomínio, tornando relativamente fácil adicionar ou remover idiomas.
|
|
47
45
|
- **Contras:** Os mecanismos de busca às vezes tratam subdomínios como sites separados, podendo diluir a autoridade do seu domínio principal.
|
|
@@ -111,7 +109,6 @@ No seu HTML, você adicionará algo como:
|
|
|
111
109
|
- **Localização** significa adaptar o formato do conteúdo, moeda, medidas e referências culturais para um público local. Por exemplo, se você está direcionando a França, você usaria `€` em vez de `You are an expert in internationalization and content management. Your task is to translate the following documentation into the specified locales.
|
|
112
110
|
|
|
113
111
|
1. **Requirement:**
|
|
114
|
-
|
|
115
112
|
- Você deve apenas traduzir o texto e os títulos do arquivo.
|
|
116
113
|
- Você não deve alterar a estrutura do arquivo.
|
|
117
114
|
- Você não deve alterar a lógica do código dos elementos de código.
|
|
@@ -123,7 +120,6 @@ No seu HTML, você adicionará algo como:
|
|
|
123
120
|
- Você deve se certificar de não esquecer de traduzir nenhum conteúdo
|
|
124
121
|
|
|
125
122
|
2. **Locales:**
|
|
126
|
-
|
|
127
123
|
- Arquivo de localização base: en: Inglês (EUA)
|
|
128
124
|
- Locales desejados: {{locale}} : {{localeName}}
|
|
129
125
|
|
|
@@ -35,13 +35,11 @@ slugs:
|
|
|
35
35
|
Если вы решите иметь несколько языковых версий, вам понадобится ясный и последовательный способ организации URL вашего сайта. У каждого языка (или региона) должен быть свой уникальный «адрес» в интернете. Ниже приведены три распространённых способа структурирования многоязычных веб-сайтов:
|
|
36
36
|
|
|
37
37
|
1. Доменные имена с кодом страны (ccTLD)
|
|
38
|
-
|
|
39
38
|
- Пример: `example.fr`, `example.de`
|
|
40
39
|
- **Плюсы:** Является сильным сигналом для поисковых систем о том, какой стране целевой контент (например, `.fr` = Франция).
|
|
41
40
|
- **Минусы:** Управление несколькими доменами может быть дороже и сложнее.
|
|
42
41
|
|
|
43
42
|
2. **Субдомены**
|
|
44
|
-
|
|
45
43
|
- **Пример:** `fr.example.com`, `de.example.com`
|
|
46
44
|
- **Плюсы:** Каждый язык «живет» на своем собственном субдомене, что не очень сложно добавлять или удалять языки.
|
|
47
45
|
- **Минусы:** Поисковые системы иногда рассматривают субдомены как отдельные сайты, что может размывать авторитет вашего основного домена.
|
|
@@ -95,7 +93,6 @@ slugs:
|
|
|
95
93
|
- **Локализация** означает адаптацию формата контента, валюты, измерений и культурных ссылок для местной аудитории. Например, если вы ориентируетесь на Францию, вы используете `€` вместо `You are an expert in internationalization and content management. Your task is to translate the following documentation into the specified locales.
|
|
96
94
|
|
|
97
95
|
1. **Requirement:**
|
|
98
|
-
|
|
99
96
|
- You should only translate the text, and titles of the file.
|
|
100
97
|
- You should not alter the structure of the file.
|
|
101
98
|
- You should not alter the code logic of code elements.
|
|
@@ -107,7 +104,6 @@ slugs:
|
|
|
107
104
|
- You should be sure to do not forgot to translate any content
|
|
108
105
|
|
|
109
106
|
2. **Locales:**
|
|
110
|
-
|
|
111
107
|
- Base file locale: en: English (US)
|
|
112
108
|
- Desired Locales: {{locale}} : {{localeName}}
|
|
113
109
|
|
|
@@ -1418,9 +1418,9 @@ export const config = {
|
|
|
1418
1418
|
Intlayer cung cấp xử lý middleware tích hợp sẵn thông qua cấu hình gói `next-intlayer`.
|
|
1419
1419
|
|
|
1420
1420
|
```ts fileName="src/middleware.ts"
|
|
1421
|
-
import {
|
|
1421
|
+
import { intlayerProxy } from "next-intlayer/proxy";
|
|
1422
1422
|
|
|
1423
|
-
export const middleware =
|
|
1423
|
+
export const middleware = intlayerProxy();
|
|
1424
1424
|
|
|
1425
1425
|
// áp dụng middleware này chỉ cho các tệp trong thư mục app
|
|
1426
1426
|
export const config = {
|
|
@@ -35,13 +35,11 @@ slugs:
|
|
|
35
35
|
如果您决定拥有多个语言版本,您将需要一种清晰、一致的方式来组织网站的 URL。每种语言(或地区)都应该在互联网上有其独特的“地址”。以下是三种常见的多语言网站结构方式:
|
|
36
36
|
|
|
37
37
|
1. 国家代码顶级域名(ccTLDs)
|
|
38
|
-
|
|
39
38
|
- 示例:`example.fr`,`example.de`
|
|
40
39
|
- **优点:** 向搜索引擎发送关于内容目标国家的强烈信号(例如,`.fr` = 法国)。
|
|
41
40
|
- **缺点:** 管理多个域名可能会更昂贵且复杂。
|
|
42
41
|
|
|
43
42
|
2. **子域名**
|
|
44
|
-
|
|
45
43
|
- **示例:** `fr.example.com`,`de.example.com`
|
|
46
44
|
- **优点:** 每种语言“生活”在其自己的子域名上,相对容易添加或删除语言。
|
|
47
45
|
- **缺点:** 搜索引擎有时将子域名视为独立网站,这可能会稀释主域名的权威性。
|
|
@@ -95,7 +93,6 @@ slugs:
|
|
|
95
93
|
- **本地化** 是指将内容的格式、货币、测量和文化参考调整为当地受众。例如,如果您针对法国,您将使用 `€` 而不是 `You are an expert in internationalization and content management. Your task is to translate the following documentation into the specified locales.
|
|
96
94
|
|
|
97
95
|
1. **Requirement:**
|
|
98
|
-
|
|
99
96
|
- You should only translate the text, and titles of the file.
|
|
100
97
|
- You should not alter the structure of the file.
|
|
101
98
|
- You should not alter the code logic of code elements.
|
|
@@ -107,7 +104,6 @@ slugs:
|
|
|
107
104
|
- You should be sure to do not forgot to translate any content
|
|
108
105
|
|
|
109
106
|
2. **Locales:**
|
|
110
|
-
|
|
111
107
|
- Base file locale: en: English (US)
|
|
112
108
|
- Desired Locales: {{locale}} : {{localeName}}
|
|
113
109
|
|
|
@@ -919,8 +919,8 @@ import { type FC } from "react";
|
|
|
919
919
|
import Link from "next/link";
|
|
920
920
|
|
|
921
921
|
const LocaleSwitcher: FC = () => {
|
|
922
|
-
const { locale, pathWithoutLocale, availableLocales } =
|
|
923
|
-
|
|
922
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
923
|
+
useLocale();
|
|
924
924
|
|
|
925
925
|
return (
|
|
926
926
|
<div>
|
|
@@ -932,7 +932,7 @@ const LocaleSwitcher: FC = () => {
|
|
|
932
932
|
hrefLang={localeItem}
|
|
933
933
|
key={localeItem}
|
|
934
934
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
935
|
-
onClick={() =>
|
|
935
|
+
onClick={() => setLocale(localeItem)}
|
|
936
936
|
>
|
|
937
937
|
<span>
|
|
938
938
|
{/* اللغة المحلية - مثال: FR */}
|
|
@@ -971,8 +971,8 @@ import { useLocale } from "next-intlayer";
|
|
|
971
971
|
import Link from "next/link";
|
|
972
972
|
|
|
973
973
|
const LocaleSwitcher = () => {
|
|
974
|
-
const { locale, pathWithoutLocale, availableLocales } =
|
|
975
|
-
|
|
974
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
975
|
+
useLocale();
|
|
976
976
|
|
|
977
977
|
return (
|
|
978
978
|
<div>
|
|
@@ -984,7 +984,7 @@ const LocaleSwitcher = () => {
|
|
|
984
984
|
hrefLang={localeItem}
|
|
985
985
|
key={localeItem}
|
|
986
986
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
987
|
-
onClick={() =>
|
|
987
|
+
onClick={() => setLocale(localeItem)}
|
|
988
988
|
>
|
|
989
989
|
<span>
|
|
990
990
|
{/* اللغة المحلية - مثال: FR */}
|
|
@@ -1023,8 +1023,8 @@ const { useLocale } = require("next-intlayer");
|
|
|
1023
1023
|
const Link = require("next/link");
|
|
1024
1024
|
|
|
1025
1025
|
const LocaleSwitcher = () => {
|
|
1026
|
-
const { locale, pathWithoutLocale, availableLocales } =
|
|
1027
|
-
|
|
1026
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1027
|
+
useLocale();
|
|
1028
1028
|
|
|
1029
1029
|
return (
|
|
1030
1030
|
<div>
|
|
@@ -1036,7 +1036,7 @@ const LocaleSwitcher = () => {
|
|
|
1036
1036
|
hrefLang={localeItem}
|
|
1037
1037
|
key={localeItem}
|
|
1038
1038
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1039
|
-
onClick={() =>
|
|
1039
|
+
onClick={() => setLocale(localeItem)}
|
|
1040
1040
|
>
|
|
1041
1041
|
<span>
|
|
1042
1042
|
{/* اللغة المحلية - مثال: FR */}
|
|
@@ -1154,8 +1154,8 @@ import { useLocale } from "next-intlayer";
|
|
|
1154
1154
|
import Link from "next/link";
|
|
1155
1155
|
|
|
1156
1156
|
export const LocaleSwitcher: FC = () => {
|
|
1157
|
-
const { locale, pathWithoutLocale, availableLocales } =
|
|
1158
|
-
|
|
1157
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1158
|
+
useLocale();
|
|
1159
1159
|
|
|
1160
1160
|
return (
|
|
1161
1161
|
<div>
|
|
@@ -1167,7 +1167,7 @@ export const LocaleSwitcher: FC = () => {
|
|
|
1167
1167
|
hrefLang={localeItem}
|
|
1168
1168
|
key={localeItem}
|
|
1169
1169
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1170
|
-
onClick={() =>
|
|
1170
|
+
onClick={() => setLocale(localeItem)}
|
|
1171
1171
|
>
|
|
1172
1172
|
<span>
|
|
1173
1173
|
{/* اللغة المحلية - على سبيل المثال FR */}
|
|
@@ -1206,8 +1206,8 @@ import { useLocale } from "next-intlayer";
|
|
|
1206
1206
|
import Link from "next/link";
|
|
1207
1207
|
|
|
1208
1208
|
export const LocaleSwitcher = () => {
|
|
1209
|
-
const { locale, pathWithoutLocale, availableLocales } =
|
|
1210
|
-
|
|
1209
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1210
|
+
useLocale();
|
|
1211
1211
|
|
|
1212
1212
|
return (
|
|
1213
1213
|
<div>
|
|
@@ -1219,7 +1219,7 @@ export const LocaleSwitcher = () => {
|
|
|
1219
1219
|
hrefLang={localeItem}
|
|
1220
1220
|
key={localeItem}
|
|
1221
1221
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1222
|
-
onClick={() =>
|
|
1222
|
+
onClick={() => setLocale(localeItem)}
|
|
1223
1223
|
>
|
|
1224
1224
|
<span>
|
|
1225
1225
|
{/* اللغة المحلية - على سبيل المثال FR */}
|
|
@@ -1258,7 +1258,8 @@ const { useLocale } = require("next-intlayer");
|
|
|
1258
1258
|
const Link = require("next/link");
|
|
1259
1259
|
|
|
1260
1260
|
export const LocaleSwitcher = () => {
|
|
1261
|
-
const { locale, pathWithoutLocale, availableLocales } =
|
|
1261
|
+
const { locale, pathWithoutLocale, availableLocales, setLocale } =
|
|
1262
|
+
useLocale();
|
|
1262
1263
|
|
|
1263
1264
|
return (
|
|
1264
1265
|
<div>
|
|
@@ -1270,7 +1271,7 @@ export const LocaleSwitcher = () => {
|
|
|
1270
1271
|
hrefLang={localeItem}
|
|
1271
1272
|
key={localeItem}
|
|
1272
1273
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1273
|
-
onClick={() =>
|
|
1274
|
+
onClick={() => setLocale(localeItem)}
|
|
1274
1275
|
>
|
|
1275
1276
|
<span>
|
|
1276
1277
|
{/* اللغة المحلية - مثلاً FR */}
|
|
@@ -224,10 +224,6 @@ module.exports = withIntlayer(nextConfig);
|
|
|
224
224
|
> );
|
|
225
225
|
> ```
|
|
226
226
|
|
|
227
|
-
export default RootLayout;
|
|
228
|
-
|
|
229
|
-
````
|
|
230
|
-
|
|
231
227
|
```jsx {3} fileName="src/app/layout.mjx" codeFormat="esm"
|
|
232
228
|
import "./globals.css";
|
|
233
229
|
|
|
@@ -237,7 +233,7 @@ const RootLayout = ({ children }) => (
|
|
|
237
233
|
);
|
|
238
234
|
|
|
239
235
|
export default RootLayout;
|
|
240
|
-
|
|
236
|
+
```
|
|
241
237
|
|
|
242
238
|
```jsx {1,8} fileName="src/app/layout.csx" codeFormat="commonjs"
|
|
243
239
|
require("./globals.css");
|
|
@@ -734,29 +730,6 @@ const metadataContent = {
|
|
|
734
730
|
export default metadataContent;
|
|
735
731
|
```
|
|
736
732
|
|
|
737
|
-
```javascript fileName="src/app/[locale]/metadata.content.mjs" contentDeclarationFormat="esm"
|
|
738
|
-
import { t } from "intlayer";
|
|
739
|
-
|
|
740
|
-
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
741
|
-
const metadataContent = {
|
|
742
|
-
key: "page-metadata",
|
|
743
|
-
content: {
|
|
744
|
-
title: t({
|
|
745
|
-
en: "Create Next App",
|
|
746
|
-
fr: "Créer une application Next.js",
|
|
747
|
-
es: "Crear una aplicación Next.js",
|
|
748
|
-
}),
|
|
749
|
-
description: t({
|
|
750
|
-
en: "Generated by create next app",
|
|
751
|
-
fr: "Généré par create next app",
|
|
752
|
-
es: "Generado por create next app",
|
|
753
|
-
}),
|
|
754
|
-
},
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
export default metadataContent;
|
|
758
|
-
```
|
|
759
|
-
|
|
760
733
|
```javascript fileName="src/app/[locale]/metadata.content.cjs" contentDeclarationFormat="commonjs"
|
|
761
734
|
const { t } = require("intlayer");
|
|
762
735
|
|
|
@@ -777,13 +750,6 @@ const metadataContent = {
|
|
|
777
750
|
},
|
|
778
751
|
};
|
|
779
752
|
|
|
780
|
-
module.exports = metadataContent;
|
|
781
|
-
fr: "تم إنشاؤه بواسطة create next app",
|
|
782
|
-
es: "تم إنشاؤه بواسطة create next app",
|
|
783
|
-
}),
|
|
784
|
-
},
|
|
785
|
-
};
|
|
786
|
-
|
|
787
753
|
export default metadataContent;
|
|
788
754
|
```
|
|
789
755
|
|
|
@@ -970,26 +936,6 @@ module.exports = { generateMetadata };
|
|
|
970
936
|
|
|
971
937
|
بدلاً من ذلك، يمكنك استخدام دالة `getTranslation` لإعلان بيانات التعريف الخاصة بك. ومع ذلك، يُنصح باستخدام ملفات إعلان المحتوى لأتمتة ترجمة بيانات التعريف الخاصة بك وفصل المحتوى في مرحلة ما.
|
|
972
938
|
|
|
973
|
-
````typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
974
|
-
import {
|
|
975
|
-
type IConfigLocales,
|
|
976
|
-
getTranslation,
|
|
977
|
-
getMultilingualUrls,
|
|
978
|
-
} from "intlayer";
|
|
979
|
-
import type { Metadata } from "next";
|
|
980
|
-
import type { LocalPromiseParams } from "next-intlayer";
|
|
981
|
-
|
|
982
|
-
export const generateMetadata = async ({
|
|
983
|
-
params,
|
|
984
|
-
}: LocalPromiseParams): Promise<Metadata> => {
|
|
985
|
-
const { locale } = await params;
|
|
986
|
-
const t = <T>(content: IConfigLocales<T>) => getTranslation(content, locale);
|
|
987
|
-
|
|
988
|
-
return {
|
|
989
|
-
title: t<string>({
|
|
990
|
-
en: "My title",
|
|
991
|
-
بدلاً من ذلك، يمكنك استخدام دالة `getTranslation` لإعلان بيانات التعريف الخاصة بك. ومع ذلك، يُوصى باستخدام ملفات إعلان المحتوى لأتمتة ترجمة بيانات التعريف الخاصة بك وفصل المحتوى في مرحلة ما.
|
|
992
|
-
|
|
993
939
|
```typescript fileName="src/app/[locale]/layout.tsx or src/app/[locale]/page.tsx" codeFormat="typescript"
|
|
994
940
|
import {
|
|
995
941
|
type IConfigLocales,
|
|
@@ -1020,7 +966,7 @@ export const generateMetadata = async ({
|
|
|
1020
966
|
};
|
|
1021
967
|
|
|
1022
968
|
// ... بقية الكود
|
|
1023
|
-
|
|
969
|
+
```
|
|
1024
970
|
|
|
1025
971
|
```javascript fileName="src/app/[locale]/layout.mjs or src/app/[locale]/page.mjs" codeFormat="esm"
|
|
1026
972
|
import { getTranslation, getMultilingualUrls } from "intlayer";
|
|
@@ -149,7 +149,7 @@ export default withIntlayer(nextConfig);
|
|
|
149
149
|
قم بإعداد الوسيط لاكتشاف ومعالجة اللغة المفضلة للمستخدم تلقائيًا:
|
|
150
150
|
|
|
151
151
|
```typescript fileName="src/middleware.ts" codeFormat="typescript"
|
|
152
|
-
export {
|
|
152
|
+
export { intlayerProxy as middleware } from "next-intlayer/middleware";
|
|
153
153
|
|
|
154
154
|
export const config = {
|
|
155
155
|
matcher:
|
|
@@ -158,7 +158,7 @@ export const config = {
|
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
```javascript fileName="src/middleware.mjs" codeFormat="esm"
|
|
161
|
-
export {
|
|
161
|
+
export { intlayerProxy as middleware } from "next-intlayer/middleware";
|
|
162
162
|
|
|
163
163
|
export const config = {
|
|
164
164
|
matcher:
|
|
@@ -167,14 +167,14 @@ export const config = {
|
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
```javascript fileName="src/middleware.cjs" codeFormat="commonjs"
|
|
170
|
-
const {
|
|
170
|
+
const { intlayerProxy } = require("next-intlayer/middleware");
|
|
171
171
|
|
|
172
172
|
const config = {
|
|
173
173
|
matcher:
|
|
174
174
|
"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\..*|_next).*)",
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
module.exports = { middleware:
|
|
177
|
+
module.exports = { middleware: intlayerProxy, config };
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
> قم بتعديل معامل `matcher` ليتناسب مع مسارات تطبيقك. لمزيد من التفاصيل، راجع [وثائق Next.js حول تكوين matcher](https://nextjs.org/docs/app/building-your-application/routing/middleware).
|
|
@@ -1098,7 +1098,6 @@ import Link from "next/link";
|
|
|
1098
1098
|
|
|
1099
1099
|
const LocaleSwitcher: FC = () => {
|
|
1100
1100
|
const { locale, pathWithoutLocale, availableLocales } = useLocalePageRouter();
|
|
1101
|
-
const { setLocaleCookie } = useLocaleCookie();
|
|
1102
1101
|
|
|
1103
1102
|
return (
|
|
1104
1103
|
<div>
|
|
@@ -1110,7 +1109,7 @@ const LocaleSwitcher: FC = () => {
|
|
|
1110
1109
|
hrefLang={localeItem}
|
|
1111
1110
|
key={localeItem}
|
|
1112
1111
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1113
|
-
onClick={() =>
|
|
1112
|
+
onClick={() => setLocale(localeItem)}
|
|
1114
1113
|
>
|
|
1115
1114
|
<span>
|
|
1116
1115
|
{/* اللغة - مثل FR */}
|
|
@@ -1148,7 +1147,6 @@ import Link from "next/link";
|
|
|
1148
1147
|
|
|
1149
1148
|
const LocaleSwitcher = () => {
|
|
1150
1149
|
const { locale, pathWithoutLocale, availableLocales } = useLocalePageRouter();
|
|
1151
|
-
const { setLocaleCookie } = useLocaleCookie();
|
|
1152
1150
|
|
|
1153
1151
|
return (
|
|
1154
1152
|
<div>
|
|
@@ -1160,7 +1158,7 @@ const LocaleSwitcher = () => {
|
|
|
1160
1158
|
hrefLang={localeItem}
|
|
1161
1159
|
key={localeItem}
|
|
1162
1160
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1163
|
-
onClick={() =>
|
|
1161
|
+
onClick={() => setLocale(localeItem)}
|
|
1164
1162
|
>
|
|
1165
1163
|
<span>
|
|
1166
1164
|
{/* المنطقة - مثال: FR */}
|
|
@@ -1198,7 +1196,6 @@ const Link = require("next/link");
|
|
|
1198
1196
|
|
|
1199
1197
|
const LocaleSwitcher = () => {
|
|
1200
1198
|
const { locale, pathWithoutLocale, availableLocales } = useLocalePageRouter();
|
|
1201
|
-
const { setLocaleCookie } = useLocaleCookie();
|
|
1202
1199
|
|
|
1203
1200
|
return (
|
|
1204
1201
|
<select>
|
|
@@ -1208,7 +1205,7 @@ const LocaleSwitcher = () => {
|
|
|
1208
1205
|
href={getLocalizedUrl(pathWithoutLocale, localeItem)}
|
|
1209
1206
|
hrefLang={localeItem}
|
|
1210
1207
|
aria-current={locale === localeItem ? "page" : undefined}
|
|
1211
|
-
onClick={() =>
|
|
1208
|
+
onClick={() => setLocale(localeItem)}
|
|
1212
1209
|
>
|
|
1213
1210
|
<span>
|
|
1214
1211
|
{/* اللغة المحلية - على سبيل المثال FR */}
|