All questions

Combining Sanity localized documents with personalized experiences

Asked by Hugo Marchand on

HMHugo Marchand

Our Sanity dataset has document translations for fr and en, and the frontend picks the document by locale. Now we want to personalize the homepage hero with Croct.

My worry is the combinatorics. Do I need one experience per locale, so every audience gets duplicated for fr and en? That would double the maintenance for every campaign we run. I am hoping there is a way to keep one experience and have it serve the right language variant, but I could not find a clear answer in what I read so far

Was this helpful?

1 answer

Iirene.v

You do not need one experience per locale. Content fetches accept a preferredLocale option, so you pass the locale your frontend already resolved and one experience serves the matching language variant. Multi-language works without extra development beyond passing that option:

const {content} = await fetchContent('home-hero', {    preferredLocale: locale, // 'fr' or 'en'    fallback: heroFromSanity,});

Inside the experience you provide the variant content per locale, so the audience logic is defined once and the copy varies by language. No duplicated audiences, no per-locale experiments.

Two details to plan for:

  1. Per-locale default content on the Croct side (their localization feature) is an add-on, so check it is on your plan if you want localized defaults managed there.
  2. In practice you may not need it, because your localized Sanity document remains the fallback for its locale. Anyone not matching an experience gets the fr or en document exactly as today, which keeps your current i18n setup as the safety net.
Was this helpful?
Still have questions?