/** Labels for resource type filter chips (keys match API `type` + `all`). */ export function typeFilterLabel( t: (key: string) => string, tp: string, ): string { if (tp === "all") return t("filterAll"); return resourceTypeLabel(t, tp); } /** Type label without the "all" filter branch (e.g. admin tables). */ export function resourceTypeDisplay( t: (key: string) => string, type: string, ): string { const key = `type_${type}`; const label = t(key); return label !== key ? label : type; } /** Localized label for API resource `type` (image, video, link, …). */ export function resourceTypeLabel( t: (key: string) => string, type: string, ): string { const key = `type_${type}`; const label = t(key); return label !== key ? label : type; } /** Localized label for resource `language` code (zh-TW, en, …). */ export function resourceLanguageLabel( t: (key: string) => string, langCode: string, ): string { const lc = langCode.trim().toLowerCase(); const key = lc === "zh-tw" ? "lang_zh_TW" : lc === "zh-cn" || lc === "zh-hans" ? "lang_zh_CN" : lc === "en" ? "lang_en" : ""; if (key) { const label = t(key); if (label !== key) return label; } return langCode.trim(); }