--- import { t, localePath, type Locale } from '../i18n/utils'; import fs from 'node:fs'; import path from 'node:path'; import { marked } from 'marked'; interface Props { locale: Locale; docType: 'privacy_policy' | 'terms_of_service' | 'about_us'; } const { locale, docType } = Astro.props; const footer = t(locale, 'footer'); const titleMap: Record> = { privacy_policy: { zh: '隐私政策', zh_Hant: '隱私政策', en: 'Privacy Policy' }, terms_of_service: { zh: '服务条款', zh_Hant: '服務條款', en: 'Terms of Service' }, }; const subtitleMap: Record> = { privacy_policy: { zh: '最后更新日期:2026年4月27日', zh_Hant: '最後更新日期:2026年4月27日', en: 'Last updated: April 27, 2026' }, terms_of_service: { zh: '最后更新日期:2026年4月27日', zh_Hant: '最後更新日期:2026年4月27日', en: 'Last updated: April 27, 2026' }, }; const warningMap: Record = { zh: { title: '特别提醒', body: '本 App 所有 AI 生成内容与文化解读资料,仅作娱乐、文化赏析与个人参考使用。本应用不提供任何专业指导建议,包括但不限于商业、金融、投资、医疗、心理、法律、职业及人生决策等领域。所有生成内容不得作为事实依据或行动决策的唯一标准。开发者不对用户的个人选择、行为及衍生后果承担任何法律责任。请理性看待传统文化,理性使用本应用。', }, zh_Hant: { title: '特別提醒', body: '本 App 所有 AI 生成內容與文化解讀資料,僅作娛樂、文化賞析與個人參考使用。本應用不提供任何專業指導建議,包括但不限於商業、金融、投資、醫療、心理、法律、職業及人生決策等領域。所有生成內容不得作為事實依據或行動決策的唯一標準。開發者不對用戶的個人選擇、行為及衍生後果承擔任何法律責任。請理性看待傳統文化,理性使用本應用。', }, en: { title: 'Important Disclaimer', body: 'All AI-generated content and cultural interpretation materials in this App are for entertainment, cultural appreciation, and personal reference only. This app does not provide any professional guidance or advice, including but not limited to business, finance, investment, medical, psychological, legal, career, and life decisions. All generated content should not be used as factual evidence or the sole basis for decision-making. The developer assumes no legal responsibility for users\' personal choices, actions, and consequences. Please approach traditional culture rationally and use this app wisely.', }, }; const legalTitleMap: Record = { zh: '法律条款', zh_Hant: '法律條款', en: 'Legal', }; const title = titleMap[docType]?.[locale] ?? ''; const subtitle = subtitleMap[docType]?.[locale] ?? ''; const warning = warningMap[locale]; const legalTitle = legalTitleMap[locale]; // Try multiple paths for dev and production environments const possiblePaths = [ path.resolve('public/legal', locale, `${docType}.md`), path.resolve('client/legal', locale, `${docType}.md`), path.resolve('../client/legal', locale, `${docType}.md`), ]; let raw = ''; for (const filePath of possiblePaths) { try { raw = fs.readFileSync(filePath, 'utf-8'); raw = raw.replace(/^#\s+.+\n*/m, ''); break; } catch { // Try next path } } if (!raw) { raw = `Content not available.`; } const content = await marked(raw); const sideInfo: Record> = { privacy_policy: { zh: { type: '隐私政策', date: '2026年4月27日', email: 'feedback@xunmee.com' }, zh_Hant: { type: '隱私政策', date: '2026年4月27日', email: 'feedback@xunmee.com' }, en: { type: 'Privacy Policy', date: 'April 27, 2026', email: 'feedback@xunmee.com' }, }, terms_of_service: { zh: { type: '服务条款', date: '2026年4月27日', law: '美国加利福尼亚州法律', email: 'feedback@xunmee.com' }, zh_Hant: { type: '服務條款', date: '2026年4月27日', law: '美國加利福尼亞州法律', email: 'feedback@xunmee.com' }, en: { type: 'Terms of Service', date: 'April 27, 2026', law: 'California, USA', email: 'feedback@xunmee.com' }, }, }; const info = sideInfo[docType]?.[locale]; const isActive = (linkType: string) => linkType === docType; ---

{title}

{subtitle}

{info && (

{locale === 'en' ? 'Document Info' : '文档信息'}

{locale === 'en' ? 'Type' : '文档类型'}

{info.type}

{locale === 'en' ? 'Last Updated' : '最后更新'}

{info.date}

{info.law && (

{locale === 'en' ? 'Governing Law' : '适用法律'}

{info.law}

)}

{locale === 'en' ? 'Contact' : '联系邮箱'}

{info.email}

)}

{warning.title}

{warning.body}