refactor(i18n): simplify language handling across components
use Astro.currentLocale as single source of truth for language remove manual lang prop passing to components components now read language from document lang attribute
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
---
|
||||
import BlogLayout from '../../../layouts/BlogLayout.astro';
|
||||
import BlogList from '../../../components/BlogList.tsx';
|
||||
import { type Lang } from '@/i18n/utils';
|
||||
import { defaultLang } from '@/i18n/ui';
|
||||
|
||||
// 使用Astro.currentLocale获取当前语言环境
|
||||
const lang = Astro.currentLocale as Lang || defaultLang;
|
||||
|
||||
// 示例博客数据 - 暂时内联
|
||||
const blogPosts = [
|
||||
|
||||
Reference in New Issue
Block a user