import i18n from 'i18next'; import { httpJson } from '../utils/http'; import { toBackendLocaleFromLanguageTag } from '../i18n/locale'; export type LegalLinks = { privacyPolicyUrl: string; termsOfUseUrl: string; resolvedLang: 'en' | 'tc'; }; export function buildAcceptLanguage(): 'en' | 'tc' { // 当前多语言仅支持 EN / TC;其他语言统一回退到 en return toBackendLocaleFromLanguageTag(i18n.language); } export async function fetchLegalLinks(): Promise { const headers: Record = { 'Accept-Language': buildAcceptLanguage(), }; return await httpJson({ path: '/v1/legal/links', method: 'GET', headers, timeoutMs: 8_000, debugLabel: 'LegalLinks', }); }