Files
template-app/modules/branding/ui/labels.ts
T

48 lines
1.8 KiB
TypeScript

// The labels the brand form takes, built from a message lookup (the same arrangement as the documents
// module's labels.ts: every key is named here so a test can run the builder against both catalogues).
// `t` takes a key relative to the module; `failed` is the app's own `app.failed`, looked up by the page.
import type { BrandFormLabels } from "./brand-form.js"
export type Translate = (key: string, values?: Record<string, string | number>) => string
export function brandFormLabels(t: Translate, failed: string): BrandFormLabels {
// `{theme}` and `{ratio}` are filled by the component, so they are looked up with the placeholder in place.
const keep = (key: string, name: string) => t(key, { [name]: `{${name}}` })
return {
displayName: t("displayName"),
primary: t("primary"),
accent: t("accent"),
colourHint: t("colourHint"),
logoLight: t("logoLight"),
logoDark: t("logoDark"),
logoHint: t("logoHint"),
currentLogo: t("currentLogo"),
logoShows: t("logoShows"),
logoOwn: t("logoOwn"),
logoOther: keep("logoOther", "other"),
logoApp: t("logoApp"),
clearLogo: keep("clearLogo", "theme"),
themeLight: t("themeLight"),
themeDark: t("themeDark"),
save: t("save"),
saved: t("saved"),
readOnly: t("readOnly"),
failed,
preview: {
title: t("preview.title"),
dark: t("preview.dark"),
light: t("preview.light"),
action: t("preview.action"),
link: t("preview.link"),
sample: t("preview.sample"),
fillContrast: keep("preview.fillContrast", "ratio"),
inkContrast: keep("preview.inkContrast", "ratio"),
edgeContrast: keep("preview.edgeContrast", "ratio"),
meets: t("preview.meets"),
below: t("preview.below"),
adjusted: t("preview.adjusted"),
},
}
}