diff --git a/components/account/personaldetails.js b/components/account/personaldetails.js index 91624656..42804df9 100644 --- a/components/account/personaldetails.js +++ b/components/account/personaldetails.js @@ -219,13 +219,15 @@ let PersonalDetails = (props) => { /(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi; const email = (value) => - value && !emailRegex.test(value) ? "Invalid email address" : undefined; + value && !emailRegex.test(value) + ? t("account:invalid-phone-number-errormsg") + : undefined; const phoneNumber = (value) => value && !/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test( value ) - ? "Invalid phone number" + ? t("account:invalid-phone-number-errormsg") : undefined; const postcode = (value) => @@ -274,7 +276,7 @@ let PersonalDetails = (props) => { label={t( "account:account-preferred-language-label" )} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { className="govuk-input govuk-input--width-20" validate={[required]} label={t("account:account-first-name-label")} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { className="govuk-input govuk-input--width-20" validate={[required]} label={t("account:account-last-name-label")} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { type="text" className="govuk-input govuk-input--width-20" label={t("account:account-company-group-label")} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} />
@@ -343,7 +345,7 @@ let PersonalDetails = (props) => { "account:account-address-line-1-label" )} validate={[required]} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { label={t( "account:account-address-line-2-label" )} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { className="govuk-input govuk-input--width-10" label={t("account:account-town-city-label")} validate={[required]} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { className="govuk-input govuk-input--width-10" label={t("account:account-county-label")} validate={[required]} - errorMsg="Is required" + errorMsg={t("account:is-required-label")} /> { "myrepresentations:s78-section-question-signed" )} validate={[required]} - errorMsg="Is required" + errorMsg={t("myrepresentations:is-required-label")} />
@@ -1030,7 +1030,7 @@ let S78_Questionnaire = (props) => { label={t( "myrepresentations:s78-section-question-onbehalf" )} - errorMsg="Is required" + errorMsg={t("myrepresentations:is-required-label")} />
{ validate={[required]} dateStart="0" dateEnd="1-y" - errorMsg="Is required" + errorMsg={t("myrepresentations:is-required-label")} locale={locale} />
diff --git a/components/newappeal/aboutyou.js b/components/newappeal/aboutyou.js index ca635875..6a4ae58c 100644 --- a/components/newappeal/aboutyou.js +++ b/components/newappeal/aboutyou.js @@ -455,7 +455,8 @@ let AboutYou = (props) => { const contactPref = router.locale == "cy" ? ["Ebost", "Post"] : ["Email", "Post"]; - const required = (value) => (value ? undefined : "Is required"); + const required = (value) => + value ? undefined : t("newappeal:is-required-label"); const emojicheck = (value) => { let errors; @@ -465,7 +466,7 @@ let AboutYou = (props) => { /[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F700}-\u{1F77F}\u{1F780}-\u{1F7FF}\u{1F800}-\u{1F8FF}\u{1F900}-\u{1F9FF}\u{1FA00}-\u{1FA6F}\u{1FA70}-\u{1FAFF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{2300}-\u{23FF}\u{2B50}\u{1F004}-\u{1F0CF}\u{1F0A0}-\u{1F0A5}\u{1F170}-\u{1F251}]/gu; if (emojiRegex.test(value)) { - errors = "Emojis are not allowed"; + errors = t("newappeal:emojis-not-allowed-label"); } return errors; @@ -474,13 +475,15 @@ let AboutYou = (props) => { /(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi; const email = (value) => - value && !emailRegex.test(value) ? "Invalid email address" : undefined; + value && !emailRegex.test(value) + ? t("newappeal:emojis-not-allowed-label") + : undefined; const phoneNumber = (value) => value && !/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test( value ) - ? "Invalid phone number" + ? t("newappeal:invalid-phonenumber-label") : undefined; const onHandleSubmit = (values) => { diff --git a/locales/cy/account.json b/locales/cy/account.json index 8d581085..099f8536 100644 --- a/locales/cy/account.json +++ b/locales/cy/account.json @@ -58,5 +58,9 @@ "account-postcode-label": "Cod post", "account-complete-para-1": "Mae eich manylion wedi cael eu diweddaru", "account-complete-para-2": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a metus non quam mollis egestas. Integer ac leo cursus, laoreet nulla sed, tempus tellus. Mauris condimentum erat arcu.", - "account-complete-return-to-portal-link": "Dychwelyd i Fy Mhorth" + "account-complete-return-to-portal-link": "Dychwelyd i Fy Mhorth", + "is-required-label": "Yn ofynnol", + "invalid-phone-number-errormsg": "Rhif ffôn annilys", + "invalid-email-address-errormsg": "Cyfeiriad e-bost annilys", + "no-emojis-errormsg": "Ni chaniateir emojis" } \ No newline at end of file diff --git a/locales/cy/myrepresentations.json b/locales/cy/myrepresentations.json index e0b6dcfc..df333e7e 100644 --- a/locales/cy/myrepresentations.json +++ b/locales/cy/myrepresentations.json @@ -219,5 +219,7 @@ "statement-onbehalf-label": "Ar ran", "final-comments-label": "Sylwadau terfynol", "representation-type": "Math o sylw", - "select-an-option-label": "Dewiswch opsiwn" + "select-an-option-label": "Dewiswch opsiwn", + "previously-added-files": "Ffeiliau wedi'u llwytho i fyny", + "is-required-label": "Yn ofynnol" } \ No newline at end of file diff --git a/locales/cy/newappeal.json b/locales/cy/newappeal.json index b9d42020..40dbbb33 100644 --- a/locales/cy/newappeal.json +++ b/locales/cy/newappeal.json @@ -21,6 +21,7 @@ "invalid-number-label": "Dylai fod yn rhif", "emojis-not-allowed-label": "Ni chaniateir emojis", "invalid-postcode-label": "Cod post annilys", + "invalid-phonenumber-label": "Rhif ffôn annilys", "hascas-confirmation-label": "Cadarnhewch fod angen apêl HAS/CAS", "hascas-confirmation-hint": "Mae'r llwybr apelio hwn yn berthnasol dim ond os yw'ch cais yn ymwneud â gwrthod caniatâd cynllunio, neu wrthod cais i amrywio neu ddileu amod sydd ynghlwm wrth ganiatâd blaenorol. Bydd pob cais arall yn cael ei gyflwyno trwy Apêl Gynllunio Adran 78", "about-you-page-title": "Amdanoch chi", diff --git a/locales/en/account.json b/locales/en/account.json index e0f488da..e7e6aa16 100644 --- a/locales/en/account.json +++ b/locales/en/account.json @@ -58,5 +58,9 @@ "account-postcode-label": "Postcode", "account-complete-para-1": "Your details have been updated", "account-complete-para-2": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi a metus non quam mollis egestas. Integer ac leo cursus, laoreet nulla sed, tempus tellus. Mauris condimentum erat arcu.", - "account-complete-return-to-portal-link": "Return to My portal" + "account-complete-return-to-portal-link": "Return to My portal", + "is-required-label": "Is required", + "invalid-phone-number-errormsg": "Invalid phone number", + "invalid-email-address-errormsg": "Invalid email address", + "no-emojis-errormsg": "Emojis are not allowed" } \ No newline at end of file diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index 240e9ac8..3bdf65e6 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -219,5 +219,7 @@ "statement-onbehalf-label": "On behalf of", "final-comments-label": "Final comments", "representation-type": "Representation type", - "select-an-option-label": "Select an option" + "select-an-option-label": "Select an option", + "previously-added-files": "Uploaded files", + "is-required-label": "Is required" } \ No newline at end of file diff --git a/locales/en/newappeal.json b/locales/en/newappeal.json index 0143ee98..2e3fcf39 100644 --- a/locales/en/newappeal.json +++ b/locales/en/newappeal.json @@ -21,6 +21,7 @@ "invalid-number-label": "Should be a number", "emojis-not-allowed-label": "Emojis are not allowed", "invalid-postcode-label": "Invalid postcode", + "invalid-phonenumber-label": "Invalid phone number", "hascas-confirmation-label": "Confirm HAS/CAS appeal is required", "hascas-confirmation-hint": "This appeal route is only applicable if your application relates the refusal of planning permission, or the refusal of an application to vary or remove a condition attached to a previous permision. All other applications will be submitted via a Section 78 Planning Appeal", "about-you-page-title": "About you",