@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 / Simplified Chinese; missing locale keys fall back to 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xingwangzhe/stalux",
3
- "version": "1.27.1",
3
+ "version": "2.0.0",
4
4
  "description": "A powerful, modern Astro blog theme β€” use as template or install as plugin",
5
5
  "keywords": [
6
6
  "astro",
@@ -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={t("post.navigation")}>
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
@@ -24,7 +24,6 @@
24
24
  "backHome": "Back to Home"
25
25
  },
26
26
  "post": {
27
- "navigation": "Post navigation",
28
27
  "publishTime": "Published: ",
29
28
  "updateTime": "Updated: ",
30
29
  "readingTime": "πŸ•’ Reading time: ",
@@ -24,7 +24,6 @@
24
24
  "backHome": "θΏ”ε›žι¦–ι‘΅"
25
25
  },
26
26
  "post": {
27
- "navigation": "ζ–‡η« ε―Όθˆͺ",
28
27
  "publishTime": "ε‘εΈƒζ—Άι—΄οΌš",
29
28
  "updateTime": "ζ›΄ζ–°ζ—Άι—΄οΌš",
30
29
  "readingTime": "πŸ•’ ι˜…θ―»ζ—Άι—΄οΌš",
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 normalizedLang = lang.toLowerCase();
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 lookup(en, key) ?? key;
24
+ return key;
27
25
  }
28
26
  }
29
- if (typeof text !== "string" || !text.trim()) text = lookup(en, key) ?? key;
27
+ if (typeof text !== "string") return key;
30
28
 
31
- let result = text as string;
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: language };
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
  /**