- @intecion/ipal-kit/blocks: libraryBlocks() opt-in, one builder per block, field
builders, option merging, blockLibraryManifest, faqItemsFromLayout
- @intecion/ipal-kit/blocks/rsc: createBlockRegistry, the block components and UI
primitives (token utilities only; next/image and next/link passed in)
- @intecion/ipal-kit/templates: 10 page templates as createSeeder data
- createSeeder: { $form: title } references
- ipal-blocks eject <block>
- tests: options, rendering and a11y per block, Payload + seeding, GraphQL, admin
wording, schema snapshot (versioning), eject imports
- shorter admin labels: link "New tab", table of contents "Show contents"
Co-Authored-By: Claude Opus 5.5 <[email protected]>
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
/**
|
|
* Visitor-facing texts the library blocks render themselves (everything else comes from the panel).
|
|
* English and Polish ship; another language, or other words: createBlockRegistry({ texts }).
|
|
*/
|
|
export type BlockTexts = {
|
|
/** Screen-reader text for a star rating. {value} = the rating. */
|
|
rating: string
|
|
/** Screen-reader text after a step number. {value} = the number. */
|
|
step: string
|
|
}
|
|
|
|
export const BLOCK_TEXTS: Record<'en' | 'pl', BlockTexts> = {
|
|
en: { rating: 'Rated {value} out of 5', step: 'Step {value}' },
|
|
pl: { rating: 'Ocena: {value} na 5', step: 'Krok {value}' },
|
|
}
|
|
|
|
/** The texts for a page locale: the project's own first, then Polish for `pl…`, else English. */
|
|
export function blockTexts(locale: string, own?: Partial<Record<string, Partial<BlockTexts>>>): BlockTexts {
|
|
const base = locale.toLowerCase().startsWith('pl') ? BLOCK_TEXTS.pl : BLOCK_TEXTS.en
|
|
return { ...base, ...own?.[locale] }
|
|
}
|
|
|
|
export const fillText = (text: string, value: number | string) => text.replace('{value}', String(value))
|