From 597a0a91d16ab8535c35d43b2308c313badb64d5 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 21 Sep 2021 10:16:27 +0100 Subject: [PATCH] added in welsh translations for crm values --- components/breadcrumbs.js | 135 ++++++++++++++++++++---- components/case/summary.js | 162 +++++++++++++++++++--------- components/main.js | 2 +- components/search/searchresults.js | 82 +++++++++++---- data/lookuptranslations.json | 163 ++++++++++++++++++++++++++++- locales/cy/case.json | 1 + locales/cy/common.json | 4 +- locales/cy/search.json | 1 + locales/en/case.json | 1 + locales/en/common.json | 4 +- locales/en/search.json | 1 + 11 files changed, 465 insertions(+), 91 deletions(-) diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 7b51b60a..c54c3a7c 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -45,8 +45,10 @@ const Breadcrumbs = (props) => {
  1. - - GOV.WALES + + + {t("common:gov-wales-label")} +
  2. @@ -72,7 +74,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/myportal/searchresults" ? ( <>
  3. - + {t("common:breadcrumb-my-portal")} @@ -97,7 +105,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/newappeal" ? ( <>
  4. - + {t("newappeal:parent-page-title")} @@ -113,14 +127,26 @@ const Breadcrumbs = (props) => { {router.pathname == "/newappeal/selectappeal" ? ( <>
  5. - + {t("newappeal:parent-page-title")}
  6. - + {t("newappeal:page-title")} @@ -136,7 +162,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/viewall" ? ( <>
  7. - + {t("common:breadcrumb-my-portal")} @@ -152,7 +184,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/myportal/viewall" ? ( <>
  8. - + {t("common:breadcrumb-my-portal")} @@ -168,14 +206,26 @@ const Breadcrumbs = (props) => { {router.pathname == "/myportal/case" ? ( <>
  9. - + {t("common:breadcrumb-my-portal")}
  10. - + Your cases{" "} @@ -197,8 +247,12 @@ const Breadcrumbs = (props) => {
  11. - + {t("common:breadcrumb-my-portal")} @@ -243,7 +303,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/account/personaldetails" ? ( <>
  12. - + {t("common:breadcrumb-my-portal")} @@ -268,7 +334,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/account/changepassword" ? ( <>
  13. - + {t("common:breadcrumb-my-portal")} @@ -284,7 +356,13 @@ const Breadcrumbs = (props) => { {router.pathname == "/dns" ? ( <>
  14. - + {t("dnsCommon:service-name")} @@ -333,7 +411,14 @@ const Breadcrumbs = (props) => { {router.pathname == "/dns/application-view" ? ( <>
  15. - + {t( "dnsApplicationView:page-parent-title" @@ -351,14 +436,26 @@ const Breadcrumbs = (props) => { {!_.isEmpty(slug) ? ( <>
  16. - + {t("common:breadcrumb-my-portal")}
  17. - + New Appeal diff --git a/components/case/summary.js b/components/case/summary.js index e5ad44dc..cd4f96fb 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -3,6 +3,7 @@ import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import jsonpath from "jsonpath"; import _ from "lodash"; +import transLookup from "../../data/lookuptranslations.json"; const CaseSummary = (props) => { let { t } = useTranslation(); @@ -72,16 +73,23 @@ const CaseSummary = (props) => { ] || "not entered"}
-
-
- {t("case:summary-agent-label")} -
-
- {_.has(detailsObj, "pinswg_agentcontactname") - ? detailsObj.pinswg_agentcontactname - : ""} -
-
+ {_.has(detailsObj, "pinswg_agentcontactname") ? ( +
+
+ {t("case:summary-agent-label")} +
+
+ {_.has( + detailsObj, + "pinswg_agentcontactname" + ) + ? detailsObj.pinswg_agentcontactname + : ""} +
+
+ ) : ( + "" + )}
{t("case:summary-site-address-label")} @@ -91,19 +99,19 @@ const CaseSummary = (props) => { ? detailsObj.pinswg_siteaddressline1 : ""}
- {_.has(detailsObj, "pinswg_siteaddressline1") + {_.has(detailsObj, "pinswg_siteaddressline2") ? detailsObj.pinswg_siteaddressline2 : ""}
- {_.has(detailsObj, "pinswg_siteaddressline1") + {_.has(detailsObj, "pinswg_siteaddresstown") ? detailsObj.pinswg_siteaddresstown : ""}
- {_.has(detailsObj, "pinswg_siteaddressline1") + {_.has(detailsObj, "pinswg_siteaddresscounty") ? detailsObj.pinswg_siteaddresscounty : ""}
- {_.has(detailsObj, "pinswg_siteaddressline1") + {_.has(detailsObj, "pinswg_siteaddresspostcode") ? detailsObj.pinswg_siteaddresspostcode : ""} @@ -151,9 +159,21 @@ const CaseSummary = (props) => { {t("case:summary-case-type-label")}
- {casesObj[ - "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" - ] || "N/A"} + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + casesObj[ + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : casesObj[ + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-date-entered-label" + )}
@@ -161,16 +181,21 @@ const CaseSummary = (props) => { {t("case:summary-lpa-label")}
- {_.has(detailsObj, [ - "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", - ]) - ? detailsObj[ + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj[ + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : detailsObj[ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" - ] - : ""} + ] || ""}
-
+ {/*
{t( "case:summary-case-summary-label" @@ -184,7 +209,7 @@ const CaseSummary = (props) => { ? detailsObj.pinswg_casedescription : ""} -
+
*/}
{t( @@ -208,13 +233,18 @@ const CaseSummary = (props) => { {t("case:summary-procedure-label")}
- {_.has(detailsObj, [ - "pinswg_procedure@OData.Community.Display.V1.FormattedValue", - ]) - ? detailsObj[ + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj[ + "pinswg_procedure@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : detailsObj[ "pinswg_procedure@OData.Community.Display.V1.FormattedValue" - ] - : ""} + ] || ""}
@@ -222,9 +252,21 @@ const CaseSummary = (props) => { {t("case:summary-status-label")}
- {casesObj[ - "statuscode@OData.Community.Display.V1.FormattedValue" - ] || ""} + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : casesObj[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || + t( + "case:summary-no-date-entered-label" + )}
@@ -232,13 +274,21 @@ const CaseSummary = (props) => { {t("case:summary-decision-label")}
- {_.has(detailsObj, [ - "pinswg_decision@OData.Community.Display.V1.FormattedValue", - ]) - ? detailsObj[ + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj[ + "pinswg_decision@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : detailsObj[ "pinswg_decision@OData.Community.Display.V1.FormattedValue" - ] - : ""} + ] || + t( + "case:summary-no-date-entered-label" + )}
{/* @@ -301,7 +351,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_startdate@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )}
@@ -319,7 +371,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_questionnaireduedate@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} @@ -337,7 +391,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_statementduedate@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} @@ -355,7 +411,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_otherpartiesstatement@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} @@ -373,7 +431,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_finalcommentsduedate@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} @@ -391,7 +451,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_finalcommentsduedate@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} @@ -407,7 +469,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_dateeventrequested@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} @@ -425,7 +489,9 @@ const CaseSummary = (props) => { ? detailsObj[ "pinswg_dateoflpadecision@OData.Community.Display.V1.FormattedValue" ] - : "N/A"} + : t( + "case:summary-no-date-entered-label" + )} diff --git a/components/main.js b/components/main.js index bf5b2b85..ad925872 100644 --- a/components/main.js +++ b/components/main.js @@ -28,7 +28,7 @@ export default function Home({ children, pages }) { - {/* */} + diff --git a/components/search/searchresults.js b/components/search/searchresults.js index a7842b99..dce2de78 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -5,6 +5,7 @@ import { setCurrentReference } from "../../store/currentView/action"; import { connect } from "react-redux"; import jsonpath from "jsonpath"; import _ from "lodash"; +import transLookup from "../../data/lookuptranslations.json"; const SearchResults = (props) => { const { @@ -30,7 +31,8 @@ const SearchResults = (props) => { {t("search:searchresults-count-label", { count: searchResultsObj["@odata.count"].toString(), })} - . You searched for "{searchString}" + . {t("search:searchresults-case-count-label")}{" "} + "{searchString}"

@@ -76,7 +78,10 @@ const SearchResults = (props) => { }} > - Case Reference: + {t( + "search:searchresults-case-reference-label" + )} + : {item.title} @@ -84,7 +89,10 @@ const SearchResults = (props) => {
- Site Address:{" "} + {t( + "search:searchresults-site-address-label" + )} + : {_.has( detailsObj, @@ -123,7 +131,10 @@ const SearchResults = (props) => {
- Appellant/Applicant: + {t( + "search:searchresults-applicant-label" + )} + : {_.has(detailsObj, [ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", @@ -135,35 +146,66 @@ const SearchResults = (props) => {
- Authority: + {t( + "search:searchresults-authority-label" + )} + : {_.has(detailsObj, [ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", ]) - ? detailsObj[ - "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" - ] + ? router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + detailsObj[ + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : detailsObj[ + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" + ] || "N/A" : ""}
- Case Type: + {t( + "search:searchresults-case-type-label" + )} + : - { - item[ - "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" - ] - } + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + item[ + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : item[ + "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" + ] || "N/A"}
- Status: + {t("search:searchresults-status-label")} + : - { - item[ - "statuscode@OData.Community.Display.V1.FormattedValue" - ] - } + + {router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + item[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : item[ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || "N/A"}
); diff --git a/data/lookuptranslations.json b/data/lookuptranslations.json index 7fdf3517..1c77f083 100644 --- a/data/lookuptranslations.json +++ b/data/lookuptranslations.json @@ -177,5 +177,166 @@ "value_cy": "Ymchwilio", "statuscode": 5 } + ], + "pinswg_decision": [ + { + "value": "Dismissed", + "value_cy": "Diswyddo", + "pinswg_decision": 846040001 + }, + { + "value": "Split Decision", + "value_cy": "Penderfyniad Hollt", + "pinswg_decision": 846040002 + } + ], + "pinswg_lpa": [ + { + "value": "Blaenau Gwent County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Blaenau Gwent", + "pinswg_lpa": 0 + }, + { + "value": "Bridgend County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Pen-y-bont ar Ogwr", + "pinswg_lpa": 0 + }, + { + "value": "Caerphilly County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Caerffili", + "pinswg_lpa": 0 + }, + { + "value": "Cardiff Council", + "value_cy": "Cyngor Caerdydd", + "pinswg_lpa": 0 + }, + { + "value": "Cardiff City Council", + "value_cy": "Cyngor Caerdydd", + "pinswg_lpa": 0 + }, + { + "value": "Carmarthenshire County Council", + "value_cy": "Cyngor Sir Gaerfyrddin", + "pinswg_lpa": 0 + }, + { + "value": "Ceredigion County Council", + "value_cy": "Cyngor Sir Ceredigion", + "pinswg_lpa": 0 + }, + { + "value": "Conwy County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Conwy", + "pinswg_lpa": 0 + }, + { + "value": "Denbighshire County Council", + "value_cy": "Cyngor Sir Ddinbych", + "pinswg_lpa": 0 + }, + { + "value": "Flintshire County Council", + "value_cy": "Cyngor Sir y Fflint", + "pinswg_lpa": 0 + }, + { + "value": "Gwynedd Council", + "value_cy": "Cyngor Gwynedd", + "pinswg_lpa": 0 + }, + { + "value": "Isle of Anglesey County Council", + "value_cy": "Cyngor Sir Ynys Môn", + "pinswg_lpa": 0 + }, + { + "value": "Merthyr Tydfil County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Merthyr Tudful", + "pinswg_lpa": 0 + }, + { + "value": "Monmouthshire County Council", + "value_cy": "Cyngor Sir Fynwy", + "pinswg_lpa": 0 + }, + { + "value": "Neath Port Talbot County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Castell-nedd Port Talbot", + "pinswg_lpa": 0 + }, + { + "value": "Newport City Council", + "value_cy": "Cyngor Dinas Casnewydd", + "pinswg_lpa": 0 + }, + { + "value": "Pembrokeshire County Council", + "value_cy": "Cyngor Sir Penfro", + "pinswg_lpa": 0 + }, + { + "value": "Powys County Council", + "value_cy": "Cyngor Sir Powys", + "pinswg_lpa": 0 + }, + { + "value": "Rhondda Cynon Taf County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Rhondda Cynon Taf", + "pinswg_lpa": 0 + }, + { + "value": "Swansea Council", + "value_cy": "Cyngor a Dinas Abertawe", + "pinswg_lpa": 0 + }, + { + "value": "Torfaen County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Torfaen", + "pinswg_lpa": 0 + }, + { + "value": "Vale of Glamorgan Council", + "value_cy": "Cyngor Bro Morgannwg", + "pinswg_lpa": 0 + }, + { + "value": "Wrexham County Borough Council", + "value_cy": "Cyngor Bwrdeistref Sirol Wrecsam", + "pinswg_lpa": 0 + }, + { + "value": "Brecon Beacons National Park", + "value_cy": "Parc Cenedlaethol Bannau Brycheiniog", + "pinswg_lpa": 0 + }, + { + "value": "Pembrokeshire Coast National Park", + "value_cy": "Parc Cenedlaethol Arfordir Penfro", + "pinswg_lpa": 0 + }, + { + "value": "Snowdonia National Park", + "value_cy": "Parc Cenedlaethol Eryri", + "pinswg_lpa": 0 + } + ], + "pinswg_procedure": [ + { + "value": "Written representation", + "value_cy": "Cynrychiolaeth ysgrifenedig", + "pinswg_procedure": 0 + }, + { + "value": "Hearing", + "value_cy": "Clyw", + "pinswg_procedure": 0 + }, + { + "value": "Inquiry", + "value_cy": "Ymholiad", + "pinswg_procedure": 0 + } ] -} +} \ No newline at end of file diff --git a/locales/cy/case.json b/locales/cy/case.json index 28237029..2f6e0bfd 100644 --- a/locales/cy/case.json +++ b/locales/cy/case.json @@ -18,6 +18,7 @@ "summary-case-link-status-not-linked": "Heb gysylltiad", "summary-linked-cases-label": "Achosion cysylltiedig", "summary-dates-label": "Dyddiadau", + "summary-no-date-entered-label": "dim dyddiad wedi'i nodi", "summary-start-date-label": "Dyddiad Dechrau", "summary-questionnaire-due-date-label": "Holiadur i ddod", "summary-statement-due-date-label": "Datganiad (au) i ddod", diff --git a/locales/cy/common.json b/locales/cy/common.json index 0ea810b4..692f7a13 100644 --- a/locales/cy/common.json +++ b/locales/cy/common.json @@ -1,4 +1,6 @@ { + "gov-wales-link": "https://llyw.cymru", + "gov-wales-label": "LLYW.CYMRU", "service-name": "Cynllunio gwaith achos", "breadcrumb-back-link": "Yn ôl", "error-radio": "Dewiswch opsiwn", @@ -17,7 +19,7 @@ "back-to-top-link": "Nôl i dop y dudalen", "social-bar-share-link": "Rhannu’r dudalen hon", "social-bar-share-via-link": "Rhannu’r dudalen hon ar", - "breadcrumb-search-results" : "Canlyniadau chwilio", + "breadcrumb-search-results": "Canlyniadau chwilio", "breadcrumb-my-portal": "Fy mhorth", "breadcrumb-case-reference": "Cyfeirnod Achos" } \ No newline at end of file diff --git a/locales/cy/search.json b/locales/cy/search.json index 8c06a24a..d155c0fb 100644 --- a/locales/cy/search.json +++ b/locales/cy/search.json @@ -48,6 +48,7 @@ "searchresults-title-label": "Crynodeb o’r Achos ar gyfer", "searchresults-count-label": "Cafodd eich chwiliad {{count}} o ganlyniadau", "searchresults-case-reference-label": "Cyfeirnod yr Achos", + "searchresults-case-count-label": "Fe wnaethoch chi chwilio am", "searchresults-site-address-label": "Cyfeiriad y Safle", "searchresults-applicant-label": "Apelydd/Ymgeisydd", "searchresults-authority-label": "ACLl", diff --git a/locales/en/case.json b/locales/en/case.json index f7a70dd3..2f447cc6 100644 --- a/locales/en/case.json +++ b/locales/en/case.json @@ -18,6 +18,7 @@ "summary-case-link-status-not-linked": "Not linked", "summary-linked-cases-label": "Linked Cases", "summary-dates-label": "Dates", + "summary-no-date-entered-label": "no date entered", "summary-start-date-label": "Start Date", "summary-questionnaire-due-date-label": "Questionnaire due", "summary-statement-due-date-label": "Statement(s) due", diff --git a/locales/en/common.json b/locales/en/common.json index 0988a675..33b7b483 100644 --- a/locales/en/common.json +++ b/locales/en/common.json @@ -1,4 +1,6 @@ { + "gov-wales-link": "https://www.gov.wales", + "gov-wales-label": "GOV.WALES", "service-name": "Planning casework", "breadcrumb-back-link": "Back", "error-radio": "Choose an option", @@ -17,7 +19,7 @@ "back-to-top-link": "Back to top", "social-bar-share-link": "Share this page", "social-bar-share-via-link": "Share this page via", - "breadcrumb-search-results" : "Search results", + "breadcrumb-search-results": "Search results", "breadcrumb-my-portal": "My portal", "breadcrumb-case-reference": "Case Reference" } \ No newline at end of file diff --git a/locales/en/search.json b/locales/en/search.json index f01021e7..4e314770 100644 --- a/locales/en/search.json +++ b/locales/en/search.json @@ -48,6 +48,7 @@ "searchresults-title-label": "Search for a case", "searchresults-count-label": "Your search returned {{count}} results", "searchresults-case-reference-label": "Case reference", + "searchresults-case-count-label": "You searched for", "searchresults-site-address-label": "Site address", "searchresults-applicant-label": "Appellant/Applicant", "searchresults-authority-label": "Authority",