Reputation: 1674
I have a NextJs 12 app which have urls domain.com and domain.com/es we use OneTrus cookie banner in _document.ts like so
<Head>
<Script
id="one-trust"
strategy="beforeInteractive"
src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
data-domain-script="xxx"
/>
<Script id="one-trust-optanonWrapper" type="text/javascript">
function OptanonWrapper() {}
</Script>
<Favicon />
</Head>
the new requirement is that on /es version the OntTrust cookie banner should be in spanish. We have information that it is setup in one trust manager, bu we are having hard times with setting it up on the frontend, does anyone know how can i enable spanish language in Cookie Banner on /es route? Many thanks.
Upvotes: 0
Views: 1431
Reputation: 507
In the OneTrust settings, you can choose between
If you go with 2, you need to make sure to set the lang
attribute of the html element
Depending on your setup, you can use the i18n setup baked into Next.js to make sure that the lang attribute is set based on the locale(s) you want to support. You can also check that article on for more explanations: https://dev.to/dawsoncodes/how-to-set-html-lang-attribute-in-nextjs-39bg
Upvotes: 2