@intlayer/docs 8.7.9 → 8.7.11-canary.0
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/docs/ar/dictionary/insertion.md +0 -52
- package/docs/ar/intlayer_with_astro.md +55 -6
- package/docs/ar/per_locale_file.md +0 -46
- package/docs/de/dictionary/insertion.md +0 -92
- package/docs/de/intlayer_with_astro.md +55 -6
- package/docs/de/intlayer_with_nextjs_16.md +0 -23
- package/docs/de/per_locale_file.md +0 -44
- package/docs/en/dictionary/insertion.md +0 -55
- package/docs/en/intlayer_with_astro.md +2 -1
- package/docs/en/per_locale_file.md +0 -43
- package/docs/en-GB/dictionary/insertion.md +0 -56
- package/docs/en-GB/intlayer_with_astro.md +55 -6
- package/docs/en-GB/per_locale_file.md +0 -43
- package/docs/es/dictionary/insertion.md +0 -52
- package/docs/es/intlayer_with_astro.md +55 -7
- package/docs/es/intlayer_with_nextjs_14.md +0 -23
- package/docs/es/intlayer_with_nextjs_16.md +0 -23
- package/docs/es/packages/next-intlayer/index.md +0 -52
- package/docs/es/packages/react-intlayer/index.md +0 -52
- package/docs/es/per_locale_file.md +0 -43
- package/docs/fr/dictionary/insertion.md +0 -52
- package/docs/fr/intlayer_with_astro.md +55 -7
- package/docs/fr/packages/react-intlayer/index.md +0 -52
- package/docs/fr/per_locale_file.md +0 -46
- package/docs/hi/dictionary/insertion.md +0 -91
- package/docs/hi/intlayer_with_astro.md +55 -6
- package/docs/hi/packages/intlayer/index.md +0 -52
- package/docs/hi/per_locale_file.md +0 -43
- package/docs/id/dictionary/insertion.md +0 -91
- package/docs/id/intlayer_with_astro.md +55 -6
- package/docs/id/intlayer_with_nextjs_14.md +0 -24
- package/docs/id/per_locale_file.md +0 -44
- package/docs/it/dictionary/insertion.md +0 -52
- package/docs/it/intlayer_with_astro.md +55 -6
- package/docs/it/per_locale_file.md +0 -44
- package/docs/ja/dictionary/insertion.md +0 -56
- package/docs/ja/intlayer_with_astro.md +55 -7
- package/docs/ja/intlayer_with_nextjs_14.md +0 -23
- package/docs/ja/per_locale_file.md +0 -43
- package/docs/ko/dictionary/insertion.md +0 -56
- package/docs/ko/intlayer_with_astro.md +55 -7
- package/docs/ko/per_locale_file.md +0 -43
- package/docs/pl/dictionary/insertion.md +0 -85
- package/docs/pl/intlayer_with_astro.md +55 -6
- package/docs/pl/per_locale_file.md +0 -44
- package/docs/pt/dictionary/insertion.md +0 -93
- package/docs/pt/intlayer_with_astro.md +55 -6
- package/docs/pt/intlayer_with_nextjs_page_router.md +0 -23
- package/docs/pt/per_locale_file.md +0 -44
- package/docs/ru/dictionary/insertion.md +0 -52
- package/docs/ru/intlayer_with_astro.md +55 -7
- package/docs/ru/per_locale_file.md +0 -44
- package/docs/tr/dictionary/insertion.md +0 -52
- package/docs/tr/intlayer_with_astro.md +55 -6
- package/docs/tr/per_locale_file.md +0 -43
- package/docs/uk/dictionary/insertion.md +0 -52
- package/docs/uk/intlayer_with_astro.md +55 -6
- package/docs/uk/per_locale_file.md +0 -43
- package/docs/vi/dictionary/insertion.md +0 -85
- package/docs/vi/intlayer_with_astro.md +55 -6
- package/docs/vi/per_locale_file.md +0 -46
- package/docs/zh/dictionary/insertion.md +0 -54
- package/docs/zh/intlayer_with_astro.md +55 -7
- package/docs/zh/per_locale_file.md +0 -44
- package/package.json +6 -6
|
@@ -54,34 +54,6 @@ Per configurare il contenuto di inserimento nel tuo progetto Intlayer, crea un m
|
|
|
54
54
|
export default myInsertionContent;
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
58
|
-
import { insert } from "intlayer";
|
|
59
|
-
|
|
60
|
-
/** @type {import('intlayer').Dictionary} */
|
|
61
|
-
const myInsertionContent = {
|
|
62
|
-
key: "my_key",
|
|
63
|
-
content: {
|
|
64
|
-
myInsertion: insert("Ciao, mi chiamo {{name}} e ho {{age}} anni!"),
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default myInsertionContent;
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
72
|
-
const { insert } = require("intlayer");
|
|
73
|
-
|
|
74
|
-
/** @type {import('intlayer').Dictionary} */
|
|
75
|
-
const myInsertionContent = {
|
|
76
|
-
key: "my_key",
|
|
77
|
-
content: {
|
|
78
|
-
myInsertion: insert("Ciao, mi chiamo {{name}} e ho {{age}} anni!"),
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
module.exports = myInsertionContent;
|
|
83
|
-
```
|
|
84
|
-
|
|
85
57
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
86
58
|
{
|
|
87
59
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -112,30 +84,6 @@ Per configurare il contenuto di inserimento nel tuo progetto Intlayer, crea un m
|
|
|
112
84
|
export default myInsertionContent;
|
|
113
85
|
```
|
|
114
86
|
|
|
115
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
116
|
-
/** @type {import('intlayer').Dictionary} */
|
|
117
|
-
const myInsertionContent = {
|
|
118
|
-
key: "my_key",
|
|
119
|
-
content: {
|
|
120
|
-
myInsertion: "Ciao, mi chiamo {{name}} e ho {{age}} anni!",
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default myInsertionContent;
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
128
|
-
/** @type {import('intlayer').Dictionary} */
|
|
129
|
-
const myInsertionContent = {
|
|
130
|
-
key: "my_key",
|
|
131
|
-
content: {
|
|
132
|
-
myInsertion: "Ciao, mi chiamo {{name}} e ho {{age}} anni!",
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
module.exports = myInsertionContent;
|
|
137
|
-
```
|
|
138
|
-
|
|
139
87
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
140
88
|
{
|
|
141
89
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -178,20 +178,69 @@ Puoi consumare i dizionari direttamente nei tuoi file `.astro` utilizzando gli h
|
|
|
178
178
|
|
|
179
179
|
```astro fileName="src/pages/index.astro"
|
|
180
180
|
---
|
|
181
|
-
import {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
import {
|
|
182
|
+
getIntlayer,
|
|
183
|
+
getLocaleFromPath,
|
|
184
|
+
getLocalizedUrl,
|
|
185
|
+
defaultLocale,
|
|
186
|
+
localeMap,
|
|
187
|
+
getHTMLTextDir,
|
|
188
|
+
type LocalesValues,
|
|
189
|
+
} from "intlayer";
|
|
190
|
+
import LocaleSwitcher from "../components/LocaleSwitcher.astro";
|
|
191
|
+
|
|
192
|
+
// Get the current locale from the URL (e.g. /es/about -> 'es')
|
|
193
|
+
const locale = getLocaleFromPath(Astro.url.pathname) as LocalesValues;
|
|
194
|
+
|
|
195
|
+
// Get the content for the 'app' dictionary
|
|
196
|
+
const { title } = getIntlayer("app", locale);
|
|
185
197
|
---
|
|
186
198
|
|
|
187
|
-
|
|
199
|
+
<!doctype html>
|
|
200
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
188
201
|
<head>
|
|
189
202
|
<meta charset="utf-8" />
|
|
190
203
|
<meta name="viewport" content="width=device-width" />
|
|
204
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
191
205
|
<title>{title}</title>
|
|
206
|
+
|
|
207
|
+
<!-- Canonical link: Tells search engines which is the primary version of this page -->
|
|
208
|
+
<link
|
|
209
|
+
rel="canonical"
|
|
210
|
+
href={new URL(getLocalizedUrl(Astro.url.pathname, locale), Astro.site)}
|
|
211
|
+
/>
|
|
212
|
+
|
|
213
|
+
<!-- Hreflang: Tell Google about all localized versions -->
|
|
214
|
+
{
|
|
215
|
+
localeMap(({ locale: mapLocale }) => (
|
|
216
|
+
<link
|
|
217
|
+
rel="alternate"
|
|
218
|
+
hreflang={mapLocale}
|
|
219
|
+
href={new URL(
|
|
220
|
+
getLocalizedUrl(Astro.url.pathname, mapLocale),
|
|
221
|
+
Astro.site
|
|
222
|
+
)}
|
|
223
|
+
/>
|
|
224
|
+
))
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
<!-- x-default: Fallback for users in unmatched languages -->
|
|
228
|
+
<link
|
|
229
|
+
rel="alternate"
|
|
230
|
+
hreflang="x-default"
|
|
231
|
+
href={new URL(
|
|
232
|
+
getLocalizedUrl(Astro.url.pathname, defaultLocale),
|
|
233
|
+
Astro.site
|
|
234
|
+
)}
|
|
235
|
+
/>
|
|
192
236
|
</head>
|
|
193
237
|
<body>
|
|
194
|
-
<
|
|
238
|
+
<header>
|
|
239
|
+
<LocaleSwitcher />
|
|
240
|
+
</header>
|
|
241
|
+
<main>
|
|
242
|
+
<h1>{title}</h1>
|
|
243
|
+
</main>
|
|
195
244
|
</body>
|
|
196
245
|
</html>
|
|
197
246
|
```
|
|
@@ -145,50 +145,6 @@ const helloWorldContent = {
|
|
|
145
145
|
export default helloWorldContent;
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
```tsx fileName="hello-world.es.content.mjs" contentDeclarationFormat="esm"
|
|
149
|
-
import { t, Locales } from "intlayer";
|
|
150
|
-
|
|
151
|
-
/** @type {import('intlayer').Dictionary} */
|
|
152
|
-
// Dizionario contenuti per "hello-world" in spagnolo
|
|
153
|
-
const helloWorldContent = {
|
|
154
|
-
key: "hello-world",
|
|
155
|
-
locale: Locales.SPANISH, // Importante
|
|
156
|
-
content: { multilingualContent: "Título de mi componente" },
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export default helloWorldContent;
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
```js fileName="hello-world.en.content.cjs" contentDeclarationFormat="commonjs"
|
|
163
|
-
const { t, Locales } = require("intlayer");
|
|
164
|
-
|
|
165
|
-
/** @type {import('intlayer').Dictionary} */
|
|
166
|
-
const helloWorldContent = {
|
|
167
|
-
key: "hello-world",
|
|
168
|
-
locale: Locales.ENGLISH, // Importante
|
|
169
|
-
content: {
|
|
170
|
-
multilingualContent: "Titolo del mio componente",
|
|
171
|
-
},
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
module.exports = helloWorldContent;
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
```tsx fileName="hello-world.es.content.cjs" contentDeclarationFormat="commonjs"
|
|
178
|
-
const { t, Locales } = require("intlayer");
|
|
179
|
-
|
|
180
|
-
/** @type {import('intlayer').Dictionary} */
|
|
181
|
-
const helloWorldContent = {
|
|
182
|
-
key: "hello-world",
|
|
183
|
-
locale: Locales.SPANISH, // Importante
|
|
184
|
-
content: {
|
|
185
|
-
multilingualContent: "Título de mi componente",
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
module.exports = helloWorldContent;
|
|
190
|
-
```
|
|
191
|
-
|
|
192
148
|
```json5 fileName="hello-world.en.content.json" contentDeclarationFormat="json"
|
|
193
149
|
{
|
|
194
150
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -56,38 +56,6 @@ Intlayerプロジェクトで挿入コンテンツを設定するには、挿入
|
|
|
56
56
|
export default myInsertionContent;
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
60
|
-
import { insert } from "intlayer";
|
|
61
|
-
|
|
62
|
-
/** @type {import('intlayer').Dictionary} */
|
|
63
|
-
const myInsertionContent = {
|
|
64
|
-
key: "my_key",
|
|
65
|
-
content: {
|
|
66
|
-
myInsertion: insert(
|
|
67
|
-
"こんにちは、私の名前は{{name}}で、年齢は{{age}}歳です!"
|
|
68
|
-
),
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default myInsertionContent;
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
76
|
-
const { insert } = require("intlayer");
|
|
77
|
-
|
|
78
|
-
/** @type {import('intlayer').Dictionary} */
|
|
79
|
-
const myInsertionContent = {
|
|
80
|
-
key: "my_key",
|
|
81
|
-
content: {
|
|
82
|
-
myInsertion: insert(
|
|
83
|
-
"こんにちは、私の名前は{{name}}で、年齢は{{age}}歳です!"
|
|
84
|
-
),
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
module.exports = myInsertionContent;
|
|
89
|
-
```
|
|
90
|
-
|
|
91
59
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
92
60
|
{
|
|
93
61
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -118,30 +86,6 @@ Intlayerプロジェクトで挿入コンテンツを設定するには、挿入
|
|
|
118
86
|
export default myInsertionContent;
|
|
119
87
|
```
|
|
120
88
|
|
|
121
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
122
|
-
/** @type {import('intlayer').Dictionary} */
|
|
123
|
-
const myInsertionContent = {
|
|
124
|
-
key: "my_key",
|
|
125
|
-
content: {
|
|
126
|
-
myInsertion: "こんにちは、私の名前は{{name}}で、年齢は{{age}}歳です!",
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export default myInsertionContent;
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
134
|
-
/** @type {import('intlayer').Dictionary} */
|
|
135
|
-
const myInsertionContent = {
|
|
136
|
-
key: "my_key",
|
|
137
|
-
content: {
|
|
138
|
-
myInsertion: "こんにちは、私の名前は{{name}}で、年齢は{{age}}歳です!",
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
module.exports = myInsertionContent;
|
|
143
|
-
```
|
|
144
|
-
|
|
145
89
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
146
90
|
{
|
|
147
91
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -176,22 +176,70 @@ export default appContent;
|
|
|
176
176
|
`intlayer`からエクスポートされたコアヘルパーを使用して、`.astro`ファイル内で直接辞書を消費できます。
|
|
177
177
|
|
|
178
178
|
```astro fileName="src/pages/index.astro"
|
|
179
|
-
<!-- astro -->
|
|
180
179
|
---
|
|
181
|
-
import {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
import {
|
|
181
|
+
getIntlayer,
|
|
182
|
+
getLocaleFromPath,
|
|
183
|
+
getLocalizedUrl,
|
|
184
|
+
defaultLocale,
|
|
185
|
+
localeMap,
|
|
186
|
+
getHTMLTextDir,
|
|
187
|
+
type LocalesValues,
|
|
188
|
+
} from "intlayer";
|
|
189
|
+
import LocaleSwitcher from "../components/LocaleSwitcher.astro";
|
|
190
|
+
|
|
191
|
+
// Get the current locale from the URL (e.g. /es/about -> 'es')
|
|
192
|
+
const locale = getLocaleFromPath(Astro.url.pathname) as LocalesValues;
|
|
193
|
+
|
|
194
|
+
// Get the content for the 'app' dictionary
|
|
195
|
+
const { title } = getIntlayer("app", locale);
|
|
185
196
|
---
|
|
186
197
|
|
|
187
|
-
|
|
198
|
+
<!doctype html>
|
|
199
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
188
200
|
<head>
|
|
189
201
|
<meta charset="utf-8" />
|
|
190
202
|
<meta name="viewport" content="width=device-width" />
|
|
203
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
191
204
|
<title>{title}</title>
|
|
205
|
+
|
|
206
|
+
<!-- Canonical link: Tells search engines which is the primary version of this page -->
|
|
207
|
+
<link
|
|
208
|
+
rel="canonical"
|
|
209
|
+
href={new URL(getLocalizedUrl(Astro.url.pathname, locale), Astro.site)}
|
|
210
|
+
/>
|
|
211
|
+
|
|
212
|
+
<!-- Hreflang: Tell Google about all localized versions -->
|
|
213
|
+
{
|
|
214
|
+
localeMap(({ locale: mapLocale }) => (
|
|
215
|
+
<link
|
|
216
|
+
rel="alternate"
|
|
217
|
+
hreflang={mapLocale}
|
|
218
|
+
href={new URL(
|
|
219
|
+
getLocalizedUrl(Astro.url.pathname, mapLocale),
|
|
220
|
+
Astro.site
|
|
221
|
+
)}
|
|
222
|
+
/>
|
|
223
|
+
))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
<!-- x-default: Fallback for users in unmatched languages -->
|
|
227
|
+
<link
|
|
228
|
+
rel="alternate"
|
|
229
|
+
hreflang="x-default"
|
|
230
|
+
href={new URL(
|
|
231
|
+
getLocalizedUrl(Astro.url.pathname, defaultLocale),
|
|
232
|
+
Astro.site
|
|
233
|
+
)}
|
|
234
|
+
/>
|
|
192
235
|
</head>
|
|
193
236
|
<body>
|
|
194
|
-
<
|
|
237
|
+
<header>
|
|
238
|
+
<LocaleSwitcher />
|
|
239
|
+
</header>
|
|
240
|
+
<main>
|
|
241
|
+
<h1>{title}</h1>
|
|
242
|
+
</main>
|
|
195
243
|
</body>
|
|
196
244
|
</html>
|
|
197
245
|
```
|
|
@@ -413,29 +413,6 @@ const metadataContent = {
|
|
|
413
413
|
export default metadataContent;
|
|
414
414
|
```
|
|
415
415
|
|
|
416
|
-
```javascript fileName="src/app/[locale]/metadata.content.cjs" contentDeclarationFormat="commonjs"
|
|
417
|
-
const { t } = require("intlayer");
|
|
418
|
-
|
|
419
|
-
/** @type {import('intlayer').Dictionary<import('next').Metadata>} */
|
|
420
|
-
const metadataContent = {
|
|
421
|
-
key: "page-metadata",
|
|
422
|
-
content: {
|
|
423
|
-
title: t({
|
|
424
|
-
en: "Create Next App",
|
|
425
|
-
fr: "Créer une application Next.js",
|
|
426
|
-
es: "Crear una aplicación Next.js",
|
|
427
|
-
}),
|
|
428
|
-
description: t({
|
|
429
|
-
en: "Generated by create next app",
|
|
430
|
-
fr: "Généré par create next app",
|
|
431
|
-
es: "Generado por create next app",
|
|
432
|
-
}),
|
|
433
|
-
},
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
module.exports = metadataContent;
|
|
437
|
-
```
|
|
438
|
-
|
|
439
416
|
```json fileName="src/app/[locale]/metadata.content.json" contentDeclarationFormat="json"
|
|
440
417
|
{
|
|
441
418
|
"key": "page-metadata",
|
|
@@ -145,49 +145,6 @@ const helloWorldContent = {
|
|
|
145
145
|
export default helloWorldContent;
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
```tsx fileName="hello-world.es.content.mjs" contentDeclarationFormat="esm"
|
|
149
|
-
import { t, Locales } from "intlayer";
|
|
150
|
-
|
|
151
|
-
/** @type {import('intlayer').Dictionary} */
|
|
152
|
-
const helloWorldContent = {
|
|
153
|
-
key: "hello-world",
|
|
154
|
-
locale: Locales.SPANISH, // 重要
|
|
155
|
-
content: { multilingualContent: "Título de mi componente" },
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export default helloWorldContent;
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
```js fileName="hello-world.en.content.cjs" contentDeclarationFormat="commonjs"
|
|
162
|
-
const { t, Locales } = require("intlayer");
|
|
163
|
-
|
|
164
|
-
/** @type {import('intlayer').Dictionary} */
|
|
165
|
-
const helloWorldContent = {
|
|
166
|
-
key: "hello-world",
|
|
167
|
-
locale: Locales.ENGLISH, // 重要
|
|
168
|
-
content: {
|
|
169
|
-
multilingualContent: "私のコンポーネントのタイトル",
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
module.exports = helloWorldContent;
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
```tsx fileName="hello-world.es.content.cjs" contentDeclarationFormat="commonjs"
|
|
177
|
-
const { t, Locales } = require("intlayer");
|
|
178
|
-
|
|
179
|
-
/** @type {import('intlayer').Dictionary} */
|
|
180
|
-
const helloWorldContent = {
|
|
181
|
-
key: "hello-world",
|
|
182
|
-
locale: Locales.SPANISH, // 重要
|
|
183
|
-
content: {
|
|
184
|
-
multilingualContent: "Título de mi componente",
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
module.exports = helloWorldContent;
|
|
189
|
-
```
|
|
190
|
-
|
|
191
148
|
```json5 fileName="hello-world.en.content.json" contentDeclarationFormat="json"
|
|
192
149
|
{
|
|
193
150
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -56,38 +56,6 @@ Intlayer 프로젝트에서 삽입 콘텐츠를 설정하려면, 삽입 정의
|
|
|
56
56
|
export default myInsertionContent;
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
60
|
-
import { insert } from "intlayer";
|
|
61
|
-
|
|
62
|
-
/** @type {import('intlayer').Dictionary} */
|
|
63
|
-
const myInsertionContent = {
|
|
64
|
-
key: "my_key",
|
|
65
|
-
content: {
|
|
66
|
-
myInsertion: insert(
|
|
67
|
-
"안녕하세요, 제 이름은 {{name}}이고 저는 {{age}}살입니다!"
|
|
68
|
-
),
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default myInsertionContent;
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
76
|
-
const { insert } = require("intlayer");
|
|
77
|
-
|
|
78
|
-
/** @type {import('intlayer').Dictionary} */
|
|
79
|
-
const myInsertionContent = {
|
|
80
|
-
key: "my_key",
|
|
81
|
-
content: {
|
|
82
|
-
myInsertion: insert(
|
|
83
|
-
"안녕하세요, 제 이름은 {{name}}이고 저는 {{age}}살입니다!"
|
|
84
|
-
),
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
module.exports = myInsertionContent;
|
|
89
|
-
```
|
|
90
|
-
|
|
91
59
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
92
60
|
{
|
|
93
61
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -118,30 +86,6 @@ Intlayer 프로젝트에서 삽입 콘텐츠를 설정하려면, 삽입 정의
|
|
|
118
86
|
export default myInsertionContent;
|
|
119
87
|
```
|
|
120
88
|
|
|
121
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
122
|
-
/** @type {import('intlayer').Dictionary} */
|
|
123
|
-
const myInsertionContent = {
|
|
124
|
-
key: "my_key",
|
|
125
|
-
content: {
|
|
126
|
-
myInsertion: "안녕하세요, 제 이름은 {{name}}이고 저는 {{age}}살입니다!",
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export default myInsertionContent;
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
134
|
-
/** @type {import('intlayer').Dictionary} */
|
|
135
|
-
const myInsertionContent = {
|
|
136
|
-
key: "my_key",
|
|
137
|
-
content: {
|
|
138
|
-
myInsertion: "안녕하세요, 제 이름은 {{name}}이고 저는 {{age}}살입니다!",
|
|
139
|
-
},
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
module.exports = myInsertionContent;
|
|
143
|
-
```
|
|
144
|
-
|
|
145
89
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
146
90
|
{
|
|
147
91
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -176,22 +176,70 @@ export default appContent;
|
|
|
176
176
|
`intlayer`에서 내보낸 핵심 헬퍼를 사용하여 `.astro` 파일에서 직접 사전을 소비할 수 있습니다.
|
|
177
177
|
|
|
178
178
|
```astro fileName="src/pages/index.astro"
|
|
179
|
-
<!-- astro -->
|
|
180
179
|
---
|
|
181
|
-
import {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
import {
|
|
181
|
+
getIntlayer,
|
|
182
|
+
getLocaleFromPath,
|
|
183
|
+
getLocalizedUrl,
|
|
184
|
+
defaultLocale,
|
|
185
|
+
localeMap,
|
|
186
|
+
getHTMLTextDir,
|
|
187
|
+
type LocalesValues,
|
|
188
|
+
} from "intlayer";
|
|
189
|
+
import LocaleSwitcher from "../components/LocaleSwitcher.astro";
|
|
190
|
+
|
|
191
|
+
// Get the current locale from the URL (e.g. /es/about -> 'es')
|
|
192
|
+
const locale = getLocaleFromPath(Astro.url.pathname) as LocalesValues;
|
|
193
|
+
|
|
194
|
+
// Get the content for the 'app' dictionary
|
|
195
|
+
const { title } = getIntlayer("app", locale);
|
|
185
196
|
---
|
|
186
197
|
|
|
187
|
-
|
|
198
|
+
<!doctype html>
|
|
199
|
+
<html lang={locale} dir={getHTMLTextDir(locale)}>
|
|
188
200
|
<head>
|
|
189
201
|
<meta charset="utf-8" />
|
|
190
202
|
<meta name="viewport" content="width=device-width" />
|
|
203
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
191
204
|
<title>{title}</title>
|
|
205
|
+
|
|
206
|
+
<!-- Canonical link: Tells search engines which is the primary version of this page -->
|
|
207
|
+
<link
|
|
208
|
+
rel="canonical"
|
|
209
|
+
href={new URL(getLocalizedUrl(Astro.url.pathname, locale), Astro.site)}
|
|
210
|
+
/>
|
|
211
|
+
|
|
212
|
+
<!-- Hreflang: Tell Google about all localized versions -->
|
|
213
|
+
{
|
|
214
|
+
localeMap(({ locale: mapLocale }) => (
|
|
215
|
+
<link
|
|
216
|
+
rel="alternate"
|
|
217
|
+
hreflang={mapLocale}
|
|
218
|
+
href={new URL(
|
|
219
|
+
getLocalizedUrl(Astro.url.pathname, mapLocale),
|
|
220
|
+
Astro.site
|
|
221
|
+
)}
|
|
222
|
+
/>
|
|
223
|
+
))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
<!-- x-default: Fallback for users in unmatched languages -->
|
|
227
|
+
<link
|
|
228
|
+
rel="alternate"
|
|
229
|
+
hreflang="x-default"
|
|
230
|
+
href={new URL(
|
|
231
|
+
getLocalizedUrl(Astro.url.pathname, defaultLocale),
|
|
232
|
+
Astro.site
|
|
233
|
+
)}
|
|
234
|
+
/>
|
|
192
235
|
</head>
|
|
193
236
|
<body>
|
|
194
|
-
<
|
|
237
|
+
<header>
|
|
238
|
+
<LocaleSwitcher />
|
|
239
|
+
</header>
|
|
240
|
+
<main>
|
|
241
|
+
<h1>{title}</h1>
|
|
242
|
+
</main>
|
|
195
243
|
</body>
|
|
196
244
|
</html>
|
|
197
245
|
```
|
|
@@ -145,49 +145,6 @@ const helloWorldContent = {
|
|
|
145
145
|
export default helloWorldContent;
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
```tsx fileName="hello-world.es.content.mjs" contentDeclarationFormat="esm"
|
|
149
|
-
import { t, Locales } from "intlayer";
|
|
150
|
-
|
|
151
|
-
/** @type {import('intlayer').Dictionary} */
|
|
152
|
-
const helloWorldContent = {
|
|
153
|
-
key: "hello-world",
|
|
154
|
-
locale: Locales.SPANISH, // 중요
|
|
155
|
-
content: { multilingualContent: "Título de mi componente" },
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
export default helloWorldContent;
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
```js fileName="hello-world.en.content.cjs" contentDeclarationFormat="commonjs"
|
|
162
|
-
const { t, Locales } = require("intlayer");
|
|
163
|
-
|
|
164
|
-
/** @type {import('intlayer').Dictionary} */
|
|
165
|
-
const helloWorldContent = {
|
|
166
|
-
key: "hello-world",
|
|
167
|
-
locale: Locales.ENGLISH, // 중요
|
|
168
|
-
content: {
|
|
169
|
-
multilingualContent: "내 컴포넌트의 제목",
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
module.exports = helloWorldContent;
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
```tsx fileName="hello-world.es.content.cjs" contentDeclarationFormat="commonjs"
|
|
177
|
-
const { t, Locales } = require("intlayer");
|
|
178
|
-
|
|
179
|
-
/** @type {import('intlayer').Dictionary} */
|
|
180
|
-
const helloWorldContent = {
|
|
181
|
-
key: "hello-world",
|
|
182
|
-
locale: Locales.SPANISH, // 중요
|
|
183
|
-
content: {
|
|
184
|
-
multilingualContent: "Título de mi componente",
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
module.exports = helloWorldContent;
|
|
189
|
-
```
|
|
190
|
-
|
|
191
148
|
```json5 fileName="hello-world.en.content.json" contentDeclarationFormat="json"
|
|
192
149
|
{
|
|
193
150
|
"$schema": "https://intlayer.org/schema.json",
|