DocumentationLocale variants

Locale variants

locale and localeGroupId — multi-language template versions.

Group equivalent templates in different languages using locale and localeGroupId on EmailTemplateVersion.

Supported locales

es · en · it · fr · ca · de · null (neutral fallback)

Data model

FieldDescription
localeLanguage code for this version
localeGroupIdShared ID linking equivalent variants
null localeNeutral version — final fallback in campaigns

When localeGroupId is null on the base version, its version ID acts as the group anchor.

Create variants

  1. Publish a base template version (e.g. Spanish es)
  2. Create a new version with the same localeGroupId and locale: "en"
  3. Translate subject and HTML
  4. Publish each variant
PATCH /templates/:id/versions/:versionId
{
  "locale": "en",
  "localeGroupId": "clxgroup..."
}

Campaign routing (ADR-033)

When a campaign sends, the fan-out picks the template per contact:

  1. Variant matching Contact.locale
  2. CAMPAIGN_FALLBACK_LOCALE (default es)
  3. Campaign base templateVersionId

Resolved locale is stored in email_log.metadata.locale.

Unsubscribe links

Generated unsubscribe URLs include ?lang= with the contact's locale (ADR-029).

Related