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;
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")}
/>
<Field
@@ -285,7 +287,7 @@ let PersonalDetails = (props) => {
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")}
/>
<Field
name="lastname"
@@ -295,7 +297,7 @@ let PersonalDetails = (props) => {
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")}
/>
<Field
name="emailaddress1"
@@ -323,7 +325,7 @@ let PersonalDetails = (props) => {
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")}
/>
</fieldset>
<fieldset className="govuk-fieldset">
@@ -343,7 +345,7 @@ let PersonalDetails = (props) => {
"account:account-address-line-1-label"
)}
validate={[required]}
errorMsg="Is required"
errorMsg={t("account:is-required-label")}
/>
<Field
name="address1_line2"
@@ -354,7 +356,7 @@ let PersonalDetails = (props) => {
label={t(
"account:account-address-line-2-label"
)}
errorMsg="Is required"
errorMsg={t("account:is-required-label")}
/>
<Field
name="address1_city"
@@ -364,7 +366,7 @@ let PersonalDetails = (props) => {
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")}
/>
<Field
name="address1_county"
@@ -374,7 +376,7 @@ let PersonalDetails = (props) => {
className="govuk-input govuk-input--width-10"
label={t("account:account-county-label")}
validate={[required]}
errorMsg="Is required"
errorMsg={t("account:is-required-label")}
/>
<Field
name="address1_postalcode"
@@ -1015,7 +1015,7 @@ let S78_Questionnaire = (props) => {
"myrepresentations:s78-section-question-signed"
)}
validate={[required]}
errorMsg="Is required"
errorMsg={t("myrepresentations:is-required-label")}
/>
</div>
<div className="govuk-form-group">
@@ -1030,7 +1030,7 @@ let S78_Questionnaire = (props) => {
label={t(
"myrepresentations:s78-section-question-onbehalf"
)}
errorMsg="Is required"
errorMsg={t("myrepresentations:is-required-label")}
/>
</div>
<Field
@@ -1041,7 +1041,7 @@ let S78_Questionnaire = (props) => {
validate={[required]}
dateStart="0"
dateEnd="1-y"
errorMsg="Is required"
errorMsg={t("myrepresentations:is-required-label")}
locale={locale}
/>
</fieldset>
+7 -4
View File
@@ -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) => {
+5 -1
View File
@@ -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"
}
+3 -1
View File
@@ -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"
}
+1
View File
@@ -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",
+5 -1
View File
@@ -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"
}
+3 -1
View File
@@ -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"
}
+1
View File
@@ -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",