fix(i18n): retain historical checklist text for unknown system keys

This commit is contained in:
cesnimda
2026-11-02 22:55:38 +01:00
parent fae2f760cd
commit 4a3da3319e
5 changed files with 125 additions and 5 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
import { api } from "./api";
import { translations } from "./i18n/translations";
// Mirrors WorkspaceOverviewDto. Read-only aggregate — the workspace owns no data.
export type WorkspaceCv = {
@@ -93,7 +94,9 @@ export const WORKSPACE_SECTIONS: { key: WorkspaceSectionKey; label: string }[] =
export function checklistSystemTranslationToken(systemKey?: string | null): string | null {
if (!systemKey || systemKey.startsWith("learning:")) return null;
return systemKey.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase());
const token = systemKey.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase());
return Object.hasOwn(translations.en, `checklistItem_${token}`)
&& Object.hasOwn(translations.en, `checklistItem_${token}Description`) ? token : null;
}
const LEGACY_WORKSPACE_SECTIONS: Record<string, WorkspaceSectionKey> = {