From 80c67bbc78e8f93843e9e4043e907c6838958dab Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Fri, 24 Feb 2023 11:50:10 +0000 Subject: [PATCH 1/7] SPIKE: add character count for driving licence to details page --- src/assets/scss/application.scss | 3 ++ src/locales/en/fields.yml | 3 ++ src/views/drivingLicence/details.html | 12 +++-- src/views/drivingLicence/hmpoCountText.njk | 62 ++++++++++++++++++++++ 4 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 src/views/drivingLicence/hmpoCountText.njk diff --git a/src/assets/scss/application.scss b/src/assets/scss/application.scss index fc659c6..4b2f431 100644 --- a/src/assets/scss/application.scss +++ b/src/assets/scss/application.scss @@ -12,6 +12,9 @@ $govuk-assets-path: "/public/"; background-color: $govuk-error-colour; } +// remove the resize option on the driving licence number character count +textarea[name="drivingLicenceNumber"] {resize: none;} + //// Task list pattern // //.app-task-list { diff --git a/src/locales/en/fields.yml b/src/locales/en/fields.yml index 3ff3d6d..9abe7bf 100644 --- a/src/locales/en/fields.yml +++ b/src/locales/en/fields.yml @@ -1,6 +1,7 @@ drivingLicenceNumber: label: Licence number hint: "This is the long number in section 5 on your licence for example HARRI559146MJ931" + maxlength: false validation: default: "Enter the number exactly as it appears on your driving licence" exactlength: "Your licence number should be 16 characters long" @@ -8,6 +9,7 @@ drivingLicenceNumber: limit: "Driving licence numbers do not start with 16 – Enter the number exactly as it appears on your driving licence" dvlaChecker: "Enter the number exactly as it appears on your driving licence" regexSpecialCharacters: "Your licence number should not include any symbols or spaces" + dvaLicenceNumber: label: Licence number hint: "This is the long number in section 5 on your licence" @@ -16,6 +18,7 @@ dvaLicenceNumber: exactlength: "Your licence number should be 8 characters long" regexSpecialCharacters: "Your licence number should not include any symbols or spaces" numeric: "Enter the number exactly as it appears on your driving licence" + issueNumber: label: Issue number hint: "This is the 2 digit number after the space in section 5 of your licence" diff --git a/src/views/drivingLicence/details.html b/src/views/drivingLicence/details.html index 642da10..f23209b 100644 --- a/src/views/drivingLicence/details.html +++ b/src/views/drivingLicence/details.html @@ -8,6 +8,7 @@ {% from "govuk/components/inset-text/macro.njk" import govukInsetText %} {% from "hmpo-text/macro.njk" import hmpoText %} +{% from "./hmpoCountText.njk" import hmpoCountText %} {% from "hmpo-form/macro.njk" import hmpoForm %} {% from "hmpo-date/macro.njk" import hmpoDate %} @@ -169,27 +170,30 @@

{{ translate("drivingLicence.retryMessageHeading") }}

}) }} {% if (values.licenceIssuer == "DVLA") %} - {{ hmpoText(ctx, { + + {{ hmpoCountText(ctx, { id: "drivingLicenceNumber", label: { classes: "govuk-label" } - }) }} + }) }} {{ hmpoText(ctx, { id: "issueNumber", + classes: "govuk-input--width-3", label: { classes: "govuk-label" } }) }} {% else %} - {{ hmpoText(ctx, { + + {{ hmpoCountText(ctx, { id: "dvaLicenceNumber", label: { classes: "govuk-label" } - }) }} + }) }} {% endif %} diff --git a/src/views/drivingLicence/hmpoCountText.njk b/src/views/drivingLicence/hmpoCountText.njk new file mode 100644 index 0000000..565d410 --- /dev/null +++ b/src/views/drivingLicence/hmpoCountText.njk @@ -0,0 +1,62 @@ + +{% macro hmpoCountText(ctx, params, base) %} + + {%- set params = hmpoGetParams(ctx, params, base) %} + + {%- set pageHeading = { + isPageHeading: true, + classes: "govuk-label--l" + } if params.isPageHeading %} + + {%- set args = { + id: params.id, + name: params.id, + label: merge( + pageHeading, + { attributes: { id: params.id + "-label" } }, + hmpoGetOptions(ctx, params, "label") + ), + hint: hmpoGetOptions(ctx, params, "hint", true), + value: hmpoGetValue(ctx, params), + errorMessage: hmpoGetError(ctx, params), + type: params.type, + inputmode: params.inputmode, + classes: "" + (params.classes if params.classes else "govuk-!-width-one-half") + (" js-nopaste" if params.noPaste), + formGroup: params.formGroup, + autocomplete: params.autocomplete, + rows: params.rows, + attributes: hmpoGetAttributes(ctx, params, { + "aria-required": hmpoGetValidatorAttribute(ctx, params, "required", null, false), + "min": hmpoGetValidatorAttribute(ctx, params, "min", 0), + "max": hmpoGetValidatorAttribute(ctx, params, "max", 0), + "maxlength": hmpoGetValidatorAttribute(ctx, params, "maxlength", 0) or hmpoGetValidatorAttribute(ctx, params, "exactlength", 0) + } | filter(null)) + } %} + + {%- if params.type == "textarea" %} + {%- from "govuk/components/textarea/macro.njk" import govukTextarea %} + {{- govukTextarea(args) }} + {%- else %} + {%- from "govuk/components/character-count/macro.njk" import govukCharacterCount %} + {%- from "govuk/components/input/macro.njk" import govukInput %} + + + {# {{- govukInput(args) }} #} + {{ govukCharacterCount({ + name: args.name, + id: args.id, + maxlength: args.attributes.maxlength, + rows:1, + value: args.value, + label: { + id:args.label.id, + text: args.label.html, + classes: args.label.classes, + isPageHeading: false + }, + hint: { + text: args.hint.html + } + }) }} + {%- endif %} +{% endmacro %} From 03f72f7a2076068c27f424f21a189d7f8ecaadca Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Fri, 24 Feb 2023 12:10:02 +0000 Subject: [PATCH 2/7] Update scss file to style both states of the details form --- src/assets/scss/application.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/assets/scss/application.scss b/src/assets/scss/application.scss index 4b2f431..68cd1d7 100644 --- a/src/assets/scss/application.scss +++ b/src/assets/scss/application.scss @@ -13,7 +13,9 @@ $govuk-assets-path: "/public/"; } // remove the resize option on the driving licence number character count -textarea[name="drivingLicenceNumber"] {resize: none;} +// To match both the DVLA and DVA forms this selector looks for any textarea +// that contains the string 'LicenceNumber' anywhere in the class name +textarea[name*="LicenceNumber"] {resize: none;} //// Task list pattern // From a236c7688e395baa15ed00174071a5f2009d72ad Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Mon, 27 Feb 2023 17:37:02 +0000 Subject: [PATCH 3/7] Add initial i18n implementation --- package.json | 2 +- src/locales/cy/default.yml | 5 + src/locales/en/default.yml | 5 + src/views/drivingLicence/details.html | 264 +++++++++++---------- src/views/drivingLicence/hmpoCountText.njk | 13 +- 5 files changed, 162 insertions(+), 127 deletions(-) diff --git a/package.json b/package.json index 76e5a33..12ade47 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "express": "4.18.1", "express-async-errors": "^3.1.1", "express-session": "^1.17.3", - "govuk-frontend": "4.2.0", + "govuk-frontend": "4.5.0", "hmpo-app": "2.4.0", "hmpo-components": "5.7.0", "hmpo-config": "2.2.1", diff --git a/src/locales/cy/default.yml b/src/locales/cy/default.yml index c222e53..2ee0b74 100644 --- a/src/locales/cy/default.yml +++ b/src/locales/cy/default.yml @@ -66,6 +66,11 @@ drivingLicence: retryMessageList2: rydych wedi rhoi eich rhif trwydded yrru yn gywir retryMessageList3: bod dyddiau a misoedd yn y drefn gywir yn eich dyddiad geni, dyddiad cyhoeddi a dyddiad dilys tan retryMessageList4: you’ve left the middle names section blank if you do not have any middle names + charactersUnderLimitTextOther: CY You have %{count} characters remaining + charactersUnderLimitTextOne: CY You have %{count} character remaining + charactersAtLimitText: CY The Licence number is the correct length + charactersOverLimitTextOne: CY You have %{count} too many characters + charactersOverLimitTextOther: CY You have %{count} too many characters prove-another-way: title: Profi pwy ydych chi mewn ffordd arall diff --git a/src/locales/en/default.yml b/src/locales/en/default.yml index 369393c..5795bc5 100644 --- a/src/locales/en/default.yml +++ b/src/locales/en/default.yml @@ -66,6 +66,11 @@ drivingLicence: retryMessageList2: you’ve entered your driving licence number correctly retryMessageList3: days and months are in the right order in your date of birth, issue date and valid to date retryMessageList4: you’ve left the middle names section blank if you do not have any middle names + charactersUnderLimitTextOther: You have %{count} characters remaining + charactersUnderLimitTextOne: You have %{count} character remaining + charactersAtLimitText: The Licence number is the correct length + charactersOverLimitTextOne: You have %{count} too many characters + charactersOverLimitTextOther: You have %{count} too many characters prove-another-way: title: Prove your identity another way diff --git a/src/views/drivingLicence/details.html b/src/views/drivingLicence/details.html index f23209b..215a584 100644 --- a/src/views/drivingLicence/details.html +++ b/src/views/drivingLicence/details.html @@ -14,17 +14,17 @@ {% block mainContent %} - {% if values.showRetryMessage and not (ctx("errors") | length) %} - {# user is retrying #} -

- {{ translate("drivingLicence.retryTitle") }} -

- {% else %} - {# user's first attempt #} -

- {{ translate("drivingLicence.title") }} -

- {% endif %} +{% if values.showRetryMessage and not (ctx("errors") | length) %} +{# user is retrying #} +

+ {{ translate("drivingLicence.retryTitle") }} +

+{% else %} +{# user's first attempt #} +

+ {{ translate("drivingLicence.title") }} +

+{% endif %} {% if values.showRetryMessage and not (ctx("errors") | length) %} {# user is retrying, show more information about how to complete the form #} @@ -32,9 +32,9 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% if (values.licenceIssuer == "DVA") %} - {{ translate("drivingLicence.retryMessageParagraph1DVA") }} + {{ translate("drivingLicence.retryMessageParagraph1DVA") }} {% else %} - {{ translate("drivingLicence.retryMessageParagraph1") }} + {{ translate("drivingLicence.retryMessageParagraph1") }} {% endif %}

@@ -57,11 +57,11 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% else %} {# user's first attempt #} - {% if (values.licenceIssuer == "DVA") %} -

{{ translate("drivingLicence.checkDetailsContextDVA") }}

- {% else %} -

{{ translate("drivingLicence.checkDetailsContext") }}

- {% endif %} +{% if (values.licenceIssuer == "DVA") %} +

{{ translate("drivingLicence.checkDetailsContextDVA") }}

+{% else %} +

{{ translate("drivingLicence.checkDetailsContext") }}

+{% endif %} {% endif %} @@ -69,21 +69,21 @@

{{ translate("drivingLicence.retryMessageHeading") }}

html: translate("drivingLicence.drivingLicenceTryAnotherWay") }) }} - {% call hmpoForm(ctx, {attributes: {onsubmit: 'window.disableFormSubmit()'} }) %} +{% call hmpoForm(ctx, {attributes: {onsubmit: 'window.disableFormSubmit()'} }) %} - {{ hmpoText(ctx, { - id: "surname", - label: { - classes: "govuk-label" - }, - classes: "govuk-input" - }) }} +{{ hmpoText(ctx, { +id: "surname", +label: { +classes: "govuk-label" +}, +classes: "govuk-input" +}) }} - {%- set firstNameError = hmpoGetError(ctx, {id: 'firstName'}) %} - {%- set middleNameError = hmpoGetError(ctx, {id: 'middleNames'}) %} +{%- set firstNameError = hmpoGetError(ctx, {id: 'firstName'}) %} +{%- set middleNameError = hmpoGetError(ctx, {id: 'middleNames'}) %} - {% if firstNameError and middleNameError %} -
+{% if firstNameError and middleNameError %} +
{% else %}
{% endif %} @@ -114,53 +114,53 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% endcall %}
- {% if (values.licenceIssuer == "DVLA") %} + {% if (values.licenceIssuer == "DVLA") %} - {{ hmpoDate(ctx, { - id: "dateOfBirth", - legend: { - classes: "govuk-label" - } - }) }} + {{ hmpoDate(ctx, { + id: "dateOfBirth", + legend: { + classes: "govuk-label" + } + }) }} - {{ hmpoText(ctx, { - id: "dvlaDependent", - type: "hidden", - legend: "", - default: "DVLA" - }) }} + {{ hmpoText(ctx, { + id: "dvlaDependent", + type: "hidden", + legend: "", + default: "DVLA" + }) }} - {{ hmpoDate(ctx, { - id: "issueDate", - legend: { - classes: "govuk-label" - } - }) }} + {{ hmpoDate(ctx, { + id: "issueDate", + legend: { + classes: "govuk-label" + } + }) }} - {% else %} + {% else %} - {{ hmpoDate(ctx, { - id: "dvaDateOfBirth", - legend: { - classes: "govuk-label" - } - }) }} + {{ hmpoDate(ctx, { + id: "dvaDateOfBirth", + legend: { + classes: "govuk-label" + } + }) }} - {{ hmpoText(ctx, { - id: "dvaDependent", - type: "hidden", - legend: "", - default: "DVA" - }) }} + {{ hmpoText(ctx, { + id: "dvaDependent", + type: "hidden", + legend: "", + default: "DVA" + }) }} - {{ hmpoDate(ctx, { - id: "dateOfIssue", - legend: { - classes: "govuk-label" - } - }) }} + {{ hmpoDate(ctx, { + id: "dateOfIssue", + legend: { + classes: "govuk-label" + } + }) }} - {% endif %} + {% endif %} {{ hmpoDate(ctx, { id: "expiryDate", @@ -171,33 +171,47 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% if (values.licenceIssuer == "DVLA") %} - {{ hmpoCountText(ctx, { - id: "drivingLicenceNumber", - label: { - classes: "govuk-label" - } - }) }} + {{ hmpoCountText(ctx, { + id: "drivingLicenceNumber", + label: { + classes: "govuk-label" + }, + i18n:{ + charactersUnderLimitTextOther:translate("drivingLicence.charactersUnderLimitTextOther"), + charactersUnderLimitTextOne:translate("drivingLicence.charactersUnderLimitTextOne"), + charactersAtLimitText:translate("drivingLicence.charactersAtLimitText"), + charactersOverLimitTextOne:translate("drivingLicence.charactersOverLimitTextOne"), + charactersOverLimitTextOther:translate("drivingLicence.charactersOverLimitTextOther") + } + }) }} - {{ hmpoText(ctx, { - id: "issueNumber", - classes: "govuk-input--width-3", - label: { - classes: "govuk-label" - } - }) }} + {{ hmpoText(ctx, { + id: "issueNumber", + classes: "govuk-input--width-3", + label: { + classes: "govuk-label" + } + }) }} {% else %} - {{ hmpoCountText(ctx, { - id: "dvaLicenceNumber", - label: { - classes: "govuk-label" - } - }) }} + {{ hmpoCountText(ctx, { + id: "dvaLicenceNumber", + label: { + classes: "govuk-label" + }, + i18n:{ + charactersUnderLimitTextOther:translate("drivingLicence.charactersUnderLimitTextOther"), + charactersUnderLimitTextOne:translate("drivingLicence.charactersUnderLimitTextOne"), + charactersAtLimitText:translate("drivingLicence.charactersAtLimitText"), + charactersOverLimitTextOne:translate("drivingLicence.charactersOverLimitTextOne"), + charactersOverLimitTextOther:translate("drivingLicence.charactersOverLimitTextOther") + } + }) }} {% endif %} - {{ hmpoText(ctx, { + {{ hmpoText(ctx, { id: "postcode", label: { classes: "govuk-label" @@ -205,54 +219,56 @@

{{ translate("drivingLicence.retryMessageHeading") }}

}) }} {% if values.showRetryMessage and not (ctx("errors") | length) %} - {# user is retrying, show warning message they have run out of attempts #} - {{ govukWarningText({ - text: translate("drivingLicence.retryWarningText"), - iconFallbackText: translate("drivingLicence.retryWarningTitle") - }) }} + {# user is retrying, show warning message they have run out of attempts #} + {{ govukWarningText({ + text: translate("drivingLicence.retryWarningText"), + iconFallbackText: translate("drivingLicence.retryWarningTitle") + }) }} {% endif %} - {{ hmpoSubmit(ctx, {id: "continue", text: translate("buttons.next")}) }} + {{ hmpoSubmit(ctx, {id: "continue", text: translate("buttons.next")}) }} {% endcall %} -{% endblock %} -{% block scripts %} + {% endblock %} + {% block scripts %} -{{ super ()}} + {{ super ()}} - + delayDisableButton(event.target); + } else { + event.preventDefault() + } + }) + } + + + -{% endblock %} -{# generate the specific footer items required for the PYI flows #} -{% set footerNavItems = translate("govuk.footerNavItems") %} + {% endblock %} + {# generate the specific footer items required for the PYI flows #} + {% set footerNavItems = translate("govuk.footerNavItems") %} -{% block footer %} + {% block footer %} {{ govukFooter( footerNavItems ) }} -{% endblock %} + {% endblock %} diff --git a/src/views/drivingLicence/hmpoCountText.njk b/src/views/drivingLicence/hmpoCountText.njk index 565d410..d8be048 100644 --- a/src/views/drivingLicence/hmpoCountText.njk +++ b/src/views/drivingLicence/hmpoCountText.njk @@ -25,6 +25,7 @@ formGroup: params.formGroup, autocomplete: params.autocomplete, rows: params.rows, + i18n: params.i18n, attributes: hmpoGetAttributes(ctx, params, { "aria-required": hmpoGetValidatorAttribute(ctx, params, "required", null, false), "min": hmpoGetValidatorAttribute(ctx, params, "min", 0), @@ -40,7 +41,6 @@ {%- from "govuk/components/character-count/macro.njk" import govukCharacterCount %} {%- from "govuk/components/input/macro.njk" import govukInput %} - {# {{- govukInput(args) }} #} {{ govukCharacterCount({ name: args.name, @@ -56,7 +56,16 @@ }, hint: { text: args.hint.html - } + }, + charactersUnderLimitText: { + other: args.i18n.charactersUnderLimitTextOther, + one: args.i18n.charactersUnderLimitTextOne + }, + charactersOverLimitText: { + one: args.i18n.charactersOverLimitTextOne, + other: args.i18n.charactersOverLimitTextOther + }, + charactersAtLimitText: args.i18n.charactersAtLimitText }) }} {%- endif %} {% endmacro %} From 7e9f9785bba19b14d82204154c73b4777a0aa326 Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Wed, 1 Mar 2023 11:34:40 +0000 Subject: [PATCH 4/7] Update package.json to pass i18n test --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 12ade47..7926b5d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "test:watch": "mocha --watch", "mocks": "yarn run wiremock --port 8030 --root-dir test/mocks", "test:browser": "wait-on tcp:8030 tcp:5030 && cucumber-js --config test/browser/cucumber.js", - "test:browser:ci": "npm-run-all -p -r start:ci mocks test:browser" + "test:browser:ci": "npm-run-all -p -r start:ci mocks test:browser", + "check-translation": "node node_modules/di-ipv-cri-common-express/scripts/checkTranslations.js" }, "repository": { "type": "git", @@ -70,7 +71,7 @@ "cfenv": "1.2.4", "connect-dynamodb": "^2.0.5", "copyfiles": "2.4.1", - "di-ipv-cri-common-express": "alphagov/di-ipv-cri-common-express.git#v0.0.38", + "di-ipv-cri-common-express": "alphagov/di-ipv-cri-common-express.git#v0.0.39", "dotenv": "^16.0.1", "express": "4.18.1", "express-async-errors": "^3.1.1", From cd25705425ef9b5c63575d62e941c2f56a3fdc73 Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Thu, 2 Mar 2023 10:54:52 +0000 Subject: [PATCH 5/7] Update content to match design system usage and pass translation check --- src/locales/cy/default.yml | 2 +- src/locales/cy/fields.yml | 6 ++++++ src/locales/en/default.yml | 6 +++--- src/locales/en/fields.yml | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/locales/cy/default.yml b/src/locales/cy/default.yml index 2ee0b74..25e92a3 100644 --- a/src/locales/cy/default.yml +++ b/src/locales/cy/default.yml @@ -31,7 +31,7 @@ govuk: paragraph2: unrhyw bryd. buttonAcceptText: Derbyn cwcis dadansoddi buttonRejectText: Gwrthod cwcis dadansoddi - linkViewCookies: Gweld cwcis + linkViewCookiesText: Gweld cwcis cookieBannerHideLink: Cuddio'r neges yma footerNavItems: meta: diff --git a/src/locales/cy/fields.yml b/src/locales/cy/fields.yml index f811473..a80487a 100644 --- a/src/locales/cy/fields.yml +++ b/src/locales/cy/fields.yml @@ -1,6 +1,7 @@ drivingLicenceNumber: label: Rhif trwydded hint: "Dyma'r rhif hir yn adran 5 ar eich trwydded er enghraifft HARRI559146MJ931" + maxlength: false validation: default: "Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru" exactlength: "Dylai rhif eich trwydded fod yn 16 nod o hyd" @@ -8,6 +9,7 @@ drivingLicenceNumber: limit: "Driving licence numbers do not start with 16 – enter the number as it appears on your driving licence" dvlaChecker: "Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru" regexSpecialCharacters: "Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau" + dvaLicenceNumber: label: Rhif trwydded hint: "Dyma'r rhif hir yn adran 5 ar eich trwydded" @@ -15,6 +17,8 @@ dvaLicenceNumber: default: "Rhowch y rhif yn union fel mae’n ymddangos ar eich trwydded yrru" exactlength: "Dylai rhif eich trwydded fod yn 8 nod o hyd" numeric: "Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau" + regexSpecialCharacters: "Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau" + issueNumber: label: Rhif cyhoeddi hint: "Dyma'r rhif 2 ddigid ar ôl y gofod yn adran 5 o'ch trwydded" @@ -22,6 +26,7 @@ issueNumber: default: "Rhowch y rhif cyhoeddi fel y mae'n ymddangos ar eich trwydded yrru" exactlength: "Dylai eich rhif cyhoeddi fod yn 2 rif o hyd" numeric: "Ni ddylai eich rhif cyhoeddi gynnwys unrhyw symbolau neu ofodau" + regexSpecialCharacters: "Ni ddylai rhif eich trwydded gynnwys unrhyw symbolau neu ofodau" surname: label: Enw olaf @@ -54,6 +59,7 @@ dateOfBirth: default: "Rhowch eich dyddiad geni fel y mae'n ymddangos ar eich trwydded yrru" before: "Rhaid i'ch dyddiad geni fod yn y gorffennol" dvlaChecker: "Gwiriwch eich bod wedi rhoi eich dyddiad geni yn gywir" + dvaDateOfBirth: legend: Dyddiad geni hint: "Er enghraifft, 5 9 1973" diff --git a/src/locales/en/default.yml b/src/locales/en/default.yml index 5795bc5..447c3fb 100644 --- a/src/locales/en/default.yml +++ b/src/locales/en/default.yml @@ -68,9 +68,9 @@ drivingLicence: retryMessageList4: you’ve left the middle names section blank if you do not have any middle names charactersUnderLimitTextOther: You have %{count} characters remaining charactersUnderLimitTextOne: You have %{count} character remaining - charactersAtLimitText: The Licence number is the correct length - charactersOverLimitTextOne: You have %{count} too many characters - charactersOverLimitTextOther: You have %{count} too many characters + charactersAtLimitText: You have %{count} characters remaining + charactersOverLimitTextOne: You have %{count} character too many + charactersOverLimitTextOther: You have %{count} characters too many prove-another-way: title: Prove your identity another way diff --git a/src/locales/en/fields.yml b/src/locales/en/fields.yml index 9abe7bf..e692fef 100644 --- a/src/locales/en/fields.yml +++ b/src/locales/en/fields.yml @@ -26,6 +26,7 @@ issueNumber: default: "Enter the issue number as it appears on your driving licence" exactlength: "Your issue number should be 2 numbers long" regexSpecialCharacters: "Your issue number should not include any symbols or spaces" + numeric: "Enter the number exactly as it appears on your driving licence" surname: label: Last name From fd3c72119c9e41f1750ddde9bb2afd102a96fd2d Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Thu, 2 Mar 2023 11:05:01 +0000 Subject: [PATCH 6/7] reformat file --- src/views/drivingLicence/details.html | 94 +++++++++++++-------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/views/drivingLicence/details.html b/src/views/drivingLicence/details.html index 215a584..f31997c 100644 --- a/src/views/drivingLicence/details.html +++ b/src/views/drivingLicence/details.html @@ -14,16 +14,16 @@ {% block mainContent %} -{% if values.showRetryMessage and not (ctx("errors") | length) %} -{# user is retrying #} -

- {{ translate("drivingLicence.retryTitle") }} -

-{% else %} -{# user's first attempt #} -

- {{ translate("drivingLicence.title") }} -

+ {% if values.showRetryMessage and not (ctx("errors") | length) %} + {# user is retrying #} +

+ {{ translate("drivingLicence.retryTitle") }} +

+ {% else %} + {# user's first attempt #} +

+ {{ translate("drivingLicence.title") }} +

{% endif %} {% if values.showRetryMessage and not (ctx("errors") | length) %} @@ -32,9 +32,9 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% if (values.licenceIssuer == "DVA") %} - {{ translate("drivingLicence.retryMessageParagraph1DVA") }} + {{ translate("drivingLicence.retryMessageParagraph1DVA") }} {% else %} - {{ translate("drivingLicence.retryMessageParagraph1") }} + {{ translate("drivingLicence.retryMessageParagraph1") }} {% endif %}

@@ -57,11 +57,11 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% else %} {# user's first attempt #} -{% if (values.licenceIssuer == "DVA") %} -

{{ translate("drivingLicence.checkDetailsContextDVA") }}

-{% else %} -

{{ translate("drivingLicence.checkDetailsContext") }}

-{% endif %} + {% if (values.licenceIssuer == "DVA") %} +

{{ translate("drivingLicence.checkDetailsContextDVA") }}

+ {% else %} +

{{ translate("drivingLicence.checkDetailsContext") }}

+ {% endif %} {% endif %} @@ -71,29 +71,29 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% call hmpoForm(ctx, {attributes: {onsubmit: 'window.disableFormSubmit()'} }) %} -{{ hmpoText(ctx, { -id: "surname", -label: { -classes: "govuk-label" -}, -classes: "govuk-input" -}) }} - -{%- set firstNameError = hmpoGetError(ctx, {id: 'firstName'}) %} -{%- set middleNameError = hmpoGetError(ctx, {id: 'middleNames'}) %} - -{% if firstNameError and middleNameError %} -
- {% else %} -
- {% endif %} + {{ hmpoText(ctx, { + id: "surname", + label: { + classes: "govuk-label" + }, + classes: "govuk-input" + }) }} - {% call govukFieldset({ - legend: { - text: translate("drivingLicence.drivingLicenceGivenNames"), - classes: "govuk-!-margin-0" - } - }) %} + {%- set firstNameError = hmpoGetError(ctx, {id: 'firstName'}) %} + {%- set middleNameError = hmpoGetError(ctx, {id: 'middleNames'}) %} + + {% if firstNameError and middleNameError %} +
+ {% else %} +
+ {% endif %} + + {% call govukFieldset({ + legend: { + text: translate("drivingLicence.drivingLicenceGivenNames"), + classes: "govuk-!-margin-0" + } + }) %}
{{ hmpoText(ctx, { id: "firstName", @@ -230,8 +230,9 @@

{{ translate("drivingLicence.retryMessageHeading") }}

{% endcall %} - {% endblock %} - {% block scripts %} +{% endblock %} + +{% block scripts %} {{ super ()}} @@ -247,7 +248,6 @@

{{ translate("drivingLicence.retryMessageHeading") }}

}, 200); } - function submitSpinner() { var selects = document.getElementById('continue') @@ -265,10 +265,10 @@

{{ translate("drivingLicence.retryMessageHeading") }}

- {% endblock %} - {# generate the specific footer items required for the PYI flows #} - {% set footerNavItems = translate("govuk.footerNavItems") %} +{% endblock %} - {% block footer %} +{# generate the specific footer items required for the PYI flows #} +{% set footerNavItems = translate("govuk.footerNavItems") %} +{% block footer %} {{ govukFooter( footerNavItems ) }} - {% endblock %} +{% endblock %} From 19b01f0ad15c512e98793af9c79df03104b5b24b Mon Sep 17 00:00:00 2001 From: Derren Wilson Date: Fri, 3 Mar 2023 14:21:23 +0000 Subject: [PATCH 7/7] Add Welsh language translation --- src/locales/cy/default.yml | 10 +++++----- src/locales/en/default.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/locales/cy/default.yml b/src/locales/cy/default.yml index 25e92a3..17b09c6 100644 --- a/src/locales/cy/default.yml +++ b/src/locales/cy/default.yml @@ -66,11 +66,11 @@ drivingLicence: retryMessageList2: rydych wedi rhoi eich rhif trwydded yrru yn gywir retryMessageList3: bod dyddiau a misoedd yn y drefn gywir yn eich dyddiad geni, dyddiad cyhoeddi a dyddiad dilys tan retryMessageList4: you’ve left the middle names section blank if you do not have any middle names - charactersUnderLimitTextOther: CY You have %{count} characters remaining - charactersUnderLimitTextOne: CY You have %{count} character remaining - charactersAtLimitText: CY The Licence number is the correct length - charactersOverLimitTextOne: CY You have %{count} too many characters - charactersOverLimitTextOther: CY You have %{count} too many characters + charactersUnderLimitTextOther: Mae gennych %{count} nod ar ôl + charactersUnderLimitTextOne: Mae gennych %{count} nod ar ôl + charactersAtLimitText: Mae gennych 0 nod ar ôl + charactersOverLimitTextOne: Mae gennych %{count} nod yn ormod + charactersOverLimitTextOther: Mae gennych %{count} nod yn ormod prove-another-way: title: Profi pwy ydych chi mewn ffordd arall diff --git a/src/locales/en/default.yml b/src/locales/en/default.yml index 447c3fb..0f9ab6d 100644 --- a/src/locales/en/default.yml +++ b/src/locales/en/default.yml @@ -68,7 +68,7 @@ drivingLicence: retryMessageList4: you’ve left the middle names section blank if you do not have any middle names charactersUnderLimitTextOther: You have %{count} characters remaining charactersUnderLimitTextOne: You have %{count} character remaining - charactersAtLimitText: You have %{count} characters remaining + charactersAtLimitText: You have 0 characters remaining charactersOverLimitTextOne: You have %{count} character too many charactersOverLimitTextOther: You have %{count} characters too many