From 168d48689a051e59bc9ee9a1141445ac4a9d3a3e Mon Sep 17 00:00:00 2001 From: tequ Date: Mon, 20 Apr 2026 21:07:15 +0900 Subject: [PATCH 1/6] fix: make ecosystem page header text translatable --- src/components/XahauEcosystem.astro | 6 +++--- src/data/ecosystem.json | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/XahauEcosystem.astro b/src/components/XahauEcosystem.astro index 198c584..1990c9a 100644 --- a/src/components/XahauEcosystem.astro +++ b/src/components/XahauEcosystem.astro @@ -64,13 +64,13 @@ const sections = ecosystemData.sections.map((section) =>

Ecosystem

- {sections.map(s => s.label['en']).join(', ')} - built on or around Xahau + {sections.map(s => s.label[locale]).join(', ')} + {ecosystemData.buildonxahau[locale]}

{sections.map(s => ( - {s.items.length} {s.label['en']} + {s.items.length} {s.label[locale]} ))}
diff --git a/src/data/ecosystem.json b/src/data/ecosystem.json index 8d738fe..f9fd766 100644 --- a/src/data/ecosystem.json +++ b/src/data/ecosystem.json @@ -1,4 +1,9 @@ { + "buildonxahau": { + "en": "built on or around Xahau", + "es": "creados en Xahau o en torno a ella", + "ja": "がXahauを利用して構築しています" + }, "sections": [ { "id": "enterprise", From f1e2251b7556a0e51527005d1bf8db87a72b0178 Mon Sep 17 00:00:00 2001 From: tequ Date: Mon, 20 Apr 2026 21:14:42 +0900 Subject: [PATCH 2/6] translate ecosystem page title --- src/components/XahauEcosystem.astro | 2 +- src/data/ecosystem.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/XahauEcosystem.astro b/src/components/XahauEcosystem.astro index 1990c9a..495bee3 100644 --- a/src/components/XahauEcosystem.astro +++ b/src/components/XahauEcosystem.astro @@ -62,7 +62,7 @@ const sections = ecosystemData.sections.map((section) =>
-

Ecosystem

+

{ecosystemData.title[locale]}

{sections.map(s => s.label[locale]).join(', ')} {ecosystemData.buildonxahau[locale]} diff --git a/src/data/ecosystem.json b/src/data/ecosystem.json index f9fd766..33082d1 100644 --- a/src/data/ecosystem.json +++ b/src/data/ecosystem.json @@ -1,4 +1,9 @@ { + "title": { + "en": "Ecosystem", + "es": "Ecosistema", + "ja": "エコシステム" + }, "buildonxahau": { "en": "built on or around Xahau", "es": "creados en Xahau o en torno a ella", From 0dcebe39d0ec0de8fb20ac7816fa35f8618dca0e Mon Sep 17 00:00:00 2001 From: tequ Date: Tue, 21 Apr 2026 01:51:03 +0900 Subject: [PATCH 3/6] refactor: centralize locale definitions into i18n/locales.ts --- src/components/CookieConsent.astro | 3 +- src/components/Footer.astro | 6 +- src/components/XahauConnect.astro | 4 +- src/components/XahauEcosystem.astro | 4 +- src/components/XahauHome.astro | 4 +- src/i18n/fraudReportTranslations.ts | 608 +++++++++++++------------- src/i18n/indexTranslations.ts | 2 - src/i18n/locales.ts | 7 + src/layouts/BaseLayout.astro | 3 +- src/layouts/DocsLayout.astro | 7 +- src/layouts/IndexLayout.astro | 4 +- src/plugins/remarkGlobalReferences.ts | 5 +- src/utils/localizedHref.ts | 3 +- 13 files changed, 336 insertions(+), 324 deletions(-) create mode 100644 src/i18n/locales.ts diff --git a/src/components/CookieConsent.astro b/src/components/CookieConsent.astro index b2aa076..d2d396a 100644 --- a/src/components/CookieConsent.astro +++ b/src/components/CookieConsent.astro @@ -1,8 +1,9 @@ --- import 'vanilla-cookieconsent/dist/cookieconsent.css' import { createCookieConsentConfig } from '../CookieConsentConfig' +import { defaultLocale, type Locale } from '../i18n/locales' -const locale = (Astro.currentLocale ?? 'en') as 'en' | 'es' | 'ja' +const locale = (Astro.currentLocale ?? defaultLocale) as Locale const cookieConsentConfig = createCookieConsentConfig(locale) --- diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 48a97e5..374093c 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -2,8 +2,9 @@ import { Image } from 'astro:assets' import { getRelativeLocaleUrl } from 'astro:i18n' import logo from '../assets/xahau-logo.svg' +import { defaultLocale, type Locale } from '../i18n/locales' -const locale = Astro.currentLocale ?? 'en' +const locale = Astro.currentLocale ?? defaultLocale const translations = { en: { @@ -68,8 +69,7 @@ const translations = { }, } -type Locale = 'en' | 'es' | 'ja' -const t = translations[locale as Locale] || translations.en +const t = translations[locale as Locale] || translations[defaultLocale] ---