@intlayer/docs 8.7.8 → 8.7.10
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
|
@@ -56,36 +56,6 @@ history:
|
|
|
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("你好,我的名字是 {{name}},我今年 {{age}} 岁!"),
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
module.exports = myInsertionContent;
|
|
87
|
-
```
|
|
88
|
-
|
|
89
59
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
90
60
|
{
|
|
91
61
|
"$schema": "https://intlayer.org/schema.json",
|
|
@@ -116,30 +86,6 @@ history:
|
|
|
116
86
|
export default myInsertionContent;
|
|
117
87
|
```
|
|
118
88
|
|
|
119
|
-
```javascript fileName="**/*.content.mjs" contentDeclarationFormat="esm"
|
|
120
|
-
/** @type {import('intlayer').Dictionary} */
|
|
121
|
-
const myInsertionContent = {
|
|
122
|
-
key: "my_key",
|
|
123
|
-
content: {
|
|
124
|
-
myInsertion: "你好,我的名字是 {{name}},我今年 {{age}} 岁!",
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export default myInsertionContent;
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
```javascript fileName="**/*.content.cjs" contentDeclarationFormat="commonjs"
|
|
132
|
-
/** @type {import('intlayer').Dictionary} */
|
|
133
|
-
const myInsertionContent = {
|
|
134
|
-
key: "my_key",
|
|
135
|
-
content: {
|
|
136
|
-
myInsertion: "你好,我的名字是 {{name}},我今年 {{age}} 岁!",
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
module.exports = myInsertionContent;
|
|
141
|
-
```
|
|
142
|
-
|
|
143
89
|
```json5 fileName="**/*.content.json" contentDeclarationFormat="json"
|
|
144
90
|
{
|
|
145
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,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
|
-
// 定义一个字典类型的内容对象
|
|
153
|
-
const helloWorldContent = {
|
|
154
|
-
key: "hello-world",
|
|
155
|
-
locale: Locales.SPANISH, // 重要
|
|
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, // 重要
|
|
169
|
-
content: {
|
|
170
|
-
multilingualContent: "我的组件标题",
|
|
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, // 重要
|
|
184
|
-
content: {
|
|
185
|
-
multilingualContent: "我的组件标题",
|
|
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/docs",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Intlayer documentation",
|
|
6
6
|
"keywords": [
|
|
@@ -72,13 +72,13 @@
|
|
|
72
72
|
"watch": "webpack --config ./webpack.config.ts --watch"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@intlayer/config": "8.7.
|
|
76
|
-
"@intlayer/core": "8.7.
|
|
77
|
-
"@intlayer/types": "8.7.
|
|
75
|
+
"@intlayer/config": "8.7.10",
|
|
76
|
+
"@intlayer/core": "8.7.10",
|
|
77
|
+
"@intlayer/types": "8.7.10"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@intlayer/api": "8.7.
|
|
81
|
-
"@intlayer/cli": "8.7.
|
|
80
|
+
"@intlayer/api": "8.7.10",
|
|
81
|
+
"@intlayer/cli": "8.7.10",
|
|
82
82
|
"@types/node": "25.6.0",
|
|
83
83
|
"@utils/ts-config": "1.0.4",
|
|
84
84
|
"@utils/ts-config-types": "1.0.4",
|