validation message translations is required

This commit is contained in:
2024-12-16 11:48:57 +00:00
parent 5549ed43ba
commit ead00dda76
9 changed files with 40 additions and 21 deletions
+12 -10
View File
@@ -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; /(?:[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) => 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) => const phoneNumber = (value) =>
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( !/^(?:(?:\(?(?: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 value
) )
? "Invalid phone number" ? t("account:invalid-phone-number-errormsg")
: undefined; : undefined;
const postcode = (value) => const postcode = (value) =>
@@ -274,7 +276,7 @@ let PersonalDetails = (props) => {
label={t( label={t(
"account:account-preferred-language-label" "account:account-preferred-language-label"
)} )}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
@@ -285,7 +287,7 @@ let PersonalDetails = (props) => {
className="govuk-input govuk-input--width-20" className="govuk-input govuk-input--width-20"
validate={[required]} validate={[required]}
label={t("account:account-first-name-label")} label={t("account:account-first-name-label")}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
name="lastname" name="lastname"
@@ -295,7 +297,7 @@ let PersonalDetails = (props) => {
className="govuk-input govuk-input--width-20" className="govuk-input govuk-input--width-20"
validate={[required]} validate={[required]}
label={t("account:account-last-name-label")} label={t("account:account-last-name-label")}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
name="emailaddress1" name="emailaddress1"
@@ -323,7 +325,7 @@ let PersonalDetails = (props) => {
type="text" type="text"
className="govuk-input govuk-input--width-20" className="govuk-input govuk-input--width-20"
label={t("account:account-company-group-label")} label={t("account:account-company-group-label")}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
</fieldset> </fieldset>
<fieldset className="govuk-fieldset"> <fieldset className="govuk-fieldset">
@@ -343,7 +345,7 @@ let PersonalDetails = (props) => {
"account:account-address-line-1-label" "account:account-address-line-1-label"
)} )}
validate={[required]} validate={[required]}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
name="address1_line2" name="address1_line2"
@@ -354,7 +356,7 @@ let PersonalDetails = (props) => {
label={t( label={t(
"account:account-address-line-2-label" "account:account-address-line-2-label"
)} )}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
name="address1_city" name="address1_city"
@@ -364,7 +366,7 @@ let PersonalDetails = (props) => {
className="govuk-input govuk-input--width-10" className="govuk-input govuk-input--width-10"
label={t("account:account-town-city-label")} label={t("account:account-town-city-label")}
validate={[required]} validate={[required]}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
name="address1_county" name="address1_county"
@@ -374,7 +376,7 @@ let PersonalDetails = (props) => {
className="govuk-input govuk-input--width-10" className="govuk-input govuk-input--width-10"
label={t("account:account-county-label")} label={t("account:account-county-label")}
validate={[required]} validate={[required]}
errorMsg="Is required" errorMsg={t("account:is-required-label")}
/> />
<Field <Field
name="address1_postalcode" name="address1_postalcode"
@@ -1015,7 +1015,7 @@ let S78_Questionnaire = (props) => {
"myrepresentations:s78-section-question-signed" "myrepresentations:s78-section-question-signed"
)} )}
validate={[required]} validate={[required]}
errorMsg="Is required" errorMsg={t("myrepresentations:is-required-label")}
/> />
</div> </div>
<div className="govuk-form-group"> <div className="govuk-form-group">
@@ -1030,7 +1030,7 @@ let S78_Questionnaire = (props) => {
label={t( label={t(
"myrepresentations:s78-section-question-onbehalf" "myrepresentations:s78-section-question-onbehalf"
)} )}
errorMsg="Is required" errorMsg={t("myrepresentations:is-required-label")}
/> />
</div> </div>
<Field <Field
@@ -1041,7 +1041,7 @@ let S78_Questionnaire = (props) => {
validate={[required]} validate={[required]}
dateStart="0" dateStart="0"
dateEnd="1-y" dateEnd="1-y"
errorMsg="Is required" errorMsg={t("myrepresentations:is-required-label")}
locale={locale} locale={locale}
/> />
</fieldset> </fieldset>
+7 -4
View File
@@ -455,7 +455,8 @@ let AboutYou = (props) => {
const contactPref = const contactPref =
router.locale == "cy" ? ["Ebost", "Post"] : ["Email", "Post"]; 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) => { const emojicheck = (value) => {
let errors; 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; /[\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)) { if (emojiRegex.test(value)) {
errors = "Emojis are not allowed"; errors = t("newappeal:emojis-not-allowed-label");
} }
return errors; 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; /(?:[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) => 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) => const phoneNumber = (value) =>
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( !/^(?:(?:\(?(?: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 value
) )
? "Invalid phone number" ? t("newappeal:invalid-phonenumber-label")
: undefined; : undefined;
const onHandleSubmit = (values) => { const onHandleSubmit = (values) => {
+5 -1
View File
@@ -58,5 +58,9 @@
"account-postcode-label": "Cod post", "account-postcode-label": "Cod post",
"account-complete-para-1": "Mae eich manylion wedi cael eu diweddaru", "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-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"
} }
+3 -1
View File
@@ -219,5 +219,7 @@
"statement-onbehalf-label": "Ar ran", "statement-onbehalf-label": "Ar ran",
"final-comments-label": "Sylwadau terfynol", "final-comments-label": "Sylwadau terfynol",
"representation-type": "Math o sylw", "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"
} }
+1
View File
@@ -21,6 +21,7 @@
"invalid-number-label": "Dylai fod yn rhif", "invalid-number-label": "Dylai fod yn rhif",
"emojis-not-allowed-label": "Ni chaniateir emojis", "emojis-not-allowed-label": "Ni chaniateir emojis",
"invalid-postcode-label": "Cod post annilys", "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-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", "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", "about-you-page-title": "Amdanoch chi",
+5 -1
View File
@@ -58,5 +58,9 @@
"account-postcode-label": "Postcode", "account-postcode-label": "Postcode",
"account-complete-para-1": "Your details have been updated", "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-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"
} }
+3 -1
View File
@@ -219,5 +219,7 @@
"statement-onbehalf-label": "On behalf of", "statement-onbehalf-label": "On behalf of",
"final-comments-label": "Final comments", "final-comments-label": "Final comments",
"representation-type": "Representation type", "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"
} }
+1
View File
@@ -21,6 +21,7 @@
"invalid-number-label": "Should be a number", "invalid-number-label": "Should be a number",
"emojis-not-allowed-label": "Emojis are not allowed", "emojis-not-allowed-label": "Emojis are not allowed",
"invalid-postcode-label": "Invalid postcode", "invalid-postcode-label": "Invalid postcode",
"invalid-phonenumber-label": "Invalid phone number",
"hascas-confirmation-label": "Confirm HAS/CAS appeal is required", "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", "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", "about-you-page-title": "About you",