I’m trying to add some block level localization of text. I’ve added locale as a custom targeting attribute. I’ve integrated the locale into both my BuilderComponent
definition, and recently added it as a userAttribute to my getServerSideProps
builder.get
call. The localized text looks great in the Visual Editor but as soon as I publish my page, no matter what my browser locale is set to (I’ve tried en-US, en-AU and en-NZ explicitly), it shows the localized text areas as [object Object]
.
My BuilderComponent looks like this:
<BuilderComponent
model={model}
content={content}
renderLink={renderLink}
locale={locale}
/>
getServerSideProps
looks like this:
const serverSide = serverSideService.fromGetServerSideProps(context);
const { locale } = context;
const utmContent = serverSide.getQueryParam('utm_content');
const landingPage = await builder.get(pageModelKeys.page, {
userAttributes: {
urlPath: `/mothers-day`,
utmContent,
locale
},
}).toPromise();
(The serverSideService
is a helper class to give easy access to the data in the context
object)
What am I doing wrong? FWIW, I do NOT have locales currently setup in NextJS (but I can see that the correct browser locale is getting passed in via context). Is that required for this to work?
Builder content link
Builder public api key
c3e3257ff5594facbf478a68d37f766d
What are you trying to accomplish
Trying to localize pricing content on a page for locales: [en-US, en-CA, en-AU, en-NZ]
Screenshots or video link
Code stack you are integrating Builder with
NextJS