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
+18 -75
View File
@@ -1,4 +1,3 @@
import { JSONPath as jsonpath } from "jsonpath-plus";
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
@@ -34,6 +33,7 @@ import {
setWatchedCasesDetails
} from "../../store/watchedCases/action";
import { getFormCollectionByID, getDetailsProxy } from "../utils";
import resolveCrmDisplayValue from "../../lib/i18n/crmDisplay/resolveCrmDisplayValue";
const TopThree = (props) => {
let { t } = useTranslation();
@@ -196,19 +196,6 @@ const TopThree = (props) => {
<b>{showTopThreeArr[key].pinswg_name}</b>
) : (
<span
// href="#"
// href={{
// pathname:
// router.locale == "cy"
// ? "/fymhorth/representation"
// : "/myportal/representation",
// query: {
// case: showTopThreeArr[key].ticketnumber,
// state: "edit",
// created:
// showTopThreeArr[key].repfile_name,
// },
// }}
className="govuk-link--no-underline"
style={{
color: "#0360a6",
@@ -292,54 +279,19 @@ const TopThree = (props) => {
</div>
<div className="cardModuleReference">
<b>{t("myportal:representation-type")}:</b>
{" "}
{router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
showTopThreeArr[key].representationType +
'")].value_cy',
json: transLookup,
eval: true
})
: showTopThreeArr[key].representationType || ""}
{resolveCrmDisplayValue({
value: showTopThreeArr[key].representationType,
locale,
translations: transLookup
})}
</div>
<div className="cardModuleReference">
<b>{t("myportal:capacity")}:</b>
{" "}
{router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
showTopThreeArr[key]
.representationCapacity +
'" ||@.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'" )].value_cy',
json: transLookup,
eval: true
})
: jsonpath({
path:
'$..[?(@ && @.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'")].value',
json: transLookup,
eval: true
}).length > 0
? jsonpath({
path:
'$..[?(@ && @.value_cy=="' +
showTopThreeArr[key]
.representationCapacity +
'")].value',
json: transLookup,
eval: true
})
: showTopThreeArr[key].representationCapacity}
{resolveCrmDisplayValue({
value: showTopThreeArr[key].representationCapacity,
locale,
translations: transLookup
})}
</div>
<div className="cardModuleReference">
<b>{t("myportal:date-raised")}:</b>
@@ -348,22 +300,13 @@ const TopThree = (props) => {
</div>{" "}
<div className="cardModuleReference">
<b>{router.locale == "cy" ? "ACLl" : "LPA"}:</b>
{" "}
{router.locale == "cy"
? jsonpath({
path:
'$..[?(@ && @.value=="' +
showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true
})
: showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] || ""}
{resolveCrmDisplayValue({
value: showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
],
locale,
translations: transLookup
})}
</div>
{showTopThreeArr[key].hasOwnProperty("repComplete") && (
<div className="cardModuleReference">