Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
3da1cf1
feat(i18n): finalise en-GB translation file with all template strings
alexluckett Apr 16, 2026
05b0179
feat(i18n): add i18next module with en-GB initialisation and t() wrapper
alexluckett Apr 16, 2026
b6385a5
feat(i18n): add buildValidationMessages factory
alexluckett Apr 16, 2026
475b583
feat(i18n): add language and validationMessages to FormModel
alexluckett Apr 16, 2026
6653669
feat(i18n): rebuild messageTemplate from buildValidationMessages factory
alexluckett Apr 16, 2026
524efd3
feat(i18n): translate DatePartsField and MonthYearField sub-labels
alexluckett Apr 16, 2026
655f133
feat(i18n): translate UkAddressField sub-labels
alexluckett Apr 16, 2026
4174c73
feat(i18n): translate LatLongField and EastingNorthingField strings
alexluckett Apr 16, 2026
e4811d3
feat(i18n): translate LocationFieldBase, NationalGridField, OsGridRef…
alexluckett Apr 17, 2026
a7632e9
feat(i18n): translate DeclarationField and GeospatialField strings
alexluckett Apr 17, 2026
c41db71
feat(i18n): translate PaymentField and FileUploadField runtime strings
alexluckett Apr 17, 2026
2c21615
feat(i18n): translate optionalText in FormComponent.getViewModel
alexluckett Apr 17, 2026
0fd0c4f
feat(i18n): translate SummaryViewModel and SummaryPageController paym…
alexluckett Apr 17, 2026
94e3bca
feat(i18n): translate all RepeatPageController hardcoded strings
alexluckett Apr 17, 2026
1f1cb2c
feat(i18n): register t() as Nunjucks global with en-GB fallback
alexluckett Apr 17, 2026
74bd913
feat(i18n): wire per-request t() into all page controller view models
alexluckett Apr 17, 2026
3fbb5ca
feat(i18n): replace all hardcoded strings in HTML templates with t() …
alexluckett Apr 17, 2026
5083ad3
feat(i18n): fix TypeScript errors — JSON import attribute and Nunjuck…
alexluckett Apr 17, 2026
84d6a4d
Add missing translations
alexluckett Apr 17, 2026
f2362d2
wire in remaining translation keys
alexluckett Apr 17, 2026
065ffc6
move component errors into component block
alexluckett Apr 17, 2026
13d06d0
feat(i18n): add FormModel.t() method — language-bound translation helper
alexluckett Apr 17, 2026
f666c5a
docs(i18n): document FormModel.t() language-binding intent
alexluckett Apr 17, 2026
99db942
refactor(i18n): location field subclasses use model.t() instead of t(…
alexluckett Apr 17, 2026
7ea790e
refactor(i18n): page controllers use model.t() instead of t(key, mode…
alexluckett Apr 17, 2026
0c8c1bf
fix(test): add model.t() to PaymentField dispatcher test mocks
alexluckett Apr 17, 2026
77a8200
Add translation helper in model to reduce repeated language prop access
alexluckett Apr 17, 2026
874f604
refactor(i18n): SummaryViewModel uses model.t() instead of t(key, lang)
alexluckett Apr 17, 2026
14f1ba1
feat(i18n): add pirate translation and simple-form-pirate demo
alexluckett Apr 17, 2026
46f372e
feat(i18n): fully pirate all keys in x-pirate translation
alexluckett Apr 17, 2026
38c602f
fix: revert date part field titles to hardcoded strings
alexluckett Apr 20, 2026
a35bf67
fix: extract payment cancelled banner html to a variable
alexluckett Apr 20, 2026
c02f7bf
sample
alexluckett Apr 20, 2026
22bf3b3
Revert "fix: revert date part field titles to hardcoded strings"
alexluckett Apr 20, 2026
a5d40e5
Revert "fix: extract payment cancelled banner html to a variable"
alexluckett Apr 20, 2026
84404be
feat(i18n): add FormDefinitionTranslations, TContentFunction and Tran…
alexluckett Apr 24, 2026
a62af1b
feat(i18n): add extractBaseTranslations to seed en-GB form namespace
alexluckett Apr 24, 2026
1f7c64b
feat(i18n): add createFormI18nInstance factory for per-FormModel i18n…
alexluckett Apr 24, 2026
75c3572
feat(i18n): add getLanguage callback to PluginOptions
alexluckett Apr 24, 2026
d8fee97
feat(i18n): add createTranslator to FormModel with per-form i18next i…
alexluckett Apr 25, 2026
fb04bb1
fix(i18n): remove dead fallbackLng per-call option; assert exact x-pi…
alexluckett Apr 25, 2026
7b632cb
feat(i18n): store date/month-year sub-field titles as i18next key con…
alexluckett Apr 25, 2026
3be964a
test(i18n): annotate key-constant-in-error-message assertions as temp…
alexluckett Apr 25, 2026
104e0b1
feat(i18n): store address/location sub-field titles as i18next key co…
alexluckett Apr 25, 2026
cc33258
fix(i18n): remove out-of-scope language field from UkAddressField dis…
alexluckett Apr 25, 2026
e5fb12f
feat(i18n): add language field to adapter meta payload
alexluckett Apr 25, 2026
41cc075
feat(i18n): FormComponent.getViewModel accepts Translator; fix tConte…
alexluckett Apr 25, 2026
659bc8d
feat(i18n): wire Translator through ComponentCollection, FileUploadFi…
alexluckett Apr 25, 2026
247d801
feat(i18n): postcode-lookup language support and i18n text extraction
alexluckett Apr 25, 2026
dc6fa12
feat(i18n): ComponentCollection.validate accepts Translator for per-r…
alexluckett Apr 25, 2026
08e3368
feat(i18n): PageController and QuestionPageController use per-request…
alexluckett Apr 25, 2026
0788997
feat(i18n): RepeatPageController uses per-request translator instead …
alexluckett Apr 25, 2026
37e148c
feat(i18n): SummaryViewModel and SummaryPageController use per-reques…
alexluckett Apr 27, 2026
f95eb6d
feat(i18n): wire per-request Translator through DeclarationField, Fil…
alexluckett Apr 27, 2026
a341d1f
feat(i18n): PaymentField.dispatcher and onSubmit use per-request tran…
alexluckett Apr 27, 2026
2ef58a2
feat(i18n): thread Translator through getFormContext, validateFormPay…
alexluckett Apr 27, 2026
d891f7d
feat(i18n): replace model.validationMessages with static messageTempl…
alexluckett Apr 27, 2026
9e62b11
feat(i18n): remove model.t/language/validationMessages; require Trans…
alexluckett Apr 27, 2026
8d92f3c
add welsh devtool simple-form
alexluckett Apr 27, 2026
ba14b07
feat(i18n): eliminate Translator|FormQuery union; thread translator t…
alexluckett Apr 27, 2026
5cb37e2
feat(i18n): add Welsh (cy) translations
alexluckett Apr 28, 2026
d7a18b0
fix(i18n): apply translated shortDescription as Joi label at validati…
alexluckett Apr 28, 2026
bbae7e0
fix(i18n): use translated shortDescription and title in summary table…
alexluckett Apr 29, 2026
c296543
feat(i18n): persist language preference in session; register t as nun…
alexluckett Apr 29, 2026
6273811
fix(i18n): thread translator through FileUploadField.getDisplayString…
alexluckett Apr 29, 2026
a64a82e
fix(i18n): translate composite sub-field labels/messages and Declarat…
alexluckett Apr 29, 2026
477e39d
fix(i18n): pass language to postcode lookup dispatch so journey rende…
alexluckett Apr 29, 2026
2bac7ee
fix(i18n): translate YesNo/list items, DeclarationField validation, s…
alexluckett Apr 30, 2026
0c06899
add welsh devtool about-you page with YesNo and radios demo
alexluckett Apr 30, 2026
d02cf8b
fix(i18n): resolve plugin i18n keys for list items with GUIDs; transl…
alexluckett Apr 30, 2026
d22e359
refactor(i18n): encapsulate translator resolution in PageController; …
alexluckett Apr 30, 2026
db5ca66
swap translation functions with separates per type
alexluckett Apr 30, 2026
fe7a9fc
tidy up signatures
alexluckett Apr 30, 2026
e24d5a0
refactor(i18n): make translator required on all rendering methods; el…
alexluckett Apr 30, 2026
d15fc68
Stash for rebase
jbarnsley10 Jun 24, 2026
bdf42dc
Merge branch 'main' into feature/i18n-linting
jbarnsley10 Jun 24, 2026
e1570a7
Stash
jbarnsley10 Jun 24, 2026
fc6e221
Fixed types
jbarnsley10 Jun 25, 2026
555ba02
Temp stash with only 3 test suites failing
jbarnsley10 Jun 25, 2026
56e9023
Further test fixes
jbarnsley10 Jun 25, 2026
e5fcfc1
Consolidated language methods
jbarnsley10 Jun 26, 2026
0a21a64
Fixed code/test
jbarnsley10 Jun 29, 2026
804ae6a
Fixed auto-doc generation + added remain welsh translations
jbarnsley10 Jun 29, 2026
ca810df
Merge branch 'main' into feature/i18n-linting
jbarnsley10 Jun 29, 2026
1ac4b11
Sonar fixes - part 1
jbarnsley10 Jun 29, 2026
86efc3a
Prettified
jbarnsley10 Jun 29, 2026
58550af
Sonar fixes (Remove nested ternary)
davidjamesstone Jun 29, 2026
389f9ef
Form root-level translations + language property
jbarnsley10 Jun 30, 2026
b540fec
Merge branch 'feature/i18n-linting' of https://github.com/DEFRA/forms…
jbarnsley10 Jun 30, 2026
42b308a
Prettified + extra tests
jbarnsley10 Jun 30, 2026
95772c8
Removed TODO
jbarnsley10 Jun 30, 2026
4b61a20
Changed Welsh name in language options
jbarnsley10 Jun 30, 2026
e8aa36a
Update getLanguage typing
davidjamesstone Jun 30, 2026
95c9235
Merge branch 'feature/i18n-linting' of https://github.com/defra/forms…
davidjamesstone Jul 1, 2026
66189b5
Add GetLanguageHandler interface
davidjamesstone Jul 1, 2026
7068d03
Add context to the status page view model
davidjamesstone Jul 2, 2026
196d135
Handles hint for list items
jbarnsley10 Jul 3, 2026
dc56e76
Merge branch 'main' into feature/i18n-linting
jbarnsley10 Jul 3, 2026
42ae8a8
Handles multi-language for Markdown
jbarnsley10 Jul 3, 2026
156bca6
Add createFormTranslator helper
davidjamesstone Jul 3, 2026
a383b54
Merge branch 'feature/i18n-linting' of https://github.com/defra/forms…
davidjamesstone Jul 3, 2026
3129cf7
Fixed linting errors
jbarnsley10 Jul 7, 2026
03af5b0
Passes metadata into FormModel for translator
jbarnsley10 Jul 7, 2026
ed4b9cc
Handles metadata child structures
jbarnsley10 Jul 8, 2026
bfe275a
Translates all entries in confirmation page
jbarnsley10 Jul 8, 2026
51c4ea1
Removed metadata param for translator
jbarnsley10 Jul 9, 2026
4456ecb
Resolved test issues
jbarnsley10 Jul 9, 2026
f9468aa
Corrected params for getLanguage
jbarnsley10 Jul 9, 2026
6d51c2c
Possible fix for page/component titles
jbarnsley10 Jul 9, 2026
0f3597f
Fixed page title logic
jbarnsley10 Jul 9, 2026
b12ddb0
Handles submission guidance
jbarnsley10 Jul 10, 2026
17b4a67
Corrected status page flow
jbarnsley10 Jul 10, 2026
0d68e89
Added doc file
jbarnsley10 Jul 13, 2026
f49dbf0
After review
jbarnsley10 Jul 13, 2026
c88728b
Fixed parent title override
jbarnsley10 Jul 14, 2026
97bdb08
Changes after review
jbarnsley10 Jul 15, 2026
14d7460
Reinstated language as property of translator
jbarnsley10 Jul 15, 2026
2043ae2
Added extra type exports
jbarnsley10 Jul 15, 2026
fd3b3d7
Updated docs
jbarnsley10 Jul 15, 2026
0e15142
Corrected language list
jbarnsley10 Jul 16, 2026
a4727ec
Handles repeat name + other fixes
jbarnsley10 Jul 16, 2026
7dad22c
Removed pirate form
jbarnsley10 Jul 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 28 additions & 15 deletions docs/features/code-based/page-controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,18 @@ Both are imported from `@defra/forms-engine-plugin/controllers/<ClassName>.js`.

## Examples

- [Changing the Nunjucks template](#changing-the-nunjucks-template)
- [Fetching data for the view model](#fetching-data-for-the-view-model)
- [Intercepting the GET handler](#intercepting-the-get-handler)
- [Writing to state on POST](#writing-to-state-on-post)
- [Display-only page (no form components)](#display-only-page-no-form-components)
- [Custom page controllers](#custom-page-controllers)
- [How it works](#how-it-works)
- [Choosing a base class](#choosing-a-base-class)
- [Examples](#examples)
- [Changing the Nunjucks template](#changing-the-nunjucks-template)
- [Fetching data for the view model](#fetching-data-for-the-view-model)
- [Intercepting the GET handler](#intercepting-the-get-handler)
- [Writing to state on POST](#writing-to-state-on-post)
- [Display-only page (no form components)](#display-only-page-no-form-components)
- [Reference](#reference)
- [What QuestionPageController gives you](#what-questionpagecontroller-gives-you)
- [Overridable members](#overridable-members)

### Changing the Nunjucks template

Expand Down Expand Up @@ -99,11 +106,14 @@ class SelectGrantSchemeController extends QuestionPageController {
return async (request: FormRequest, context: FormContext, h: FormResponseToolkit) => {
const farmType = context.state.farmType

// Support for multiple languages
const translator = this.getTranslator(request)

// Fetch grant schemes available for the user's farm type
const grantSchemes = await getEligibleGrantSchemes(farmType)

// Build the standard view model and add the fetched data
const viewModel = this.getViewModel(request, context)
const viewModel = this.getViewModel(request, context, translator)

return h.view(this.viewName, { ...viewModel, grantSchemes })
}
Expand Down Expand Up @@ -153,9 +163,12 @@ import type { FormContext, FormRequestPayload, FormResponseToolkit } from '@defr
class PassportLookupController extends QuestionPageController {
makePostRouteHandler() {
return async (request: FormRequestPayload, context: FormContext, h: FormResponseToolkit) => {
// Support for multiple languages
const translator = this.getTranslator(request)

// Re-render with component validation errors if any
if (context.errors) {
const viewModel = this.getViewModel(request, context)
const viewModel = this.getViewModel(request, context, translator)
return h.view(this.viewName, viewModel)
}

Expand All @@ -167,7 +180,7 @@ class PassportLookupController extends QuestionPageController {
if (!passport) {
// Re-render with a custom error — the input passed component validation
// (format/required checks) but was not found in the external system
const viewModel = this.getViewModel(request, context)
const viewModel = this.getViewModel(request, context, translator)
viewModel.errors = [{ text: 'Passport number not recognised. Check and try again.' }]
return h.view(this.viewName, viewModel)
}
Expand Down Expand Up @@ -222,10 +235,10 @@ class IneligiblePageController extends PageController {

### Overridable members

| Member | Description |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewName` | The Nunjucks template rendered for this page. Defaults to `'index'`. Set `view` on the page definition to override. |
| `allowSaveAndExit` | Whether the "Save and exit" button is shown. `true` on `QuestionPageController`, `false` on `PageController`. Override as a class property to change the default. |
| `getViewModel(request, context)` | Returns the view model passed to the Nunjucks template. Override to add or modify properties synchronously. Only available on `QuestionPageController`. |
| `makeGetRouteHandler()` | Returns the async GET handler function. Override to control page load behaviour, including async data fetching. |
| `makePostRouteHandler()` | Returns the async POST handler function. Override to control form submission behaviour and write custom data to state. |
| Member | Description |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `viewName` | The Nunjucks template rendered for this page. Defaults to `'index'`. Set `view` on the page definition to override. |
| `allowSaveAndExit` | Whether the "Save and exit" button is shown. `true` on `QuestionPageController`, `false` on `PageController`. Override as a class property to change the default. |
| `getViewModel(request, context, translator)` | Returns the view model passed to the Nunjucks template. Override to add or modify properties synchronously. Only available on `QuestionPageController`. |
| `makeGetRouteHandler()` | Returns the async GET handler function. Override to control page load behaviour, including async data fetching. |
| `makePostRouteHandler()` | Returns the async POST handler function. Override to control form submission behaviour and write custom data to state. |
4 changes: 4 additions & 0 deletions docs/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ Drive advanced functionality — such as calling APIs and rendering dynamic cont
### [Code-based Features](./features/code-based)

Implement highly tailored behaviour by writing custom TypeScript/JavaScript that integrates with forms-engine-plugin's extension points.

## [Multi-language support](./multi-language.md)

Multiple languages, specifically English and Welsh, can be configured.
25 changes: 25 additions & 0 deletions docs/features/multi-language.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Multi-language (specifically English and Welsh)

The `engine-plugin` supports multi-languages (if configured).
Additional languages are configured by adding translations json files and adding a `translations` property under the `metadata` property of the form definition.
You can use the Designer to edit Welsh translations for your form (to insert the necessary values in the `metadata.translations` property).

Currently only English and Welsh are configured but other languages could be added if desired.

## Forms engine plugin

The `engine-plugin` handles translations at two levels:

1. Boilerplate text - a translation file per language exists in `plugin` (`en-GB.json` and `cy.json`). These provide English and Welsh for each boilerplate text element, such as the feedback link url and text, or the error summary etc.
2. Dynamic form text - English translations are read from the form definition (such as component title, short description etc), whereas Welsh translations are read from the `metadata.translations.cy` property of the form definition.

The translator is constructed in the constructor of the `FormModel`.

The translator provides a series of functions:

- t(key) - a general translation function that takes a key (for example 'validation.numberMax') and returns either the appropriate English text or Welsh text deending on which is the current language
- tPage(key) - returns the appropriate translations for page elements, such as title, guidance etc.
- tComponent(key) - returns the appropriate translations for components, such as question text, hint, short description etc.
- tSection(key) - returns the appropriate translations for sections
- tListItem(key) - returns the appropriate translations for list items since each list value (e.g from a radio/checkbox etc) must have a translated equivalent
- tForm(key) - returns the appropriate translations for form-level elements. Currently this only handles the form name.
7 changes: 7 additions & 0 deletions jest.setup.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
// Pre-load @defra/forms-model to ensure Joi internals are initialised before any test
// file runs. This prevents a Symbol identity mismatch between the ESM-wrapped Joi
// instance (created by babel-jest) and the CJS Joi instance used by Joi's internal
// Template.isTemplate() check, which occurs when resetModules: true clears the
// registry between tests.
require('@defra/forms-model')

process.env.REDIS_HOST = 'dummy'
process.env.REDIS_KEY_PREFIX = 'forms-designer'
process.env.REDIS_PASSWORD = 'dummy'
Expand Down
46 changes: 39 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
},
"engines": {
"node": ">=22.11.0 <25.0.0",
"npm": ">=10.9.0 <11.6.4"
"npm": ">=10.9.0 <=11.17.0"
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
Expand Down Expand Up @@ -126,6 +126,7 @@
"highlight.js": "^11.11.1",
"http-status-codes": "^2.3.0",
"humanize-duration": "^3.33.1",
"i18next": "^26.0.5",
"ioredis": "^5.8.2",
"joi": "^17.13.3",
"liquidjs": "^10.24.0",
Expand Down
7 changes: 6 additions & 1 deletion scripts/generate-component-previews.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { markdownToHtml } from '@defra/forms-model'

// Static imports so Jest can mock them (dynamic computed-path imports cannot be mocked).
import { createComponent } from '~/src/server/plugins/engine/components/helpers/components.js'
import { stubTranslator } from '~/src/server/plugins/engine/pageControllers/__stubs__/translator.js'
import { environment } from '~/src/server/plugins/nunjucks/environment.js'

// Register the markdown filter that the engine plugin normally adds at server init.
Expand All @@ -26,7 +27,11 @@ export function renderComponent(fixture) {
/** @type {unknown} */ (fixture.model)
)
const component = createComponent(fixture.def, { model })
const viewModel = component.getViewModel(fixture.payload, [])
const viewModel = component.getViewModel({
payload: fixture.payload,
errors: [],
translator: stubTranslator
})

// Apply large label/legend sizing to match how QuestionPageController styles
// a single-component page. isPageHeading is intentionally omitted — setting it
Expand Down
31 changes: 23 additions & 8 deletions scripts/generate-component-previews.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
} from './generate-component-previews.js'

import { createComponent } from '~/src/server/plugins/engine/components/helpers/components.ts'
import { stubTranslator } from '~/src/server/plugins/engine/pageControllers/__stubs__/translator.js'
import { environment } from '~/src/server/plugins/nunjucks/environment.js'

describe('component-preview-fixtures', () => {
Expand Down Expand Up @@ -132,6 +133,10 @@ describe('buildPartialMdx', () => {
describe('renderComponent', () => {
let mockGetViewModel

const mockModel = {
createTranslator: () => stubTranslator
}

beforeEach(() => {
mockGetViewModel = jest.fn().mockReturnValue({
type: 'TextField',
Expand All @@ -145,22 +150,32 @@ describe('renderComponent', () => {
})

it('calls createComponent with def and model from fixture', () => {
renderComponent(fixtures.TextField)
renderComponent({
...fixtures.TextField,
model: mockModel
})
expect(createComponent).toHaveBeenCalledWith(fixtures.TextField.def, {
model: fixtures.TextField.model
model: mockModel
})
})

it('calls getViewModel with payload and empty errors array', () => {
renderComponent(fixtures.TextField)
expect(mockGetViewModel).toHaveBeenCalledWith(
fixtures.TextField.payload,
[]
)
renderComponent({
...fixtures.TextField,
model: mockModel
})
expect(mockGetViewModel).toHaveBeenCalledWith({
payload: {},
errors: [],
translator: stubTranslator
})
})

it('passes viewModel wrapped as { type, model } to renderString', () => {
renderComponent(fixtures.TextField)
renderComponent({
...fixtures.TextField,
model: mockModel
})
expect(environment.renderString).toHaveBeenCalledWith(
expect.stringContaining('componentList'),
expect.objectContaining({
Expand Down
30 changes: 21 additions & 9 deletions scripts/page-preview-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ function pageViewContext({
server: { plugins: { 'forms-engine-plugin': {} } }
})
)
const translator = model.createTranslator()
return getViewModelOverride
? getViewModelOverride(controller, model, mockRequest, mockContext)
: controller.getViewModel(/** @type {any} */ (mockRequest), mockContext)
: controller.getViewModel(
/** @type {any} */ (mockRequest),
mockContext,
translator
)
}

const fileUploadWithFilesVariant = /** @type {any} */ (
Expand Down Expand Up @@ -192,13 +197,18 @@ export const pageFixtures = {
]
}
],
getViewModelOverride: (ctrl, _model, req, ctx) => {
getViewModelOverride: (ctrl, model, req, ctx) => {
const repeat = /** @type {RepeatPageController} */ (ctrl)
const vm = repeat.getListSummaryViewModel(req, ctx, [
{ itemId: '1', fullname: 'Sarah Phillips' },
{ itemId: '2', fullname: 'David Jones' },
{ itemId: '3', fullname: 'Emma Wilson' }
])
const vm = repeat.getListSummaryViewModel(
req,
ctx,
[
{ itemId: '1', fullname: 'Sarah Phillips' },
{ itemId: '2', fullname: 'David Jones' },
{ itemId: '3', fullname: 'Emma Wilson' }
],
model.createTranslator()
)
return /** @type {PageViewModel} */ (
/** @type {unknown} */ ({
...vm,
Expand Down Expand Up @@ -300,10 +310,12 @@ export const pageFixtures = {
],
renderPage: '/summary',
state: { fullname: 'Sarah Phillips', email: 'sarah@example.gov.uk' },
getViewModelOverride: (ctrl, _model, req, ctx) => {
getViewModelOverride: (ctrl, model, req, ctx) => {
const summary = /** @type {SummaryPageController} */ (ctrl)
return /** @type {PageViewModel} */ (
/** @type {unknown} */ (summary.getSummaryViewModel(req, ctx))
/** @type {unknown} */ (
summary.getSummaryViewModel(req, ctx, model.createTranslator())
)
)
}
})
Expand Down
14 changes: 0 additions & 14 deletions src/server/forms/register-as-a-unicorn-breeder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,20 +242,6 @@ pages:
content: 'Fill in this field'
options:
required: false
next:
- path: '/pay-for-your-licence'
- title: Pay for your licence
path: '/pay-for-your-licence'
section: section
components:
- name: licencePayment
title: Unicorn breeder licence fee
type: PaymentField
hint: You'll be redirected to GOV.UK Pay to complete your payment
options:
required: true
amount: 50
description: Unicorn breeder annual licence fee
next:
- path: '/summary'
conditions:
Expand Down
Loading
Loading