diff --git a/components/pdftemplates/other_pdf.js b/components/pdftemplates/other_pdf.js index 98bcee2b..32ef06aa 100644 --- a/components/pdftemplates/other_pdf.js +++ b/components/pdftemplates/other_pdf.js @@ -11,7 +11,19 @@ import ReactPDF, { import { createElement } from "react"; import Html from "react-pdf-html"; import { getFormCollectionByID } from "../../components/utils"; -import useTranslation from "next-translate/useTranslation"; + +import transLookupCY from "../../locales/cy/myrepresentations.json"; +import transLookupEN from "../../locales/en/myrepresentations.json"; +import { JSONPath as jsonpath } from "jsonpath-plus"; + +const getTrans = (locale, key) => { + let jsonQuery = `$.${key}`; + + let jsonObj = locale == "cy" ? transLookupCY : transLookupEN; + + console.log(locale, jsonObj[key]); + return jsonObj[key]; +}; const styles = StyleSheet.create({ page: { @@ -89,7 +101,6 @@ const styles = StyleSheet.create({ }); export const other_pdf = ({ docProps }) => { - let { t } = useTranslation(); //console.log("----", docProps); function formatDates(dateObj) { var dateObj = new Date(dateObj); @@ -164,10 +175,10 @@ export const other_pdf = ({ docProps }) => { > 1. - {t( - "myrepresentations:s78-section-question-1" + {getTrans( + docProps.locale, + "s78-section-question-1" )} - : {values.caseRef}