I'm currently developing an Angular application and utilizing OneTrust for managing cookie consent. The issue I'm encountering is that while the rest of the components on the login page are properly translated into the target language, the OneTrust cookie banner remains in English.
Below is my TypeScript function to handle the OneTrust Cookie Banner:
loadOneTrustCookieJavaScript()
{
let OTjs = document.createElement('script') as HTMLScriptElement;
OTjs.src = "https://cdn.cookielaw.org/scripttemplates/otSDKStub.js";
OTjs.type = "text/javascript";
OTjs.charset = "UTF-8";
OTjs.setAttribute("data-domain-script", environment.OneTrustKey);
OTjs.setArrtibute("data-document-language", true);
let OTfn = document.createElement('script') as HTMLScriptElement;
OTfn.type = "text/javascript";
OTfn.textContent = "function OptanonWrapper(){ }"'
head.appendChild(OTjs);
head.appendChild(OTfn);
}