Merged PR 2449: language helper

Related work items: #23754
This commit is contained in:
Robert Bond
2026-07-01 11:29:15 +00:00
parent 49aa258fd9
commit e864049bec
63 changed files with 4008 additions and 6094 deletions
+80 -140
View File
@@ -46,6 +46,7 @@ import {
setMyRepresentations,
setMyRepresentationsDetails
} from "../../store/myRepresentations/action";
import resolveCrmDisplayValue from "../../lib/i18n/crmDisplay/resolveCrmDisplayValue";
const ViewAllResults = (props) => {
const {
@@ -493,86 +494,66 @@ const ViewAllResults = (props) => {
</span>
{isAwaitingSubmissionDetails &&
hasOwn(resultItem, "pinswg_lpaname")
? router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
resultItem.pinswg_lpaname +
'")].value_cy',
json: transLookup,
eval: true
})
: resultItem.pinswg_lpaname || "N/A"
? resolveCrmDisplayValue({
value: resultItem.pinswg_lpaname,
locale: router.locale,
translations: transLookup,
fallbackValue: "N/A"
})
: ""}
{hasOwn(resultItem, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
])
? router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
resultItem[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
})
: resultItem[
? resolveCrmDisplayValue({
value: resultItem[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
],
locale: router.locale,
translations: transLookup,
fallbackValue: "N/A"
})
: ""}
{hasOwn(searchDetailsObj[key], [
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
])
? router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
(searchDetailsObj[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] ||
searchDetailsObj[key]?.value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
]) +
'")].value_cy',
json: transLookup,
eval: true
})
: isMyRepresentations
? searchDetailsObj[key].value
: searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
? resolveCrmDisplayValue({
value:
searchDetailsObj[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] ||
searchDetailsObj[key]?.value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
],
locale: router.locale,
translations: transLookup,
fallbackValue: isMyRepresentations
? searchDetailsObj[key].value
: searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
})
: ""}
{hasOwn(resultItem, [
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
])
? router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
resultItem[
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
})
: resultItem[
? resolveCrmDisplayValue({
value: resultItem[
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || (isMyRepresentations ? "" : "N/A")
],
locale: router.locale,
translations: transLookup,
fallbackValue: isMyRepresentations
? ""
: "N/A"
})
: isMyRepresentations &&
router.locale === "cy" &&
jsonpath({
path:
'$..[?(@ && @.value=="' +
searchDetailsObj[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
resolveCrmDisplayValue({
value: searchDetailsObj[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
],
locale: router.locale,
translations: transLookup
})}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
@@ -581,50 +562,36 @@ const ViewAllResults = (props) => {
</span>
{isAwaitingSubmissionDetails
? router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
getFormCollectionByID(
item.pinswg_appealcasetype
).value +
'")].value_cy',
json: transLookup,
eval: true
})
: getFormCollectionByID(
? resolveCrmDisplayValue({
value: getFormCollectionByID(
item.pinswg_appealcasetype
).value || "N/A"
: router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
})
: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] || (isMyRepresentations ? "" : "N/A")}
).value,
locale: router.locale,
translations: transLookup,
fallbackValue: "N/A"
})
: resolveCrmDisplayValue({
value: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
],
locale: router.locale,
translations: transLookup,
fallbackValue: isMyRepresentations
? ""
: "N/A"
})}
{isMyRepresentations &&
(router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
getFormCollectionByID(
searchDetailsObj[key].appealType
).value +
'")].value_cy',
json: transLookup,
eval: true
})[0]
: getFormCollectionByID(
searchDetailsObj[key].appealType
).value)}
resolveCrmDisplayValue({
value: getFormCollectionByID(
searchDetailsObj[key].appealType
).value,
locale: router.locale,
translations: transLookup,
fallbackValue: getFormCollectionByID(
searchDetailsObj[key].appealType
).value
})}
{hasOwn(
searchDetailsObj[key],
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
@@ -658,41 +625,14 @@ const ViewAllResults = (props) => {
}) || "N/A"
: isMyRepresentations
? repRaisedDate(item.repfile_name) // ? router.locale == "cy"
: // ? jsonpath({path:
//
// '$..[?(@ && @.value=="' +
// searchDetailsObj[key].value[0][
// "statuscode@OData.Community.Display.V1.FormattedValue"
// ] +
// '")].value_cy',transLookup,
// )
// : searchDetailsObj[key].value[0][
// "statuscode@OData.Community.Display.V1.FormattedValue"
// ] || "N/A"
// : router.locale == "cy"
// ? jsonpath({path:
//
// '$..[?(@ && @.value=="' +
// item[
// "statuscode@OData.Community.Display.V1.FormattedValue"
// ] +
// '")].value_cy',transLookup,
// )
router.locale === "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
item[
"statuscode@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
})
: item[
"statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
: resolveCrmDisplayValue({
value: item[
"statuscode@OData.Community.Display.V1.FormattedValue"
],
locale: router.locale,
translations: transLookup,
fallbackValue: "N/A"
})}
</dd>
{isAwaitingSubmissionDetails && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">