@xingwangzhe/stalux 1.27.1 β 2.0.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/README.md
CHANGED
|
@@ -88,7 +88,7 @@ bun run dev
|
|
|
88
88
|
- π€ **LLM discovery files** (llms.txt / llms-full.txt)
|
|
89
89
|
- π€ **WebMCP tools** for AI agents (W3C draft, pure front-end)
|
|
90
90
|
- β‘ **View transitions** for smooth navigation
|
|
91
|
-
- π **i18n** (English /
|
|
91
|
+
- π **i18n** (English / Chinese)
|
|
92
92
|
- π·οΈ **Tags, categories, archives** pages
|
|
93
93
|
- π¨ **Component override system** (Starlight-style)
|
|
94
94
|
- π οΈ **Easy YAML configuration** β no coding required
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ const { t } = createTranslator((siteConfig.lang as string) || "zh-CN");
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
{(props.prev || props.next) && (
|
|
21
|
-
<nav class={style.postNavigation} aria-label=
|
|
21
|
+
<nav class={style.postNavigation} aria-label="ζη« ε―Όθͺ">
|
|
22
22
|
<div class={style.postNavigationInner}>
|
|
23
23
|
{props.prev ? (
|
|
24
24
|
<a
|
package/src/i18n/en.json
CHANGED
package/src/i18n/zh-CN.json
CHANGED
package/src/utils/i18n.ts
CHANGED
|
@@ -12,9 +12,7 @@ export interface Translator {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function createTranslator(lang: string): Translator {
|
|
15
|
-
const
|
|
16
|
-
const language = normalizedLang.startsWith("en") ? "en" : "zh-CN";
|
|
17
|
-
const dict = dicts[language] ?? dicts["zh-CN"] ?? en;
|
|
15
|
+
const dict = dicts[lang] || dicts["zh-CN"];
|
|
18
16
|
|
|
19
17
|
function t(key: string, params?: Record<string, string | number>): string {
|
|
20
18
|
const keys = key.split(".");
|
|
@@ -23,12 +21,12 @@ export function createTranslator(lang: string): Translator {
|
|
|
23
21
|
if (text && typeof text === "object") {
|
|
24
22
|
text = (text as Record<string, unknown>)[k];
|
|
25
23
|
} else {
|
|
26
|
-
return
|
|
24
|
+
return key;
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
if (typeof text !== "string"
|
|
27
|
+
if (typeof text !== "string") return key;
|
|
30
28
|
|
|
31
|
-
let result = text
|
|
29
|
+
let result = text;
|
|
32
30
|
if (params) {
|
|
33
31
|
for (const [k, v] of Object.entries(params)) {
|
|
34
32
|
result = result.replace(`{${k}}`, String(v));
|
|
@@ -37,16 +35,7 @@ export function createTranslator(lang: string): Translator {
|
|
|
37
35
|
return result;
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
return { t, lang
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function lookup(dictionary: Record<string, unknown>, key: string): string | undefined {
|
|
44
|
-
let value: unknown = dictionary;
|
|
45
|
-
for (const part of key.split(".")) {
|
|
46
|
-
if (!value || typeof value !== "object") return;
|
|
47
|
-
value = (value as Record<string, unknown>)[part];
|
|
48
|
-
}
|
|
49
|
-
return typeof value === "string" && value.trim() ? value : undefined;
|
|
38
|
+
return { t, lang };
|
|
50
39
|
}
|
|
51
40
|
|
|
52
41
|
/**
|