Merged PR 2420: added welsh translations of api endpoints
added welsh translations of api endpoints Related work items: #23879
This commit is contained in:
@@ -2,6 +2,8 @@ import { consoleLogger } from "../../../actions/core/logger";
|
||||
import OSPoint from "ospoint";
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
import { relayGetData } from "../middleware/relayForwarding";
|
||||
import transLookup from "../../../data/lookuptranslations.json";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
|
||||
const renameKeys = (obj) => {
|
||||
const keyMappings = {
|
||||
@@ -52,7 +54,31 @@ const renameKeys = (obj) => {
|
||||
obj.pinswg_sipscase[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
renamedObj.description = obj.pinswg_sipscase.description;
|
||||
//renamedObj.description = obj.pinswg_sipscase.description;
|
||||
|
||||
const descriptionText = obj?.pinswg_sipscase?.description || "";
|
||||
|
||||
let description = descriptionText;
|
||||
let description_cy = null;
|
||||
|
||||
// Split on >>> first, otherwise ;
|
||||
const parts = descriptionText.includes(">>>")
|
||||
? descriptionText.split(">>>")
|
||||
: descriptionText.includes(";")
|
||||
? descriptionText.split(";")
|
||||
: null;
|
||||
|
||||
if (parts && parts.length >= 2) {
|
||||
description = parts[0].trim();
|
||||
description_cy = parts.slice(1).join(" ").trim();
|
||||
}
|
||||
|
||||
renamedObj.description = description;
|
||||
|
||||
if (description_cy) {
|
||||
renamedObj.description_cy = description_cy;
|
||||
}
|
||||
|
||||
renamedObj.incidentId = obj.pinswg_sipscase.incidentid;
|
||||
}
|
||||
|
||||
@@ -63,7 +89,31 @@ const renameKeys = (obj) => {
|
||||
obj.pinswg_DNSIds[
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
];
|
||||
renamedObj.description = obj.pinswg_DNSIds.description;
|
||||
//renamedObj.description = obj.pinswg_DNSIds.description;
|
||||
|
||||
const descriptionText = obj?.pinswg_DNSIds?.description || "";
|
||||
|
||||
let description = descriptionText;
|
||||
let description_cy = null;
|
||||
|
||||
// Split on >>> first, otherwise ;
|
||||
const parts = descriptionText.includes(">>>")
|
||||
? descriptionText.split(">>>")
|
||||
: descriptionText.includes(";")
|
||||
? descriptionText.split(";")
|
||||
: null;
|
||||
|
||||
if (parts && parts.length >= 2) {
|
||||
description = parts[0].trim();
|
||||
description_cy = parts.slice(1).join(" ").trim();
|
||||
}
|
||||
|
||||
renamedObj.description = description;
|
||||
|
||||
if (description_cy) {
|
||||
renamedObj.description_cy = description_cy;
|
||||
}
|
||||
|
||||
renamedObj.incidentId = obj.pinswg_DNSIds.incidentid;
|
||||
}
|
||||
|
||||
@@ -82,6 +132,24 @@ const renameKeys = (obj) => {
|
||||
renamedObj.northing = String(renamedObj.northing);
|
||||
}
|
||||
|
||||
renamedObj.lpaDisplayName_cy = jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
renamedObj.lpaDisplayName +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true
|
||||
})[0];
|
||||
|
||||
renamedObj.statusCodeDescription_cy = jsonpath({
|
||||
path:
|
||||
'$..[?(@ && @.value=="' +
|
||||
renamedObj.statusCodeDescription +
|
||||
'")].value_cy',
|
||||
json: transLookup,
|
||||
eval: true
|
||||
})[0];
|
||||
|
||||
return renamedObj;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export default async function ApiProxy(req, res) {
|
||||
const queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
loggedInUserId +
|
||||
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
"&$select=pinswg_emailnotifications,modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
|
||||
|
||||
return relayGet({
|
||||
queryUrl,
|
||||
|
||||
Reference in New Issue
Block a user