Files
GerbilManager/gerbil-manager-web/src/format/traits.ts

16 lines
564 B
TypeScript

/** FEAT-14: map character trait KEYS (stored) <-> German LABELS (de.character.traits). */
import { de } from '../strings/de'
export const ALL_TRAITS = de.character.traits
const LABEL_BY_KEY = new Map<string, string>(de.character.traits.map((t) => [t.key, t.label]))
export function traitLabel(key: string): string {
return LABEL_BY_KEY.get(key) ?? key
}
/** Selected keys -> German labels (for display + the AI sale-text prompt). */
export function traitLabels(keys: readonly string[] | null | undefined): string[] {
return (keys ?? []).map(traitLabel)
}