From b27777b625fb348f35e435276842668e16456967 Mon Sep 17 00:00:00 2001
From: NtskwK <natsukawa247@outlook.com>
Date: Tue, 3 Feb 2026 11:19:09 +0800
Subject: feat(i18n): add multi-language support for docs

---
 packages/docs/app/routes/docs.tsx | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'packages/docs/app/routes/docs.tsx')

diff --git a/packages/docs/app/routes/docs.tsx b/packages/docs/app/routes/docs.tsx
index a1c1707..5154d27 100644
--- a/packages/docs/app/routes/docs.tsx
+++ b/packages/docs/app/routes/docs.tsx
@@ -1,6 +1,16 @@
 import type { Route } from './+types/docs';
 import { redirect } from 'react-router';
 
-export function loader({}: Route.LoaderArgs) {
-  return redirect('/docs/en');
+import { i18n } from '@/lib/i18n';
+
+export function loader({ params }: Route.LoaderArgs) {
+  const lang = params.lang as string | undefined;
+  
+  // 如果没有语言参数或是默认语言，重定向到 /docs/getting-started
+  if (!lang || lang === i18n.defaultLanguage) {
+    return redirect('/docs/getting-started');
+  }
+  
+  // 其他语言重定向到 /:lang/docs/getting-started
+  return redirect(`/${lang}/docs/getting-started`);
 }
-- 
cgit v1.2.3-70-g09d2

