:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(surveys): replace 'Default' translation with explicit base_language (#58628)
Lucas Faria1095361a044a
diff --git a/frontend/src/scenes/surveys/BaseLanguagePicker.tsx b/frontend/src/scenes/surveys/BaseLanguagePicker.tsxnew file mode 100644index 000000000000..0c3e279698be--- /dev/null+++ b/frontend/src/scenes/surveys/BaseLanguagePicker.tsx@@ -0,0 +1,74 @@+import { useMemo, useState } from 'react'++import { IconPencil } from '@posthog/icons'+import { LemonButton, LemonInputSelect, Popover } from '@posthog/lemon-ui'++import { COMMON_LANGUAGES, isValidLanguageCode, normalizeLanguageCode } from './language'++interface BaseLanguagePickerProps {+ baseLanguage: string+ onChange: (next: string) => void+ /** Languages already present as translations — filtered out of the picker to avoid collisions. */+ translatedLanguages?: string[]+}++export function BaseLanguagePicker({+ baseLanguage,+ onChange,+ translatedLanguages = [],+}: BaseLanguagePickerProps): JSX.Element {+ const [open, setOpen] = useState(false)++ const normalizedTranslated = useMemo(+ () => new Set(translatedLanguages.map(normalizeLanguageCode)),+ [translatedLanguages]+ )++ const options = useMemo(+ () =>+ COMMON_LANGUAGES.filter((language) => !normalizedTranslated.has(normalizeLanguageCode(language.value))).map(+ (language) => ({ key: language.value, label: language.label })+ ),+ [normalizedTranslated]+ )++ return (+ <Popover+ visible={open}+ onClickOutside={() => setOpen(false)}+ overlay={+ <div className="flex flex-col gap-2 p-2 w-72">+ <p className="text-sm text-muted">+ Pick the language the survey is written in. Translations to this language aren't allowed — the+ original already covers it.+ </p>+ <LemonInputSelect+ mode="single"+ options={options}+ value={[baseLanguage]}+ onChange={(values) => {+ const lang = values[0]+ if (lang && isValidLanguageCode(lang)) {+ onChange(normalizeLanguageCode(lang))+ setOpen(false)+ }+ }}+ placeholder="Search languages"+ data-attr="survey-base-language-select"+ />+ </div>+ }+ >+ <LemonButton+ type="tertiary"+ size="xsmall"+ icon={<IconPencil />}+ onClick={() => setOpen((v) => !v)}+ tooltip="Change the survey's original language"+ data-attr="survey-base-language-change"+ >+ Change+ </LemonButton>+ </Popover>+ )+}diff --git a/frontend/src/scenes/surveys/LegacyTranslationKeysPanel.tsx b/frontend/src/scenes/surveys/LegacyTranslationKeysPanel.tsxnew file mode 100644index 000000000000..5cf6e04e1e98--- /dev/null+++ b/frontend/src/scenes/surveys/LegacyTranslationKeysPanel.tsx@@ -0,0 +1,58 @@+import { IconTrash, IconWarning } from '@posthog/icons'+import { LemonButton, LemonDialog } from '@posthog/lemon-ui'++interface LegacyTranslationKeysPanelProps {+ languages: string[]+ onRemove: (language: string) => void+}++export function LegacyTranslationKeysPanel({+ languages,+ onRemove,+}: LegacyTranslationKeysPanelProps): JSX.Element | null {+ if (languages.length === 0) {+ return null+ }+ return (+ <div className="flex flex-col gap-1 text-sm">+ <div className="flex items-center gap-2 text-warning font-semibold">+ <IconWarning />+ Legacy translation keys+ </div>+ <p className="m-0 text-xs text-muted">+ These codes the SDK can't match. Remove or re-add with a valid BCP-47 code (e.g. 'en', 'es-MX').+ </p>+ <div className="flex flex-wrap gap-2 mt-1">+ {languages.map((language) => (+ <div key={language} className="flex items-center gap-1 rounded border border-border px-2 py-0.5">+ <code className="text-xs">{language}</code>+ <LemonButton+ icon={<IconTrash />}+ status="danger"+ size="xsmall"+ aria-label={`Remove legacy translation '${language}'`}+ data-attr="survey-legacy-translation-remove"+ onClick={() =>+ LemonDialog.open({+ title: 'Remove legacy translation',+ description: (+ <p className="py-2">+ Remove the translation stored under <code>{language}</code>? It currently+ has no effect at runtime — the SDK never matches this code.+ </p>+ ),+ primaryButton: {+ children: 'Remove',+ status: 'danger',+ onClick: () => onRemove(language),+ },+ secondaryButton: { children: 'Cancel' },+ })+ }+ />+ </div>+ ))}+ </div>+ </div>+ )+}diff --git a/frontend/src/scenes/surveys/SurveyEdit.tsx b/frontend/src/scenes/surveys/SurveyEdit.tsxindex ced564856c75..8c92713ae540 100644--- a/frontend/src/scenes/surveys/SurveyEdit.tsx+++ b/frontend/src/scenes/surveys/SurveyEdit.tsx@@ -66,6 +66,7 @@ import {import { SurveyBranchingFlowModal } from './branching-flow/SurveyBranchingFlowModal'import { SURVEY_TYPE_LABEL_MAP, SurveyMatchTypeLabels, defaultSurveyFieldValues } from './constants'+import { COMMON_LANGUAGES, getBaseLanguage, getSurveyLanguageName } from './language'import { SurveyAPIEditor } from './SurveyAPIEditor'import { SurveyAppearancePreview } from './SurveyAppearancePreview'import { HTMLEditor, PresentationTypeCard } from './SurveyAppearanceUtils'@@ -73,7 +74,6 @@ import { SurveyEditQuestionGroup, SurveyEditQuestionHeader } from './SurveyEditQimport { SurveyFormAppearance } from './SurveyFormAppearance'import { DataCollectionType, SurveyEditSection, surveyLogic } from './surveyLogic'import { surveysLogic } from './surveysLogic'-import { COMMON_LANGUAGES } from './SurveyTranslations'import { canUseSurveyWizard } from './utils'function SurveyCompletionConditions(): JSX.Element {@@ -556,7 +556,9 @@ export default function SurveyEdit({ id }: { id: string }): JSX.Element {className="font-semibold hover:underline cursor-pointer">{lang === 'default'- ? 'Default language'+ ? `Original (${getSurveyLanguageName(+ getBaseLanguage(survey)+ )})`: COMMON_LANGUAGES.find((l) => l.value === lang)?.label || lang}@@ -587,6 +589,7 @@ export default function SurveyEdit({ id }: { id: string }): JSX.Element {/>)} else if (activeEditingLanguage) {+ const baseLanguageName = getSurveyLanguageName(getBaseLanguage(survey))return (<div className="px-4 py-2 mt-1 mb-1.5 bg-warning-highlight rounded border border-warning"><span className="text-sm">@@ -595,15 +598,15 @@ export default function SurveyEdit({ id }: { id: string }): JSX.Element {{COMMON_LANGUAGES.find((l) => l.value === activeEditingLanguage)?.label ||activeEditingLanguage}</strong>- . Only user-facing text can be translated - all other fields are editable in the{' '}+ . Only user-facing text can be translated — structural fields stay in the{' '}<buttontype="button"onClick={() => setEditingLanguage(null)}className="font-semibold hover:underline cursor-pointer">- default language- </button>{' '}- only.+ original ({baseLanguageName})+ </button>+ .</span></div>)@@ -1194,7 +1197,7 @@ export default function SurveyEdit({ id }: { id: string }): JSX.Element {<Tooltiptitle={activeEditingLanguage- ? 'Auto disappear can only be changed in the default language'+ ? 'Auto disappear can only be changed in the original language': undefined}>diff --git a/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx b/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsxindex f5b85608a8a8..e75a719f93cf 100644--- a/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx+++ b/frontend/src/scenes/surveys/SurveyEditQuestionRow.tsx@@ -366,7 +366,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Question type can only be changed in the default language'+ ? 'Question type can only be changed in the original language': undefined}data-attr={`survey-question-type-${index}`}@@ -469,7 +469,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Question settings can only be changed in the default language'+ ? 'Question settings can only be changed in the original language': undefined}/>@@ -480,7 +480,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; quname="validation"info={editingLanguage- ? 'Validation settings can only be changed in the default language'+ ? 'Validation settings can only be changed in the original language': undefined}>@@ -488,7 +488,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qu<Tooltiptitle={editingLanguage- ? 'Validation settings can only be changed in the default language'+ ? 'Validation settings can only be changed in the original language': undefined}>@@ -536,7 +536,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Display type can only be changed in the default language'+ ? 'Display type can only be changed in the original language': undefined}options={[@@ -565,7 +565,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Rating scale can only be changed in the default language'+ ? 'Rating scale can only be changed in the original language': undefined}options={question.display === 'emoji' ? SCALE_OPTIONS.EMOJI : SCALE_OPTIONS.NUMBER}@@ -639,7 +639,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Question settings can only be changed in the default language'+ ? 'Question settings can only be changed in the original language': undefined}onChange={toggleIsNpsQuestion}@@ -731,7 +731,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qu<Tooltiptitle={editingLanguage- ? 'Choices can only be modified in the default language'+ ? 'Choices can only be modified in the original language': undefined}>@@ -817,7 +817,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Shuffle options can only be changed in the default language'+ ? 'Shuffle options can only be changed in the original language': undefined}onChange={(checked) =>@@ -891,7 +891,7 @@ export function SurveyEditQuestionGroup({ index, question }: { index: number; qudisabled={!!editingLanguage}disabledReason={editingLanguage- ? 'Submit settings can only be changed in the default language'+ ? 'Submit settings can only be changed in the original language': undefined}/>diff --git a/frontend/src/scenes/surveys/SurveyTranslations.test.ts b/frontend/src/scenes/surveys/SurveyTranslations.test.tsindex 298a5c18f0dd..6baff34cc1d4 100644--- a/frontend/src/scenes/surveys/SurveyTranslations.test.ts+++ b/frontend/src/scenes/surveys/SurveyTranslations.test.ts@@ -1,4 +1,4 @@-import { COMMON_LANGUAGES, COMMON_SURVEY_LANGUAGE_CODES, getSurveyLanguageLabel } from './SurveyTranslations'+import { COMMON_LANGUAGES, COMMON_SURVEY_LANGUAGE_CODES, getSurveyLanguageLabel } from './language'describe('COMMON_LANGUAGES', () => {it('includes Romanian locale options', () => {diff --git a/frontend/src/scenes/surveys/SurveyTranslations.tsx b/frontend/src/scenes/surveys/SurveyTranslations.tsxindex f862c770c311..931082fb4ef8 100644--- a/frontend/src/scenes/surveys/SurveyTranslations.tsx+++ b/frontend/src/scenes/surveys/SurveyTranslations.tsx@@ -1,109 +1,18 @@import { useActions, useValues } from 'kea'-import type { KeyboardEvent } from 'react'import { IconSparkles, IconTrash } from '@posthog/icons'import { LemonButton, LemonDialog, LemonInputSelect, LemonTag } from '@posthog/lemon-ui'-import { COUNTRY_CODE_TO_LONG_NAME, LANGUAGE_CODE_TO_NAME } from 'lib/utils/geography/country'--import { MultipleSurveyQuestion, SurveyQuestion, SurveyQuestionType } from '~/types'-+import { BaseLanguagePicker } from './BaseLanguagePicker'+import {+ COMMON_LANGUAGES,+ DEFAULT_SURVEY_BASE_LANGUAGE,+ getSurveyLanguageLabel,+ getSurveyLanguageName,+} from './language'+import { LegacyTranslationKeysPanel } from './LegacyTranslationKeysPanel'import { surveyLogic } from './surveyLogic'--export const COMMON_SURVEY_LANGUAGE_CODES = [- 'en',- 'en-US',- 'en-GB',- 'es',- 'es-ES',- 'es-MX',- 'fr',- 'fr-FR',- 'fr-CA',- 'de',- 'de-DE',- 'ar',- 'bg',- 'bn',- 'ca',- 'cs',- 'da',- 'el',- 'et',- 'fa',- 'fi',- 'he',- 'hi',- 'hr',- 'hu',- 'id',- 'it',- 'ja',- 'ko',- 'lt',- 'lv',- 'ms',- 'nl',- 'no',- 'pl',- 'pt',- 'pt-BR',- 'pt-PT',- 'ro',- 'ro-RO',- 'ru',- 'sk',- 'sl',- 'sr',- 'sv',- 'th',- 'tr',- 'uk',- 'ur',- 'vi',- 'zh',- 'zh-CN',- 'zh-TW',-]--const REGION_DISPLAY_NAME_OVERRIDES: Record<string, string> = {- CN: 'Simplified',- GB: 'UK',- TW: 'Traditional',- US: 'US',-}--export function getSurveyLanguageLabel(languageCode: string): string {- const hyphenIndex = languageCode.indexOf('-')- if (hyphenIndex === -1) {- const languageName = LANGUAGE_CODE_TO_NAME[languageCode] ?? languageCode- return `${languageName} (${languageCode})`- }- const baseLanguageCode = languageCode.substring(0, hyphenIndex)- const regionCode = languageCode.substring(hyphenIndex + 1)-- const languageName = LANGUAGE_CODE_TO_NAME[baseLanguageCode] ?? baseLanguageCode-- if (!regionCode) {- return `${languageName} (${languageCode})`- }-- const normalizedRegionCode = regionCode.toUpperCase()- const regionName =- REGION_DISPLAY_NAME_OVERRIDES[normalizedRegionCode] ??- COUNTRY_CODE_TO_LONG_NAME[normalizedRegionCode] ??- regionCode-- return `${languageName} - ${regionName} (${languageCode})`-}--export const COMMON_LANGUAGES = COMMON_SURVEY_LANGUAGE_CODES.map((languageCode) => ({- value: languageCode,- label: getSurveyLanguageLabel(languageCode),-}))--const isChoiceQuestion = (question: SurveyQuestion): question is MultipleSurveyQuestion =>- question.type === SurveyQuestionType.SingleChoice || question.type === SurveyQuestionType.MultipleChoice+import { useSurveyTranslationsForm } from './useSurveyTranslationsForm'export function SurveyTranslations(): JSX.Element {const {@@ -113,201 +22,150 @@ export function SurveyTranslations(): JSX.Element {generatingTranslationDrafts,dataProcessingAccepted,} = useValues(surveyLogic)- const { setSurveyValue, setEditingLanguage, generateTranslationDrafts } = useActions(surveyLogic)+ const { setEditingLanguage, generateTranslationDrafts } = useActions(surveyLogic)++ const {+ baseLanguage,+ addedLanguages,+ validKeys,+ invalidKeys,+ pickerOptions,+ pickerError,+ setBaseLanguage,+ addLanguage,+ removeLanguage,+ } = useSurveyTranslationsForm({ editingLanguage, setEditingLanguage })- const surveyTranslations = survey.translations ?? {}- const addedLanguages = Object.keys(surveyTranslations)const getLanguageLabel = (lang: string): string =>COMMON_LANGUAGES.find((language) => language.value === lang)?.label || getSurveyLanguageLabel(lang)const selectLanguage = (lang: string | null): void => setEditingLanguage(lang)- const onLanguageKeyDown = (event: KeyboardEvent<HTMLDivElement>, lang: string | null): void => {- if (event.currentTarget !== event.target) {- return- }- if (event.key === 'Enter' || event.key === ' ') {- event.preventDefault()- selectLanguage(lang)- }- }-- const addLanguage = (lang: string): void => {- if (!lang) {- return- }- const currentTranslations = surveyTranslations- if (currentTranslations[lang]) {- return- }-- // Initialize each question's translation with all translatable fields from defaults- const updatedQuestions = survey.questions.map((question) => {- const questionTranslations = question.translations ?? {}- const baseTranslation = {- question: question.question || '',- description: question.description || '',- buttonText: question.buttonText || '',- }-- const newTranslation = {- ...baseTranslation,- ...(question.type === SurveyQuestionType.Rating- ? {- lowerBoundLabel: question.lowerBoundLabel || '',- upperBoundLabel: question.upperBoundLabel || '',- }- : {}),- ...(isChoiceQuestion(question) ? { choices: question.choices || [] } : {}),- ...(question.type === SurveyQuestionType.Link ? { link: question.link || '' } : {}),- }-- return {- ...question,- translations: {- ...questionTranslations,- [lang]: {- ...questionTranslations[lang],- ...newTranslation,- },- },- }- })-- setSurveyValue('questions', updatedQuestions)- setSurveyValue('translations', {- ...currentTranslations,- [lang]: {- name: survey.name || '',- thankYouMessageHeader: survey.appearance?.thankYouMessageHeader || '',- thankYouMessageDescription: survey.appearance?.thankYouMessageDescription || '',- thankYouMessageCloseButtonText: survey.appearance?.thankYouMessageCloseButtonText || '',- },- })- setEditingLanguage(lang)- }-- const removeLanguage = (lang: string): void => {- // Remove survey-level translations- const currentTranslations = { ...surveyTranslations }- delete currentTranslations[lang]- setSurveyValue('translations', currentTranslations)-- // Remove question-level translations- const updatedQuestions = survey.questions.map((question) => {- if (question.translations && question.translations[lang]) {- const questionTranslations = { ...question.translations }- delete questionTranslations[lang]- return {- ...question,- translations: questionTranslations,- }- }- return question- })- setSurveyValue('questions', updatedQuestions)-- if (editingLanguage === lang) {- setEditingLanguage(null)- }- }return (- <div className="flex flex-col gap-3 rounded border border-border bg-bg-light p-3">- <div className="flex gap-2">- <LemonInputSelect- mode="single"- options={COMMON_LANGUAGES.filter((l) => !addedLanguages.includes(l.value)).map((l) => ({- key: l.value,- label: l.label,- }))}- onChange={(values) => {- const lang = values[0]- if (lang) {- addLanguage(lang)- }- }}- placeholder="Add a language (e.g., 'fr', 'French', 'fr-CA')"- className="grow"- allowCustomValues- value={[]}+ <div className="flex flex-col gap-3">+ <div className="flex flex-wrap items-baseline gap-x-3 gap-y-1">+ <h4 className="m-0 text-sm font-semibold uppercase tracking-wide text-muted">Original language</h4>+ <span className="text-sm">+ Survey is written in <strong>{getSurveyLanguageName(baseLanguage)}</strong>{' '}+ <span className="text-muted">({baseLanguage})</span>+ </span>+ <BaseLanguagePicker+ baseLanguage={baseLanguage}+ onChange={setBaseLanguage}+ translatedLanguages={addedLanguages}/>- <LemonButton- type="secondary"- icon={<IconSparkles />}- loading={generatingTranslationDrafts}- disabledReason={- !editingLanguage- ? 'Add or select a language before generating translations'- : survey.id === 'new'- ? 'Save the survey before generating translations'- : !dataProcessingAccepted- ? 'AI data processing must be approved to generate translations'- : undefined- }- onClick={() => editingLanguage && generateTranslationDrafts(editingLanguage)}- >- Fill with AI- </LemonButton></div>- <div className="flex flex-wrap gap-2">- {addedLanguages.length > 0 && (- <div- role="button"- tabIndex={0}- className={`flex items-center justify-between gap-2 px-2 py-1.5 border rounded cursor-pointer ${editingLanguage === null ? 'border-warning bg-warning-highlight' : 'border-border bg-bg-light'}`}- onClick={() => selectLanguage(null)}- onKeyDown={(event) => onLanguageKeyDown(event, null)}- >- <span>Default (original)</span>- </div>- )}-- {addedLanguages.map((lang) => (- <div- key={lang}- role="button"- tabIndex={0}- className={`flex items-center justify-between gap-2 px-2 py-1 border rounded cursor-pointer ${editingLanguage === lang ? 'border-warning bg-warning-highlight' : 'border-border bg-bg-light'}`}- onClick={() => selectLanguage(lang)}- onKeyDown={(event) => onLanguageKeyDown(event, lang)}- >- <div className="flex items-center gap-2">- <span>{getLanguageLabel(lang)}</span>- {aiGeneratedTranslationFields.some((path) => path.includes(`.${lang}.`)) && (- <LemonTag type="highlight">AI draft</LemonTag>- )}- </div>- <LemonButton- icon={<IconTrash />}- status="danger"- size="xsmall"- aria-label={`Delete translation for ${getLanguageLabel(lang)}`}- title={`Delete translation for ${getLanguageLabel(lang)}`}- onClick={(e) => {- e.stopPropagation()- LemonDialog.open({- title: 'Delete translation',- description: (- <p className="py-2">- Are you sure you want to delete the translation for{' '}- <strong>{getLanguageLabel(lang)}</strong>? All translated content for this- language will be permanently lost.- </p>- ),- primaryButton: {- children: 'Delete',- status: 'danger',- onClick: () => removeLanguage(lang),- },- secondaryButton: {- children: 'Cancel',- },- })+ <div className="flex flex-col gap-2">+ <h4 className="m-0 text-sm font-semibold uppercase tracking-wide text-muted">Translations</h4>+ <div className="flex gap-2">+ <div className="grow flex flex-col gap-1">+ <LemonInputSelect+ mode="single"+ options={pickerOptions}+ onChange={(values) => {+ const lang = values[0]+ if (lang) {+ addLanguage(lang)+ }}}+ placeholder="Add a translation (e.g. 'fr', 'French', 'fr-CA')"+ allowCustomValues+ autoFocus={validKeys.length === 0}+ value={[]}+ data-attr="survey-translation-add"/>+ {pickerError && (+ <span role="alert" className="text-danger text-xs">+ {pickerError}+ </span>+ )}</div>- ))}+ <LemonButton+ type="secondary"+ icon={<IconSparkles />}+ loading={generatingTranslationDrafts}+ disabledReason={+ !editingLanguage+ ? 'Add or select a language before generating translations'+ : survey.id === 'new'+ ? 'Save the survey before generating translations'+ : !dataProcessingAccepted+ ? 'AI data processing must be approved to generate translations'+ : undefined+ }+ onClick={() => editingLanguage && generateTranslationDrafts(editingLanguage)}+ >+ Translate with AI+ </LemonButton>+ </div>++ <div className="flex flex-wrap gap-2">+ <LemonButton+ size="small"+ type={editingLanguage === null ? 'primary' : 'secondary'}+ onClick={() => selectLanguage(null)}+ >+ {getSurveyLanguageName(baseLanguage)} <span className="text-muted ml-1">(original)</span>+ </LemonButton>++ {validKeys.map((lang) => {+ const aiDraft = aiGeneratedTranslationFields.some((path) => path.includes(`.${lang}.`))+ return (+ <LemonButton+ key={lang}+ size="small"+ type={editingLanguage === lang ? 'primary' : 'secondary'}+ onClick={() => selectLanguage(lang)}+ sideIcon={+ <LemonButton+ icon={<IconTrash />}+ status="danger"+ size="xsmall"+ aria-label={`Delete translation for ${getLanguageLabel(lang)}`}+ title={`Delete translation for ${getLanguageLabel(lang)}`}+ onClick={(e) => {+ e.stopPropagation()+ LemonDialog.open({+ title: 'Delete translation',+ description: (+ <p className="py-2">+ Delete the translation for{' '}+ <strong>{getLanguageLabel(lang)}</strong>? All translated+ content for this language will be permanently lost.+ </p>+ ),+ primaryButton: {+ children: 'Delete',+ status: 'danger',+ onClick: () => removeLanguage(lang),+ },+ secondaryButton: { children: 'Cancel' },+ })+ }}+ />+ }+ >+ <span className="flex items-center gap-2">+ {getLanguageLabel(lang)}+ {aiDraft && (+ <LemonTag type="highlight" size="small">+ AI draft+ </LemonTag>+ )}+ </span>+ </LemonButton>+ )+ })}+ </div>++ <LegacyTranslationKeysPanel languages={invalidKeys} onRemove={removeLanguage} /></div>++ {baseLanguage !== DEFAULT_SURVEY_BASE_LANGUAGE && (+ <p className="text-xs text-muted m-0">+ The SDK shows the original text whenever a user's locale doesn't have a translation.+ </p>+ )}</div>)}diff --git a/frontend/src/scenes/surveys/components/question-branching/QuestionBranchingInput.tsx b/frontend/src/scenes/surveys/components/question-branching/QuestionBranchingInput.tsxindex a29d6d5b4b44..97659746adb7 100644--- a/frontend/src/scenes/surveys/components/question-branching/QuestionBranchingInput.tsx+++ b/frontend/src/scenes/surveys/components/question-branching/QuestionBranchingInput.tsx@@ -128,7 +128,7 @@ export function QuestionBranchingInput({options={dropdownOptions}disabled={!!editingLanguage}disabledReason={- editingLanguage ? 'Question branching can only be edited in the default language' : undefined+ editingLanguage ? 'Question branching can only be edited in the original language' : undefined}/></LemonField>diff --git a/frontend/src/scenes/surveys/constants.tsx b/frontend/src/scenes/surveys/constants.tsxindex 7af2287e9c76..df72968e067c 100644--- a/frontend/src/scenes/surveys/constants.tsx+++ b/frontend/src/scenes/surveys/constants.tsx@@ -201,6 +201,7 @@ export interface NewSurvey extends Pick<| 'headline_response_count'| 'form_content'| 'translations'+ | 'base_language'> {id: 'new'linked_flag_id: number | null@@ -237,6 +238,7 @@ export const NEW_SURVEY: NewSurvey = {enable_partial_responses: true,user_access_level: AccessControlLevel.Editor,form_content: null,+ base_language: 'en',}export enum SurveyTemplateType {diff --git a/frontend/src/scenes/surveys/language.tsx b/frontend/src/scenes/surveys/language.tsxnew file mode 100644index 000000000000..1f0b5d9a844e--- /dev/null+++ b/frontend/src/scenes/surveys/language.tsx@@ -0,0 +1,159 @@+import { COUNTRY_CODE_TO_LONG_NAME, LANGUAGE_CODE_TO_NAME } from 'lib/utils/geography/country'++import { Survey } from '~/types'++export const DEFAULT_SURVEY_BASE_LANGUAGE = 'en'++// Lightweight frontend shape check for BCP-47 codes — inline UX only.+// The backend is the source of truth and will return a clear error if its rules diverge.+const BCP47_LANGUAGE_CODE_RE = /^[a-z]{2,3}(-[a-z0-9]{2,8}){0,3}$/++export const COMMON_SURVEY_LANGUAGE_CODES = [+ 'en',+ 'en-US',+ 'en-GB',+ 'es',+ 'es-ES',+ 'es-MX',+ 'fr',+ 'fr-FR',+ 'fr-CA',+ 'de',+ 'de-DE',+ 'ar',+ 'bg',+ 'bn',+ 'ca',+ 'cs',+ 'da',+ 'el',+ 'et',+ 'fa',+ 'fi',+ 'he',+ 'hi',+ 'hr',+ 'hu',+ 'id',+ 'it',+ 'ja',+ 'ko',+ 'lt',+ 'lv',+ 'ms',+ 'nl',+ 'no',+ 'pl',+ 'pt',+ 'pt-BR',+ 'pt-PT',+ 'ro',+ 'ro-RO',+ 'ru',+ 'sk',+ 'sl',+ 'sr',+ 'sv',+ 'th',+ 'tr',+ 'uk',+ 'ur',+ 'vi',+ 'zh',+ 'zh-CN',+ 'zh-TW',+]++const REGION_DISPLAY_NAME_OVERRIDES: Record<string, string> = {+ CN: 'Simplified',+ GB: 'UK',+ TW: 'Traditional',+ US: 'US',+}++export function normalizeLanguageCode(raw: string): string {+ return raw.trim().toLowerCase().replace(/_/g, '-')+}++export function isValidLanguageCode(raw: string): boolean {+ if (!raw) {+ return false+ }+ return BCP47_LANGUAGE_CODE_RE.test(normalizeLanguageCode(raw))+}++export function getSurveyLanguageLabel(languageCode: string): string {+ const hyphenIndex = languageCode.indexOf('-')+ if (hyphenIndex === -1) {+ const languageName = LANGUAGE_CODE_TO_NAME[languageCode] ?? languageCode+ return `${languageName} (${languageCode})`+ }+ const baseLanguageCode = languageCode.substring(0, hyphenIndex)+ const regionCode = languageCode.substring(hyphenIndex + 1)++ const languageName = LANGUAGE_CODE_TO_NAME[baseLanguageCode] ?? baseLanguageCode++ if (!regionCode) {+ return `${languageName} (${languageCode})`+ }++ const normalizedRegionCode = regionCode.toUpperCase()+ const regionName =+ REGION_DISPLAY_NAME_OVERRIDES[normalizedRegionCode] ??+ COUNTRY_CODE_TO_LONG_NAME[normalizedRegionCode] ??+ regionCode++ return `${languageName} - ${regionName} (${languageCode})`+}++export function getSurveyLanguageName(languageCode: string): string {+ return getSurveyLanguageLabel(languageCode).replace(/\s*\([^)]*\)\s*$/, '')+}++export const COMMON_LANGUAGES = COMMON_SURVEY_LANGUAGE_CODES.map((languageCode) => ({+ value: languageCode,+ label: getSurveyLanguageLabel(languageCode),+}))++/**+ * Split a list of translation keys into ones the SDK can resolve and "legacy" entries+ * (non-canonical aliases, sentinels, or collisions with the survey's base language).+ */+export function classifyTranslationKeys(+ keys: string[],+ baseLanguage: string+): { validKeys: string[]; invalidKeys: string[] } {+ const validKeys: string[] = []+ const invalidKeys: string[] = []+ const normalizedBase = normalizeLanguageCode(baseLanguage)+ for (const key of keys) {+ const normalized = normalizeLanguageCode(key)+ if (!isValidLanguageCode(key) || normalized === normalizedBase) {+ invalidKeys.push(key)+ } else {+ validKeys.push(key)+ }+ }+ return { validKeys, invalidKeys }+}++export function getBaseLanguage(survey: Pick<Survey, 'base_language'> | null | undefined): string {+ const raw = survey?.base_language+ if (typeof raw === 'string' && raw.trim()) {+ return normalizeLanguageCode(raw)+ }+ return DEFAULT_SURVEY_BASE_LANGUAGE+}++export function describeInvalidLanguageCode(raw: string, baseLanguage: string): string | null {+ if (!raw || !raw.trim()) {+ return 'Pick a language to add.'+ }+ if (!isValidLanguageCode(raw)) {+ return `"${raw}" isn't a valid language code. Use codes like "en", "es", or "es-MX".`+ }+ if (normalizeLanguageCode(raw) === normalizeLanguageCode(baseLanguage)) {+ return `"${raw}" matches the survey's original language. Change the original first, or translate to a different language.`+ }+ return null+}diff --git a/frontend/src/scenes/surveys/questionTypeGuards.ts b/frontend/src/scenes/surveys/questionTypeGuards.tsnew file mode 100644index 000000000000..405854d54a42--- /dev/null+++ b/frontend/src/scenes/surveys/questionTypeGuards.ts@@ -0,0 +1,19 @@+import {+ LinkSurveyQuestion,+ MultipleSurveyQuestion,+ RatingSurveyQuestion,+ SurveyQuestion,+ SurveyQuestionType,+} from '~/types'++export function isChoiceQuestion(question: SurveyQuestion): question is MultipleSurveyQuestion {+ return question.type === SurveyQuestionType.SingleChoice || question.type === SurveyQuestionType.MultipleChoice+}++export function isRatingQuestion(question: SurveyQuestion): question is RatingSurveyQuestion {+ return question.type === SurveyQuestionType.Rating+}++export function isLinkQuestion(question: SurveyQuestion): question is LinkSurveyQuestion {+ return question.type === SurveyQuestionType.Link+}diff --git a/frontend/src/scenes/surveys/useSurveyTranslationsForm.ts b/frontend/src/scenes/surveys/useSurveyTranslationsForm.tsnew file mode 100644index 000000000000..16327a25e0bc--- /dev/null+++ b/frontend/src/scenes/surveys/useSurveyTranslationsForm.ts@@ -0,0 +1,158 @@+import { useActions, useValues } from 'kea'+import { useMemo, useState } from 'react'++import {+ COMMON_LANGUAGES,+ classifyTranslationKeys,+ describeInvalidLanguageCode,+ getBaseLanguage,+ normalizeLanguageCode,+} from './language'+import { isChoiceQuestion, isLinkQuestion, isRatingQuestion } from './questionTypeGuards'+import { surveyLogic } from './surveyLogic'++interface UseSurveyTranslationsFormArgs {+ editingLanguage: string | null+ setEditingLanguage: (language: string | null) => void+}++interface PickerOption {+ key: string+ label: string+}++interface UseSurveyTranslationsFormReturn {+ baseLanguage: string+ addedLanguages: string[]+ validKeys: string[]+ invalidKeys: string[]+ pickerOptions: PickerOption[]+ pickerError: string | null+ setPickerError: (error: string | null) => void+ setBaseLanguage: (next: string) => void+ addLanguage: (rawLanguage: string) => void+ removeLanguage: (language: string) => void+}++export function useSurveyTranslationsForm({+ editingLanguage,+ setEditingLanguage,+}: UseSurveyTranslationsFormArgs): UseSurveyTranslationsFormReturn {+ const { survey } = useValues(surveyLogic)+ const { setSurveyValue } = useActions(surveyLogic)++ const baseLanguage = getBaseLanguage(survey)+ const surveyTranslations = survey.translations ?? {}+ const addedLanguages = Object.keys(surveyTranslations)+ const [pickerError, setPickerError] = useState<string | null>(null)++ const { invalidKeys, validKeys } = useMemo(+ () => classifyTranslationKeys(addedLanguages, baseLanguage),+ [addedLanguages, baseLanguage]+ )++ const normalizedBase = useMemo(() => normalizeLanguageCode(baseLanguage), [baseLanguage])+ const normalizedAdded = useMemo(() => new Set(addedLanguages.map(normalizeLanguageCode)), [addedLanguages])++ const pickerOptions = useMemo<PickerOption[]>(+ () =>+ COMMON_LANGUAGES.filter((language) => {+ const normalized = normalizeLanguageCode(language.value)+ return normalized !== normalizedBase && !normalizedAdded.has(normalized)+ }).map((language) => ({ key: language.value, label: language.label })),+ [normalizedBase, normalizedAdded]+ )++ const setBaseLanguage = (next: string): void => {+ setSurveyValue('base_language', next)+ if (editingLanguage && normalizeLanguageCode(editingLanguage) === next) {+ setEditingLanguage(null)+ }+ }++ const addLanguage = (rawLanguage: string): void => {+ const error = describeInvalidLanguageCode(rawLanguage, baseLanguage)+ if (error) {+ setPickerError(error)+ return+ }+ const language = normalizeLanguageCode(rawLanguage)+ setPickerError(null)+ if (normalizedAdded.has(language)) {+ return+ }++ const updatedQuestions = survey.questions.map((question) => {+ const questionTranslations = question.translations ?? {}+ const newTranslation = {+ question: question.question || '',+ description: question.description || '',+ buttonText: question.buttonText || '',+ ...(isRatingQuestion(question)+ ? {+ lowerBoundLabel: question.lowerBoundLabel || '',+ upperBoundLabel: question.upperBoundLabel || '',+ }+ : {}),+ ...(isChoiceQuestion(question) ? { choices: question.choices || [] } : {}),+ ...(isLinkQuestion(question) ? { link: question.link || '' } : {}),+ }++ return {+ ...question,+ translations: {+ ...questionTranslations,+ [language]: {+ ...questionTranslations[language],+ ...newTranslation,+ },+ },+ }+ })++ setSurveyValue('questions', updatedQuestions)+ setSurveyValue('translations', {+ ...surveyTranslations,+ [language]: {+ name: survey.name || '',+ thankYouMessageHeader: survey.appearance?.thankYouMessageHeader || '',+ thankYouMessageDescription: survey.appearance?.thankYouMessageDescription || '',+ thankYouMessageCloseButtonText: survey.appearance?.thankYouMessageCloseButtonText || '',+ },+ })+ setEditingLanguage(language)+ }++ const removeLanguage = (language: string): void => {+ const nextTranslations = { ...surveyTranslations }+ delete nextTranslations[language]+ setSurveyValue('translations', nextTranslations)++ const updatedQuestions = survey.questions.map((question) => {+ if (!question.translations?.[language]) {+ return question+ }+ const nextQuestionTranslations = { ...question.translations }+ delete nextQuestionTranslations[language]+ return { ...question, translations: nextQuestionTranslations }+ })+ setSurveyValue('questions', updatedQuestions)++ if (editingLanguage === language) {+ setEditingLanguage(null)+ }+ }++ return {+ baseLanguage,+ addedLanguages,+ validKeys,+ invalidKeys,+ pickerOptions,+ pickerError,+ setPickerError,+ setBaseLanguage,+ addLanguage,+ removeLanguage,+ }+}diff --git a/frontend/src/scenes/surveys/wizard/SurveyWizard.test.tsx b/frontend/src/scenes/surveys/wizard/SurveyWizard.test.tsxindex 0c808a5f94ac..a81532c968ca 100644--- a/frontend/src/scenes/surveys/wizard/SurveyWizard.test.tsx+++ b/frontend/src/scenes/surveys/wizard/SurveyWizard.test.tsx@@ -93,6 +93,6 @@ describe('SurveyWizard', () => {render(<SurveyWizardComponent id="test-survey" />)expect(await screen.findByText('Translations')).toBeInTheDocument()- expect(screen.getByPlaceholderText('Add a language')).toBeInTheDocument()+ expect(screen.getByPlaceholderText('Add a translation')).toBeInTheDocument()})})diff --git a/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsx b/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsxindex c2791b68916c..2398cfd86eb7 100644--- a/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsx+++ b/frontend/src/scenes/surveys/wizard/steps/TranslationsSection.tsx@@ -5,35 +5,24 @@ import { LemonButton, LemonDialog, LemonInput, LemonInputSelect, LemonTag, Lemonimport { LemonField } from 'lib/lemon-ui/LemonField'-import {- LinkSurveyQuestion,- MultipleSurveyQuestion,- RatingSurveyQuestion,- SurveyQuestion,- SurveyQuestionType,-} from '~/types'+import { SurveyQuestion } from '~/types'+import { BaseLanguagePicker } from '../../BaseLanguagePicker'import { defaultSurveyAppearance } from '../../constants'+import { COMMON_LANGUAGES, getSurveyLanguageLabel, getSurveyLanguageName } from '../../language'+import { LegacyTranslationKeysPanel } from '../../LegacyTranslationKeysPanel'+import { isChoiceQuestion, isLinkQuestion, isRatingQuestion } from '../../questionTypeGuards'import { surveyLogic } from '../../surveyLogic'-import { COMMON_LANGUAGES } from '../../SurveyTranslations'+import { useSurveyTranslationsForm } from '../../useSurveyTranslationsForm'import { WizardPanel, WizardSection } from '../WizardLayout'type QuestionTranslation = NonNullable<SurveyQuestion['translations']>[string]function getLanguageLabel(language: string): string {- return COMMON_LANGUAGES.find((commonLanguage) => commonLanguage.value === language)?.label || language-}--function isChoiceQuestion(question: SurveyQuestion): question is MultipleSurveyQuestion {- return question.type === SurveyQuestionType.SingleChoice || question.type === SurveyQuestionType.MultipleChoice-}--function isRatingQuestion(question: SurveyQuestion): question is RatingSurveyQuestion {- return question.type === SurveyQuestionType.Rating-}--function isLinkQuestion(question: SurveyQuestion): question is LinkSurveyQuestion {- return question.type === SurveyQuestionType.Link+ return (+ COMMON_LANGUAGES.find((commonLanguage) => commonLanguage.value === language)?.label ||+ getSurveyLanguageLabel(language)+ )}function GuidedTranslationInput({@@ -96,80 +85,22 @@ export function TranslationsSection({ editingLanguage, setEditingLanguage }: TrauseValues(surveyLogic)const { setSurveyValue, generateTranslationDrafts, clearAiGeneratedTranslationField } = useActions(surveyLogic)+ const {+ baseLanguage,+ addedLanguages,+ validKeys,+ invalidKeys,+ pickerOptions,+ pickerError,+ setBaseLanguage,+ addLanguage,+ removeLanguage,+ } = useSurveyTranslationsForm({ editingLanguage, setEditingLanguage })+const translations = survey.translations ?? {}- const addedLanguages = Object.keys(translations)const activeLanguage = editingLanguage && translations[editingLanguage] ? editingLanguage : nullconst appearance = { ...defaultSurveyAppearance, ...survey.appearance }- const addLanguage = (language: string): void => {- if (!language || translations[language]) {- return- }-- setSurveyValue('translations', {- ...translations,- [language]: {- thankYouMessageHeader: appearance.thankYouMessageHeader || '',- thankYouMessageDescription: appearance.thankYouMessageDescription || '',- thankYouMessageCloseButtonText: appearance.thankYouMessageCloseButtonText || '',- },- })- setSurveyValue(- 'questions',- survey.questions.map((question) => {- const questionTranslations = question.translations ?? {}-- return {- ...question,- translations: {- ...questionTranslations,- [language]: {- question: question.question || '',- description: question.description || '',- buttonText: question.buttonText || '',- ...(isChoiceQuestion(question) ? { choices: question.choices || [] } : {}),- ...(isRatingQuestion(question)- ? {- lowerBoundLabel: question.lowerBoundLabel || '',- upperBoundLabel: question.upperBoundLabel || '',- }- : {}),- ...(isLinkQuestion(question) ? { link: question.link || '' } : {}),- },- },- }- })- )- setEditingLanguage(language)- }-- const removeLanguage = (language: string): void => {- const nextTranslations = { ...translations }- delete nextTranslations[language]-- setSurveyValue('translations', nextTranslations)- setSurveyValue(- 'questions',- survey.questions.map((question) => {- if (!question.translations?.[language]) {- return question- }-- const nextQuestionTranslations = { ...question.translations }- delete nextQuestionTranslations[language]-- return {- ...question,- translations: nextQuestionTranslations,- }- })- )-- if (editingLanguage === language) {- setEditingLanguage(null)- }- }-const updateSurveyTranslation = (updates: Partial<NonNullable<(typeof survey)['translations']>[string]>): void => {if (!activeLanguage) {return@@ -251,72 +182,64 @@ export function TranslationsSection({ editingLanguage, setEditingLanguage }: Tra!!activeLanguage && aiGeneratedTranslationFields.some((path) => path.includes(`.${activeLanguage}.`))return (- <WizardSection- title="Translations"- description="Translate the respondent-facing copy. Targeting, scheduling, and branching stay shared across languages."- descriptionClassName="text-sm"- >+ <WizardSection title="Translations"><WizardPanel className="space-y-4">- <div className="flex gap-2">+ <div className="flex flex-wrap items-baseline gap-x-3 gap-y-1">+ <h4 className="m-0 text-sm font-semibold uppercase tracking-wide text-muted">Original language</h4>+ <span className="text-sm">+ Survey is written in <strong>{getSurveyLanguageName(baseLanguage)}</strong>{' '}+ <span className="text-muted">({baseLanguage})</span>+ </span>+ <BaseLanguagePicker+ baseLanguage={baseLanguage}+ onChange={setBaseLanguage}+ translatedLanguages={addedLanguages}+ />+ </div>++ <div className="flex flex-col gap-1"><LemonInputSelectmode="single"- options={COMMON_LANGUAGES.filter((language) => !addedLanguages.includes(language.value)).map(- (language) => ({- key: language.value,- label: language.label,- })- )}+ options={pickerOptions}onChange={(values) => {const language = values[0]if (language) {addLanguage(language)}}}- placeholder="Add a language"+ placeholder="Add a translation"allowCustomValuesvalue={[]}- className="grow"+ data-attr="survey-translation-add"/>+ {pickerError && (+ <span role="alert" className="text-danger text-xs">+ {pickerError}+ </span>+ )}+ </div>++ <div className="flex flex-wrap gap-2"><LemonButton- type="secondary"- icon={<IconSparkles />}- loading={generatingTranslationDrafts}- disabledReason={- !activeLanguage- ? 'Add or select a language before generating translations'- : survey.id === 'new'- ? 'Save the survey before generating translations'- : !dataProcessingAccepted- ? 'AI data processing must be approved to generate translations'- : undefined- }- onClick={() => activeLanguage && generateTranslationDrafts(activeLanguage)}+ size="small"+ type={activeLanguage === null ? 'primary' : 'secondary'}+ onClick={() => setEditingLanguage(null)}>- Fill with AI+ {getSurveyLanguageName(baseLanguage)} (original)</LemonButton>- </div>-- {addedLanguages.length > 0 ? (- <div className="flex flex-wrap gap-2">+ {validKeys.map((language) => (<LemonButton+ key={language}size="small"- type={activeLanguage === null ? 'primary' : 'secondary'}- onClick={() => setEditingLanguage(null)}+ type={activeLanguage === language ? 'primary' : 'secondary'}+ onClick={() => setEditingLanguage(language)}>- Original+ {getLanguageLabel(language)}</LemonButton>- {addedLanguages.map((language) => (- <LemonButton- key={language}- size="small"- type={activeLanguage === language ? 'primary' : 'secondary'}- onClick={() => setEditingLanguage(language)}- >- {getLanguageLabel(language)}- </LemonButton>- ))}- </div>- ) : null}+ ))}+ </div>++ <LegacyTranslationKeysPanel languages={invalidKeys} onRemove={removeLanguage} />{activeLanguage ? (<div className="space-y-4 border-t border-border pt-4">@@ -325,56 +248,73 @@ export function TranslationsSection({ editingLanguage, setEditingLanguage }: Tra<h3 className="m-0 text-sm font-semibold">{getLanguageLabel(activeLanguage)}</h3><p className="m-0 text-xs text-secondary">The preview uses this language.</p></div>- <LemonButton- icon={<IconTrash />}- type="tertiary"- status="danger"- size="small"- onClick={() => {- LemonDialog.open({- title: 'Delete translation',- description: (- <p className="py-2">- Delete the translation for{' '}- <strong>{getLanguageLabel(activeLanguage)}</strong>?- </p>- ),- primaryButton: {- children: 'Delete',- status: 'danger',- onClick: () => removeLanguage(activeLanguage),- },- secondaryButton: {- children: 'Cancel',- },- })- }}- >- Delete- </LemonButton>+ <div className="flex items-center gap-2">+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconSparkles />}+ loading={generatingTranslationDrafts}+ disabledReason={+ survey.id === 'new'+ ? 'Save the survey before generating translations'+ : !dataProcessingAccepted+ ? 'AI data processing must be approved to generate translations'+ : undefined+ }+ onClick={() => generateTranslationDrafts(activeLanguage)}+ >+ Translate with AI+ </LemonButton>+ <LemonButton+ icon={<IconTrash />}+ type="tertiary"+ status="danger"+ size="small"+ onClick={() => {+ LemonDialog.open({+ title: 'Delete translation',+ description: (+ <p className="py-2">+ Delete the translation for{' '}+ <strong>{getLanguageLabel(activeLanguage)}</strong>?+ </p>+ ),+ primaryButton: {+ children: 'Delete',+ status: 'danger',+ onClick: () => removeLanguage(activeLanguage),+ },+ secondaryButton: {+ children: 'Cancel',+ },+ })+ }}+ >+ Delete+ </LemonButton>+ </div></div>{hasGeneratedFieldsForActiveLanguage ? (- <div className="flex items-center gap-2 rounded border border-dashed border-accent bg-accent-highlight-secondary p-2 text-xs text-secondary">- <LemonTag type="highlight">AI draft</LemonTag>- <span>AI-generated fields are highlighted. Double-check them before saving.</span>- </div>+ <p className="m-0 text-xs text-muted">+ <LemonTag type="highlight" size="small">+ AI draft+ </LemonTag>{' '}+ Highlighted fields are AI-generated — double-check them.+ </p>) : null}- <div className="space-y-3">+ <div className="space-y-6">{survey.questions.map((question, questionIndex) => {const questionTranslation = question.translations?.[activeLanguage] ?? {}const ratingQuestion = isRatingQuestion(question) ? question : nullconst linkQuestion = isLinkQuestion(question) ? question : nullreturn (- <div- key={questionIndex}- className="space-y-3 rounded-lg border border-border bg-bg-light p-3"- >- <div className="text-xs font-semibold text-secondary">+ <section key={questionIndex} className="space-y-3">+ <h4 className="m-0 text-xs font-semibold uppercase tracking-wide text-muted">Question {questionIndex + 1}- </div>+ </h4><GuidedTranslationInputlabel="Question"value={questionTranslation.question || ''}@@ -460,48 +400,50 @@ export function TranslationsSection({ editingLanguage, setEditingLanguage }: TraonChange={(link) => updateQuestionTranslation(questionIndex, { link })}/>) : null}- </div>+ </section>)})}- </div>- {appearance.displayThankYouMessage ? (- <div className="space-y-3 rounded-lg border border-border bg-bg-light p-3">- <div className="text-xs font-semibold text-secondary">Confirmation screen</div>- <GuidedTranslationInput- label="Header"- value={translations[activeLanguage]?.thankYouMessageHeader || ''}- source={appearance.thankYouMessageHeader}- aiGenerated={isGeneratedSurveyField('thankYouMessageHeader')}- onChange={(thankYouMessageHeader) =>- updateSurveyTranslation({ thankYouMessageHeader })- }- />- {appearance.thankYouMessageDescription ? (- <GuidedTranslationInput- label="Description"- value={translations[activeLanguage]?.thankYouMessageDescription || ''}- source={appearance.thankYouMessageDescription}- aiGenerated={isGeneratedSurveyField('thankYouMessageDescription')}- onChange={(thankYouMessageDescription) =>- updateSurveyTranslation({ thankYouMessageDescription })- }- multiline- />- ) : null}- {appearance.thankYouMessageCloseButtonText ? (+ {appearance.displayThankYouMessage ? (+ <section className="space-y-3">+ <h4 className="m-0 text-xs font-semibold uppercase tracking-wide text-muted">+ Confirmation screen+ </h4><GuidedTranslationInput- label="Close button"- value={translations[activeLanguage]?.thankYouMessageCloseButtonText || ''}- source={appearance.thankYouMessageCloseButtonText}- aiGenerated={isGeneratedSurveyField('thankYouMessageCloseButtonText')}- onChange={(thankYouMessageCloseButtonText) =>- updateSurveyTranslation({ thankYouMessageCloseButtonText })+ label="Header"+ value={translations[activeLanguage]?.thankYouMessageHeader || ''}+ source={appearance.thankYouMessageHeader}+ aiGenerated={isGeneratedSurveyField('thankYouMessageHeader')}+ onChange={(thankYouMessageHeader) =>+ updateSurveyTranslation({ thankYouMessageHeader })}/>- ) : null}- </div>- ) : null}+ {appearance.thankYouMessageDescription ? (+ <GuidedTranslationInput+ label="Description"+ value={translations[activeLanguage]?.thankYouMessageDescription || ''}+ source={appearance.thankYouMessageDescription}+ aiGenerated={isGeneratedSurveyField('thankYouMessageDescription')}+ onChange={(thankYouMessageDescription) =>+ updateSurveyTranslation({ thankYouMessageDescription })+ }+ multiline+ />+ ) : null}+ {appearance.thankYouMessageCloseButtonText ? (+ <GuidedTranslationInput+ label="Close button"+ value={translations[activeLanguage]?.thankYouMessageCloseButtonText || ''}+ source={appearance.thankYouMessageCloseButtonText}+ aiGenerated={isGeneratedSurveyField('thankYouMessageCloseButtonText')}+ onChange={(thankYouMessageCloseButtonText) =>+ updateSurveyTranslation({ thankYouMessageCloseButtonText })+ }+ />+ ) : null}+ </section>+ ) : null}+ </div></div>) : null}</WizardPanel>diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex decd38b98673..4a3dba218400 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -3829,6 +3829,7 @@ export interface Survey extends WithAccessControl {headline_summary?: string | nullheadline_response_count?: number | nullform_content?: Record<string, unknown> | null+ base_language?: string | nulltranslations?: Record<string,{diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambrindex a881a8d12365..d3c4bbdf3567 100644--- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr+++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr@@ -3053,6 +3053,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."internal_response_sampling_flag_id" = 99999@@ -3097,6 +3098,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."internal_response_sampling_flag_id" = 99999@@ -3215,6 +3217,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."linked_flag_id" = 99999diff --git a/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr b/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambrindex 62cd139b021b..71303b4b79e8 100644--- a/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr+++ b/posthog/models/resource_transfer/test/__snapshots__/test_visitor_field_snapshots.ambr@@ -270,6 +270,7 @@list(['appearance','archived',+ 'base_language','conditions','created_at','current_iteration',diff --git a/posthog/models/test/test_remote_config.py b/posthog/models/test/test_remote_config.pyindex 6f5cf01b9209..a772634d94ff 100644--- a/posthog/models/test/test_remote_config.py+++ b/posthog/models/test/test_remote_config.py@@ -351,6 +351,7 @@ class TestRemoteConfigSurveys(_RemoteConfigBase):"current_iteration_start_date": None,"schedule": "once","enable_partial_responses": False,+ "base_language": "en",},{"id": str(survey_with_flags.id),@@ -378,6 +379,7 @@ class TestRemoteConfigSurveys(_RemoteConfigBase):"current_iteration_start_date": None,"schedule": "once","enable_partial_responses": False,+ "base_language": "en",},{"id": str(survey_with_actions.id),@@ -426,6 +428,7 @@ class TestRemoteConfigSurveys(_RemoteConfigBase):"current_iteration_start_date": None,"schedule": "once","enable_partial_responses": False,+ "base_language": "en",},],key=lambda s: str(s["id"]), # type: ignorediff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambrindex 0639a6634407..9f837b9441fe 100644--- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr+++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr@@ -208,6 +208,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."internal_response_sampling_flag_id" = 99999@@ -252,6 +253,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."internal_response_sampling_flag_id" = 99999@@ -923,6 +925,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."internal_response_sampling_flag_id" = 99999@@ -967,6 +970,7 @@"posthog_survey"."headline_response_count","posthog_survey"."question_summaries","posthog_survey"."form_content",+ "posthog_survey"."base_language","posthog_survey"."translations"FROM "posthog_survey"WHERE "posthog_survey"."internal_response_sampling_flag_id" = 99999diff --git a/products/surveys/backend/api/survey.py b/products/surveys/backend/api/survey.pyindex 3d2afe9b70d2..92bb14a5f389 100644--- a/products/surveys/backend/api/survey.py+++ b/products/surveys/backend/api/survey.py@@ -99,6 +99,22 @@ DISPLAY_LANGUAGE_RE = re.compile(r"^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8}){0,3}$")ALLOWED_LINK_URL_SCHEMES = ["https", "mailto"]EMAIL_REGEX = r"^mailto:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"++# Translation language codes must be BCP-47-ish (lang[-subtag...]). This is the same shape+# the JS SDK matches against navigator.language. Aliases like "english" or sentinel values+# like "default" are rejected because they never match a real browser locale.+BCP47_LANGUAGE_CODE_RE = re.compile(r"^[a-z]{2,3}(-[a-z0-9]{2,8}){0,3}$")+DEFAULT_BASE_LANGUAGE = "en"+# Sentinel keys we explicitly reject — these used to appear in customer data and never+# resolved to anything in the SDK. Block them at the API so they don't keep accumulating.+REJECTED_TRANSLATION_KEYS = frozenset({"default", "original", "base"})+++def _normalize_language_code(raw: str) -> str:+ """Lowercase + underscore-to-hyphen. Matches what the SDK does before lookup."""+ return raw.strip().lower().replace("_", "-")++# Keep this in sync with SurveyAPISerializer's public runtime contract.# Root survey description is intentionally excluded because customers have used it for internal notes.SURVEY_API_TRANSLATION_FIELDS = frozenset(@@ -136,7 +152,12 @@ SURVEY_TRANSLATION_DRAFT_QUESTION_FIELDS = (class GenerateSurveyTranslationsRequestSerializer(serializers.Serializer):target_language = serializers.CharField(help_text="Language code to generate translations for, for example pt-BR.")source_language = serializers.CharField(- required=False, default="en", help_text="Source language code for the existing survey copy."+ required=False,+ allow_blank=True,+ help_text=(+ "Optional override for the source language code. Defaults to the survey's `base_language` "+ "(or 'en' if unset)."+ ),)overwrite = serializers.BooleanField(required=False, default=False, help_text="Whether to overwrite existing translations for this language."@@ -597,6 +618,15 @@ class SurveySerializer(UserAccessControlSerializerMixin, serializers.ModelSerialschedule = serializers.CharField(required=False, allow_null=True)enable_partial_responses = serializers.BooleanField(required=False, allow_null=True)enable_iframe_embedding = serializers.BooleanField(required=False, allow_null=True)+ base_language = serializers.CharField(+ required=False,+ allow_blank=True,+ max_length=20,+ help_text=(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's "+ "untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),+ )@extend_schema_field(serializers.ListField(@@ -652,6 +682,7 @@ class SurveySerializer(UserAccessControlSerializerMixin, serializers.ModelSerial"response_sampling_daily_limits","enable_partial_responses","enable_iframe_embedding",+ "base_language","translations","user_access_level","form_content",@@ -722,6 +753,15 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):schedule = serializers.CharField(required=False, allow_null=True)enable_partial_responses = serializers.BooleanField(required=False, allow_null=True)enable_iframe_embedding = serializers.BooleanField(required=False, allow_null=True)+ base_language = serializers.CharField(+ required=False,+ allow_blank=True,+ max_length=20,+ help_text=(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's "+ "untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),+ )_create_in_folder = serializers.CharField(required=False, allow_blank=True, write_only=True)class Meta:@@ -761,6 +801,7 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):"response_sampling_daily_limits","enable_partial_responses","enable_iframe_embedding",+ "base_language","translations","_create_in_folder","form_content",@@ -822,22 +863,85 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):return value+ def _resolve_base_language(self) -> str:+ """Resolve the survey's base language from incoming data, falling back to the instance, then 'en'."""+ initial_data = getattr(self, "initial_data", None)+ if isinstance(initial_data, dict) and "base_language" in initial_data:+ candidate = initial_data.get("base_language")+ if isinstance(candidate, str) and candidate.strip():+ return _normalize_language_code(candidate)+ if self.instance is not None:+ instance_lang = getattr(self.instance, "base_language", None)+ if isinstance(instance_lang, str) and instance_lang.strip():+ return _normalize_language_code(instance_lang)+ return DEFAULT_BASE_LANGUAGE++ def _validate_translation_language_key(self, raw_key: Any, base_language: str, context: str) -> str:+ """Validate and normalize a single translation language key. Raises ValidationError on bad input."""+ if not isinstance(raw_key, str) or not raw_key.strip():+ raise serializers.ValidationError(f"{context}: translation language code cannot be empty.")+ normalized = _normalize_language_code(raw_key)+ if normalized in REJECTED_TRANSLATION_KEYS:+ raise serializers.ValidationError(+ f"{context}: '{raw_key}' is not a valid translation language. "+ "The untranslated text is the original — set the survey's base language instead of adding it as a translation."+ )+ if not BCP47_LANGUAGE_CODE_RE.match(normalized):+ raise serializers.ValidationError(+ f"{context}: '{raw_key}' is not a valid language code. "+ "Use BCP-47 codes like 'en', 'es', or 'es-MX' (not language names like 'english')."+ )+ if normalized == base_language:+ raise serializers.ValidationError(+ f"{context}: '{raw_key}' matches the survey's base language ('{base_language}'). "+ "The original text already covers this language — translate to a different language."+ )+ return normalized++ def validate_base_language(self, value: Any) -> str:+ """Ensure base_language is a canonical BCP-47-ish code."""+ if value is None or (isinstance(value, str) and not value.strip()):+ return DEFAULT_BASE_LANGUAGE+ if not isinstance(value, str):+ raise serializers.ValidationError("base_language must be a string.")+ normalized = _normalize_language_code(value)+ if normalized in REJECTED_TRANSLATION_KEYS:+ raise serializers.ValidationError(+ f"'{value}' is not a valid language code. Use a BCP-47 code like 'en' or 'es'."+ )+ if not BCP47_LANGUAGE_CODE_RE.match(normalized):+ raise serializers.ValidationError(+ f"'{value}' is not a valid language code. Use BCP-47 codes like 'en', 'es', or 'es-MX'."+ )+ return normalized+def validate_translations(self, value: Any) -> Optional[dict[str, dict[str, str]]]:- """Validate survey-level translations."""+ """Validate survey-level translations.++ Write-strict, read-tolerant: pre-existing entries with unchanged content+ are passed through even if their language code is no longer valid, so users+ can keep saving surveys with legacy keys without losing data. The UI+ surfaces those entries with a fix-or-remove prompt.+ """if value is None:return valueif not isinstance(value, dict):raise serializers.ValidationError("Translations must be an object")- cleaned_translations = {}- for lang_code, translation_data in value.items():- if not isinstance(translation_data, dict):- raise serializers.ValidationError(f"Translation for '{lang_code}' must be an object")+ base_language = self._resolve_base_language()+ existing_translations: dict[str, Any] = {}+ if self.instance is not None:+ instance_translations = getattr(self.instance, "translations", None)+ if isinstance(instance_translations, dict):+ existing_translations = instance_translations- cleaned_translation = {}+ cleaned_translations: dict[str, dict[str, str]] = {}+ for raw_lang_code, translation_data in value.items():+ if not isinstance(translation_data, dict):+ raise serializers.ValidationError(f"Translation for '{raw_lang_code}' must be an object")- # Validate and sanitize all translatable fields to prevent XSS+ cleaned_translation: dict[str, str] = {}for field in ["name","description",@@ -847,42 +951,73 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):]:if field in translation_data:if not isinstance(translation_data[field], str):- raise serializers.ValidationError(f"Translation for '{lang_code}': '{field}' must be a string")+ raise serializers.ValidationError(+ f"Translation for '{raw_lang_code}': '{field}' must be a string"+ )if nh3.is_html(translation_data[field]):cleaned_translation[field] = nh3_clean_with_allow_list(translation_data[field])else:cleaned_translation[field] = translation_data[field]- # Only store non-empty translations to avoid wasting storage- if cleaned_translation:- cleaned_translations[lang_code] = cleaned_translation+ if not cleaned_translation:+ continue++ # Grandfather pre-existing keys: surveys saved before this validation keep saving, even when+ # their content is edited. New bad keys are still rejected below. The dashboard surfaces+ # these under "Legacy translation keys" so owners can clean up at their pace.+ if raw_lang_code in existing_translations:+ cleaned_translations[raw_lang_code] = cleaned_translation+ continue++ normalized_key = self._validate_translation_language_key(+ raw_lang_code, base_language, context="Survey translation"+ )+ # Detect collisions across normalization (e.g., legacy "EN" + new "en" both targeting "en").+ if any(_normalize_language_code(existing_key) == normalized_key for existing_key in cleaned_translations):+ raise serializers.ValidationError(+ f"Survey translation: '{raw_lang_code}' collides with another translation for '{normalized_key}'."+ )+ cleaned_translations[normalized_key] = cleaned_translationreturn cleaned_translations- def _validate_question_translations(self, translations_dict: Any, question_index: int) -> dict[str, dict[str, Any]]:- """Validate and sanitize translations for a single question."""+ def _validate_question_translations(+ self,+ translations_dict: Any,+ question_index: int,+ base_language: Optional[str] = None,+ existing_question_translations: Optional[dict[str, Any]] = None,+ ) -> dict[str, dict[str, Any]]:+ """Validate and sanitize translations for a single question.++ Write-strict, read-tolerant: pre-existing entries with unchanged content+ are passed through even if their language code is no longer valid.+ """# Use question_index + 1 for user-facing error messagesquestion_num = question_index + 1if not isinstance(translations_dict, dict):raise serializers.ValidationError(f"Question {question_num}: translations must be an object")- cleaned_translations = {}+ resolved_base_language = base_language or self._resolve_base_language()+ existing = existing_question_translations if isinstance(existing_question_translations, dict) else {}++ cleaned_translations: dict[str, dict[str, Any]] = {}- for lang_code, translation_data in translations_dict.items():+ for raw_lang_code, translation_data in translations_dict.items():if not isinstance(translation_data, dict):raise serializers.ValidationError(- f"Question {question_num}: Translation for '{lang_code}' must be an object"+ f"Question {question_num}: Translation for '{raw_lang_code}' must be an object")- cleaned_translation = {}+ cleaned_translation: dict[str, Any] = {}# Validate and sanitize all translatable fieldsfor field in ["question", "description", "buttonText", "lowerBoundLabel", "upperBoundLabel"]:if field in translation_data:if not isinstance(translation_data[field], str):raise serializers.ValidationError(- f"Question {question_num}: Translation '{lang_code}' field '{field}' must be a string"+ f"Question {question_num}: Translation '{raw_lang_code}' field '{field}' must be a string")if nh3.is_html(translation_data[field]):cleaned_translation[field] = nh3_clean_with_allow_list(translation_data[field])@@ -893,7 +1028,7 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):if "link" in translation_data:if not isinstance(translation_data["link"], str):raise serializers.ValidationError(- f"Question {question_num}: Translation '{lang_code}' field 'link' must be a string"+ f"Question {question_num}: Translation '{raw_lang_code}' field 'link' must be a string")cleaned_translation["link"] = self._validate_and_sanitize_link(translation_data["link"])@@ -901,13 +1036,28 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):if "choices" in translation_data:if not isinstance(translation_data["choices"], list):raise serializers.ValidationError(- f"Question {question_num}: Translation '{lang_code}' field 'choices' must be a list of strings"+ f"Question {question_num}: Translation '{raw_lang_code}' field 'choices' must be a list of strings")cleaned_translation["choices"] = self._validate_and_sanitize_choices(translation_data["choices"])- # Only store non-empty translations to avoid wasting storage- if cleaned_translation:- cleaned_translations[lang_code] = cleaned_translation+ if not cleaned_translation:+ continue++ # Grandfather pre-existing keys so edits to legacy translations still save (see validate_translations).+ if raw_lang_code in existing:+ cleaned_translations[raw_lang_code] = cleaned_translation+ continue++ normalized_key = self._validate_translation_language_key(+ raw_lang_code, resolved_base_language, context=f"Question {question_num} translation"+ )+ # Detect collisions across normalization (e.g., legacy "EN" + new "en" both targeting "en").+ if any(_normalize_language_code(existing_key) == normalized_key for existing_key in cleaned_translations):+ raise serializers.ValidationError(+ f"Question {question_num} translation: '{raw_lang_code}' collides with another translation "+ f"for '{normalized_key}'."+ )+ cleaned_translations[normalized_key] = cleaned_translationreturn cleaned_translations@@ -918,6 +1068,13 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):if not isinstance(value, list):raise serializers.ValidationError("Questions must be a list of objects")+ base_language = self._resolve_base_language()+ existing_questions: list[dict[str, Any]] = []+ if self.instance is not None:+ existing_value = getattr(self.instance, "questions", None)+ if isinstance(existing_value, list):+ existing_questions = [q for q in existing_value if isinstance(q, dict)]+cleaned_questions = []for index, raw_question in enumerate(value):if not isinstance(raw_question, dict):@@ -976,7 +1133,17 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):# Validate and sanitize inline translationsif "translations" in raw_question:- cleaned_translations = self._validate_question_translations(raw_question["translations"], index)+ existing_question_translations: dict[str, Any] = {}+ if index < len(existing_questions):+ candidate = existing_questions[index].get("translations")+ if isinstance(candidate, dict):+ existing_question_translations = candidate+ cleaned_translations = self._validate_question_translations(+ raw_question["translations"],+ index,+ base_language=base_language,+ existing_question_translations=existing_question_translations,+ )# Validate choices array length matches if presentoriginal_choices = cleaned_question.get("choices")@@ -1210,6 +1377,25 @@ class SurveySerializerCreateUpdateOnly(serializers.ModelSerializer):if errors:raise serializers.ValidationError(errors)+ # Cross-field: base_language must not collide with any existing translation key.+ # validate_translations already covers the "translations in payload" case; this catches partial+ # updates where only base_language is sent (otherwise get_survey_api_translations would silently+ # drop the matching translation from the SDK payload, making it unreachable with no warning).+ incoming_base_language = data.get("base_language")+ if incoming_base_language and "translations" not in data and self.instance is not None:+ normalized_base = _normalize_language_code(incoming_base_language)+ instance_translations = getattr(self.instance, "translations", None) or {}+ for existing_key in instance_translations:+ if isinstance(existing_key, str) and _normalize_language_code(existing_key) == normalized_base:+ raise serializers.ValidationError(+ {+ "base_language": (+ f"'{incoming_base_language}' already exists as a translation key on this survey. "+ "Remove the translation first, or pick a different base language."+ )+ }+ )+return datadef create(self, validated_data):@@ -2728,6 +2914,7 @@ class SurveyViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, viewsets.serializer = GenerateSurveyTranslationsRequestSerializer(data=request.data)serializer.is_valid(raise_exception=True)data = serializer.validated_data+ saved_survey = self.get_object()survey = data.get("survey")if survey is None:survey = {@@ -2740,10 +2927,16 @@ class SurveyViewSet(TeamAndOrgViewSetMixin, AccessControlViewSetMixin, viewsets.}user = cast(User, request.user)+ source_language = (+ data.get("source_language")+ or getattr(saved_survey, "base_language", DEFAULT_BASE_LANGUAGE)+ or DEFAULT_BASE_LANGUAGE+ )+translations, questions, generated_field_paths, trace_id = generate_survey_translation(survey=survey,target_language=data["target_language"],- source_language=data["source_language"],+ source_language=source_language,overwrite=data["overwrite"],distinct_id=str(user.distinct_id),team_id=self.team.pk,@@ -2957,22 +3150,57 @@ class SurveyAPIActionSerializer(serializers.ModelSerializer):read_only_fields = fields-def get_survey_api_translations(translations: Any) -> dict[str, dict[str, str]] | None:+def _strip_invalid_translation_keys(translations: Any, normalized_base: str) -> dict[str, Any] | None:+ """Filter a translation map (survey-level or question-level) down to keys the SDK can match.++ Drops sentinels ('default', 'original', 'base'), non-BCP-47 shapes, and keys whose normalized+ form equals the survey's base language (since the SDK renders base text in that case).+ """+ if not isinstance(translations, dict):+ return None+ filtered: dict[str, Any] = {}+ for language, translation in translations.items():+ if not isinstance(language, str) or not isinstance(translation, dict):+ continue+ normalized = _normalize_language_code(language)+ if (+ normalized in REJECTED_TRANSLATION_KEYS+ or not BCP47_LANGUAGE_CODE_RE.match(normalized)+ or normalized == normalized_base+ ):+ continue+ filtered[normalized] = translation+ return filtered or None+++def get_survey_api_translations(+ translations: Any, base_language: str = DEFAULT_BASE_LANGUAGE+) -> dict[str, dict[str, str]] | None:if not isinstance(translations, dict):return None+ normalized_base = _normalize_language_code(base_language) if isinstance(base_language, str) else ""safe_translations: dict[str, dict[str, str]] = {}for language, translation in translations.items():if not isinstance(language, str) or not isinstance(translation, dict):continue+ # Drop entries the SDK can't match: invalid codes, sentinels like "default", or the base language itself.+ normalized = _normalize_language_code(language)+ if (+ normalized in REJECTED_TRANSLATION_KEYS+ or not BCP47_LANGUAGE_CODE_RE.match(normalized)+ or normalized == normalized_base+ ):+ continue+safe_translation = {field: valuefor field, value in translation.items()if field in SURVEY_API_TRANSLATION_FIELDS and isinstance(value, str)}if safe_translation:- safe_translations[language] = safe_translation+ safe_translations[normalized] = safe_translationreturn safe_translations or None@@ -2987,6 +3215,8 @@ class SurveyAPISerializer(serializers.ModelSerializer):internal_targeting_flag_key = serializers.CharField(source="internal_targeting_flag.key", read_only=True)conditions = serializers.SerializerMethodField(method_name="get_conditions")enable_partial_responses = serializers.BooleanField(read_only=True)+ base_language = serializers.CharField(read_only=True)+ questions = serializers.SerializerMethodField(method_name="get_questions")translations = serializers.SerializerMethodField(method_name="get_translations")class Meta:@@ -3012,6 +3242,7 @@ class SurveyAPISerializer(serializers.ModelSerializer):"current_iteration_start_date","schedule","enable_partial_responses",+ "base_language","translations",]read_only_fields = fields@@ -3024,7 +3255,36 @@ class SurveyAPISerializer(serializers.ModelSerializer):serializers.DictField(child=serializers.DictField(child=serializers.CharField()), allow_null=True))def get_translations(self, survey: Survey) -> dict[str, dict[str, str]] | None:- return get_survey_api_translations(survey.translations)+ return get_survey_api_translations(+ survey.translations, getattr(survey, "base_language", DEFAULT_BASE_LANGUAGE) or DEFAULT_BASE_LANGUAGE+ )++ @extend_schema_field(serializers.ListField(child=serializers.DictField(), allow_null=True))+ def get_questions(self, survey: Survey) -> list[dict[str, Any]] | None:+ """Return questions with question-level translation keys filtered to what the SDK can match."""+ questions = survey.questions+ if not isinstance(questions, list):+ return questions+ normalized_base = _normalize_language_code(+ getattr(survey, "base_language", DEFAULT_BASE_LANGUAGE) or DEFAULT_BASE_LANGUAGE+ )+ cleaned: list[dict[str, Any]] = []+ for question in questions:+ if not isinstance(question, dict):+ cleaned.append(question)+ continue+ inline_translations = question.get("translations")+ if not isinstance(inline_translations, dict):+ cleaned.append(question)+ continue+ filtered = _strip_invalid_translation_keys(inline_translations, normalized_base)+ next_question = dict(question)+ if filtered:+ next_question["translations"] = filtered+ else:+ next_question.pop("translations", None)+ cleaned.append(next_question)+ return cleaneddef to_representation(self, instance: Survey) -> dict[str, Any]:data = super().to_representation(instance)diff --git a/products/surveys/backend/api/test/test_survey.py b/products/surveys/backend/api/test/test_survey.pyindex 913601909944..4a910c4e82c9 100644--- a/products/surveys/backend/api/test/test_survey.py+++ b/products/surveys/backend/api/test/test_survey.py@@ -139,7 +139,8 @@ class TestSurvey(APIBaseTest):assert questions[0]["translations"]["fr"]["question"] == "Êtes-vous satisfait?"assert questions[1]["translations"]["es"]["choices"] == ["Analítica", "Feature Flags"]- def test_can_create_survey_with_custom_language_code_translations(self) -> None:+ def test_translation_language_codes_are_normalized(self) -> None:+ """BCP-47-ish codes are normalized to lowercase + hyphenated on save."""response = self.client.post(f"/api/projects/{self.team.id}/surveys/",data={@@ -152,25 +153,18 @@ class TestSurvey(APIBaseTest):"question": "How satisfied are you?","choices": ["Happy", "Unhappy"],"translations": {- "ro-RO": {+ "RO-ro": {"question": "Cat de multumit esti?","choices": ["Multumit", "Nemultumit"],},- "custom-customer-locale": {- "question": "Custom localized question",- "choices": ["Custom happy", "Custom unhappy"],- },},}],"translations": {- "ro-RO": {+ "Ro_RO": {"name": "Sondaj de feedback","thankYouMessageHeader": "Multumim!",},- "custom-customer-locale": {- "name": "Custom localized survey",- },},},format="json",@@ -181,13 +175,289 @@ class TestSurvey(APIBaseTest):questions = cast(list[dict[str, Any]], survey.questions)assert survey.translations is not None- assert survey.translations["ro-RO"]["name"] == "Sondaj de feedback"- assert survey.translations["custom-customer-locale"]["name"] == "Custom localized survey"- assert questions[0]["translations"]["ro-RO"]["question"] == "Cat de multumit esti?"- assert questions[0]["translations"]["custom-customer-locale"]["choices"] == [- "Custom happy",- "Custom unhappy",+ assert "ro-ro" in survey.translations+ assert survey.translations["ro-ro"]["name"] == "Sondaj de feedback"+ assert "ro-ro" in questions[0]["translations"]+ assert questions[0]["translations"]["ro-ro"]["question"] == "Cat de multumit esti?"++ @parameterized.expand(+ [+ ("default_sentinel", "default"),+ ("language_name_alias", "english"),+ ("empty_subtag", ""),+ ("includes_invalid_chars", "en US"),+ ("non_bcp47_word", "custom-customer-locale"),]+ )+ def test_translation_rejects_invalid_language_codes(self, _name: str, lang_code: str) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/",+ data={+ "name": "Survey",+ "type": "popover",+ "questions": [{"type": "open", "question": "Question?"}],+ "translations": {lang_code: {"name": "Translated"}},+ },+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ assert "translation" in response.json()["detail"].lower()++ def test_translation_rejects_base_language_collision(self) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/",+ data={+ "name": "Survey",+ "type": "popover",+ "base_language": "en",+ "questions": [{"type": "open", "question": "Question?"}],+ "translations": {"en": {"name": "Translated"}},+ },+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ assert "base language" in response.json()["detail"].lower()++ def test_translation_rejects_base_language_collision_in_question(self) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/",+ data={+ "name": "Survey",+ "type": "popover",+ "base_language": "es",+ "questions": [+ {+ "type": "open",+ "question": "¿Cómo estás?",+ "translations": {"ES": {"question": "Hola"}},+ }+ ],+ },+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ assert "base language" in response.json()["detail"].lower()++ def test_survey_defaults_to_english_base_language(self) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/",+ data={+ "name": "Survey",+ "type": "popover",+ "questions": [{"type": "open", "question": "Question?"}],+ },+ format="json",+ )++ assert response.status_code == status.HTTP_201_CREATED, response.content+ assert response.json()["base_language"] == "en"+ survey = Survey.objects.get(id=response.json()["id"])+ assert survey.base_language == "en"++ def test_can_set_non_english_base_language(self) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/",+ data={+ "name": "Encuesta",+ "type": "popover",+ "base_language": "es-MX",+ "questions": [{"type": "open", "question": "¿Cómo estás?"}],+ "translations": {"en": {"name": "Survey"}},+ },+ format="json",+ )++ assert response.status_code == status.HTTP_201_CREATED, response.content+ assert response.json()["base_language"] == "es-mx"+ survey = Survey.objects.get(id=response.json()["id"])+ assert survey.translations is not None+ assert "en" in survey.translations++ def test_base_language_rejects_invalid_value(self) -> None:+ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/",+ data={+ "name": "Survey",+ "type": "popover",+ "base_language": "english",+ "questions": [{"type": "open", "question": "Question?"}],+ },+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content++ def test_legacy_translation_keys_are_preserved_on_unrelated_update(self) -> None:+ """A survey with pre-existing bad keys can still be saved as long as the bad entries are not modified."""+ survey = Survey.objects.create(+ team=self.team,+ name="Legacy survey",+ type="popover",+ base_language="en",+ questions=[{"type": "open", "id": "q1", "question": "Question?"}],+ translations={+ "default": {"name": "Should never have been a key"},+ "es": {"name": "Encuesta válida"},+ },+ )++ response = self.client.patch(+ f"/api/projects/{self.team.id}/surveys/{survey.id}/",+ data={"name": "Renamed"},+ format="json",+ )++ assert response.status_code == status.HTTP_200_OK, response.content+ survey.refresh_from_db()+ assert survey.translations is not None+ assert survey.translations.get("default") == {"name": "Should never have been a key"}+ assert survey.translations.get("es") == {"name": "Encuesta válida"}++ def test_legacy_translation_keys_can_still_be_edited(self) -> None:+ """Edits to a survey with legacy keys go through — content can change for grandfathered keys."""+ survey = Survey.objects.create(+ team=self.team,+ name="Legacy survey",+ type="popover",+ base_language="en",+ questions=[{"type": "open", "id": "q1", "question": "Question?"}],+ translations={"default": {"name": "Old text"}},+ )++ response = self.client.patch(+ f"/api/projects/{self.team.id}/surveys/{survey.id}/",+ data={"translations": {"default": {"name": "Edited text"}}},+ format="json",+ )++ assert response.status_code == status.HTTP_200_OK, response.content+ survey.refresh_from_db()+ assert survey.translations is not None+ assert survey.translations["default"] == {"name": "Edited text"}++ def test_new_bad_keys_still_rejected_on_legacy_survey(self) -> None:+ """A legacy survey can keep its bad keys but cannot accumulate new ones."""+ survey = Survey.objects.create(+ team=self.team,+ name="Legacy survey",+ type="popover",+ base_language="en",+ questions=[{"type": "open", "id": "q1", "question": "Question?"}],+ translations={"default": {"name": "Old text"}},+ )++ response = self.client.patch(+ f"/api/projects/{self.team.id}/surveys/{survey.id}/",+ data={+ "translations": {+ "default": {"name": "Old text"},+ "english": {"name": "Newly added bad key"},+ }+ },+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ assert "english" in response.json()["detail"].lower()++ def test_new_translation_collides_with_legacy_case_variant(self) -> None:+ """Adding a new 'en' translation alongside a legacy 'EN' key is rejected as a normalization collision."""+ survey = Survey.objects.create(+ team=self.team,+ name="Legacy survey",+ type="popover",+ base_language="es",+ questions=[{"type": "open", "id": "q1", "question": "Question?"}],+ translations={"EN": {"name": "Legacy uppercase"}},+ )++ response = self.client.patch(+ f"/api/projects/{self.team.id}/surveys/{survey.id}/",+ data={+ "translations": {+ "EN": {"name": "Legacy uppercase"},+ "en": {"name": "New lowercase"},+ }+ },+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ assert "collides" in response.json()["detail"].lower()++ def test_base_language_change_rejects_collision_with_existing_translation(self) -> None:+ """Changing base_language to a code already present in translations is rejected."""+ survey = Survey.objects.create(+ team=self.team,+ name="Multi-language survey",+ type="popover",+ base_language="en",+ questions=[{"type": "open", "id": "q1", "question": "Question?"}],+ translations={"fr": {"name": "French"}},+ )++ response = self.client.patch(+ f"/api/projects/{self.team.id}/surveys/{survey.id}/",+ data={"base_language": "fr"},+ format="json",+ )++ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.content+ assert "base_language" in response.json() or "translation" in response.content.decode().lower()++ def test_sdk_payload_strips_invalid_question_translation_keys(self) -> None:+ """Question-level translation keys are stripped from the SDK payload, just like survey-level ones."""+ from products.surveys.backend.api.survey import SurveyAPISerializer++ survey = Survey.objects.create(+ team=self.team,+ name="Q-level legacy",+ type="popover",+ base_language="en",+ questions=[+ {+ "id": "q1",+ "type": "open",+ "question": "How are you?",+ "translations": {+ "es": {"question": "¿Cómo estás?"},+ "default": {"question": "Should be dropped"},+ "english": {"question": "Should be dropped"},+ "EN-us": {"question": "Normalized to en-us"},+ },+ }+ ],+ )++ payload = SurveyAPISerializer(survey).data+ q_translations = payload["questions"][0]["translations"]+ assert "es" in q_translations+ assert "en-us" in q_translations+ assert "default" not in q_translations+ assert "english" not in q_translations++ def test_sdk_payload_strips_invalid_translation_keys(self) -> None:+ """get_survey_api_translations drops keys the SDK matcher cannot resolve."""+ from products.surveys.backend.api.survey import get_survey_api_translations++ result = get_survey_api_translations(+ {+ "es": {"name": "Hola"},+ "default": {"name": "Should be dropped"},+ "en": {"name": "Same as base, should be dropped"},+ "EN-us": {"name": "Normalized to en-us"},+ },+ base_language="en",+ )++ assert result is not None+ assert "es" in result+ assert "en-us" in result+ assert "default" not in result+ assert "en" not in result@override_settings(CLOUD_DEPLOYMENT="US", GEMINI_API_KEY="test-key")@patch("products.surveys.backend.api.survey.generate_survey_translation")@@ -232,6 +502,31 @@ class TestSurvey(APIBaseTest):]assert mock_generate_survey_translation.call_args.kwargs["survey"]["name"] == "Draft feedback"assert "linked_flag" not in mock_generate_survey_translation.call_args.kwargs["survey"]+ # source_language falls back to the survey's base_language when not provided+ assert mock_generate_survey_translation.call_args.kwargs["source_language"] == "en"++ @override_settings(CLOUD_DEPLOYMENT="US", GEMINI_API_KEY="test-key")+ @patch("products.surveys.backend.api.survey.generate_survey_translation")+ def test_generate_translations_uses_survey_base_language_as_source(self, mock_generate_survey_translation) -> None:+ self.organization.is_ai_data_processing_approved = True+ self.organization.save(update_fields=["is_ai_data_processing_approved"])+ survey = Survey.objects.create(+ team=self.team,+ name="Encuesta",+ type="popover",+ base_language="es",+ questions=[{"id": "q1", "type": "open", "question": "¿Cómo estás?"}],+ )+ mock_generate_survey_translation.return_value = ({}, [], [], "trace-2")++ response = self.client.post(+ f"/api/projects/{self.team.id}/surveys/{survey.id}/generate_translations/",+ data={"target_language": "pt-BR"},+ format="json",+ )++ assert response.status_code == status.HTTP_200_OK, response.json()+ assert mock_generate_survey_translation.call_args.kwargs["source_language"] == "es"@override_settings(CLOUD_DEPLOYMENT="US", GEMINI_API_KEY="test-key")@patch("products.surveys.backend.api.survey.generate_survey_translation")@@ -2362,6 +2657,7 @@ class TestSurvey(APIBaseTest):"created_at": ANY,"created_by": ANY,"targeting_flag": None,+ "base_language": "en","translations": None,"internal_targeting_flag": {"id": ANY,diff --git a/products/surveys/backend/migrations/0003_survey_base_language_alter_survey_questions.py b/products/surveys/backend/migrations/0003_survey_base_language_alter_survey_questions.pynew file mode 100644index 000000000000..49e052c2b350--- /dev/null+++ b/products/surveys/backend/migrations/0003_survey_base_language_alter_survey_questions.py@@ -0,0 +1,26 @@+# Generated by Django 5.2.14 on 2026-05-21 15:50++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("surveys", "0002_action_fk_repoint"),+ ]++ operations = [+ migrations.AddField(+ model_name="survey",+ name="base_language",+ field=models.CharField(default="en", max_length=20),+ ),+ migrations.AlterField(+ model_name="survey",+ name="questions",+ field=models.JSONField(+ blank=True,+ help_text='\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n "type": "next_question"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n "type": "end"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n "type": "response_based",\n "responseValues": {\n "responseKey": "value"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n "type": "specific_question",\n "index": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey\'s `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n "id": "uuid",\n "type": "rating",\n "question": "How satisfied are you?",\n "lowerBoundLabel": "Not satisfied",\n "upperBoundLabel": "Very satisfied",\n "translations": {\n "es": {\n "question": "¿Qué tan satisfecho estás?",\n "lowerBoundLabel": "No satisfecho",\n "upperBoundLabel": "Muy satisfecho"\n },\n "fr": {\n "question": "Dans quelle mesure êtes-vous satisfait?"\n }\n }\n }\n ```\n ',+ null=True,+ ),+ ),+ ]diff --git a/products/surveys/backend/migrations/max_migration.txt b/products/surveys/backend/migrations/max_migration.txtindex 962cbf017dba..d4e7bc2fc1da 100644--- a/products/surveys/backend/migrations/max_migration.txt+++ b/products/surveys/backend/migrations/max_migration.txt@@ -1 +1 @@-0002_action_fk_repoint+0003_survey_base_language_alter_survey_questionsdiff --git a/products/surveys/backend/models.py b/products/surveys/backend/models.pyindex e7a81d69c635..c1b36d76e019 100644--- a/products/surveys/backend/models.py+++ b/products/surveys/backend/models.py@@ -192,7 +192,7 @@ class Survey(FileSystemSyncMixin, RootTeamMixin, UUIDTModel):Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -280,9 +280,13 @@ class Survey(FileSystemSyncMixin, RootTeamMixin, UUIDTModel):# TipTap editor layout for form-builder surveysform_content = models.JSONField(blank=True, null=True)+ # Language the top-level survey/question text is written in.+ # Used as the "original" label in the editor and as the source language for AI-generated translations.+ # The SDK does not read this field — base text is always the rendering fallback when no translation matches.+ base_language = models.CharField(max_length=20, default="en")# Translations for multi-language support# Format: { [languageCode]: { name: string, description: string, thankYouMessageHeader: string, thankYouMessageDescription: string, thankYouMessageCloseButtonText: string, ... } }- # Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ # Language codes must be canonical BCP-47-ish strings (e.g. "es", "es-MX"). Aliases like "english" or "default" are rejected by the API.translations = models.JSONField(blank=True, null=True)# Use the survey_type instead. If it's external_survey, it's publicly shareable.diff --git a/products/surveys/frontend/generated/api.schemas.ts b/products/surveys/frontend/generated/api.schemas.tsindex 94806072bf25..e8f202fd14ac 100644--- a/products/surveys/frontend/generated/api.schemas.ts+++ b/products/surveys/frontend/generated/api.schemas.ts@@ -261,7 +261,7 @@ export interface SurveyApi {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -345,6 +345,11 @@ export interface SurveyApi {enable_partial_responses?: boolean | null/** @nullable */enable_iframe_embedding?: boolean | null+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: stringtranslations?: unknown/*** The effective access level the user has for this object@@ -1339,7 +1344,7 @@ export interface SurveySerializerCreateUpdateOnlySchemaApi {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -1436,6 +1441,11 @@ export interface SurveySerializerCreateUpdateOnlySchemaApi {enable_partial_responses?: boolean | null/** @nullable */enable_iframe_embedding?: boolean | null+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: stringtranslations?: unknown_create_in_folder?: stringform_content?: unknown@@ -1548,7 +1558,7 @@ export interface SurveySerializerCreateUpdateOnlyApi {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -1630,6 +1640,11 @@ export interface SurveySerializerCreateUpdateOnlyApi {enable_partial_responses?: boolean | null/** @nullable */enable_iframe_embedding?: boolean | null+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: stringtranslations?: unknown_create_in_folder?: stringform_content?: unknown@@ -1766,7 +1781,7 @@ export interface PatchedSurveySerializerCreateUpdateOnlySchemaApi {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -1863,6 +1878,11 @@ export interface PatchedSurveySerializerCreateUpdateOnlySchemaApi {enable_partial_responses?: boolean | null/** @nullable */enable_iframe_embedding?: boolean | null+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: stringtranslations?: unknown_create_in_folder?: stringform_content?: unknown@@ -1876,7 +1896,7 @@ export type GenerateSurveyTranslationsRequestApiSurvey = { [key: string]: unknowexport interface GenerateSurveyTranslationsRequestApi {/** Language code to generate translations for, for example pt-BR. */target_language: string- /** Source language code for the existing survey copy. */+ /** Optional override for the source language code. Defaults to the survey's `base_language` (or 'en' if unset). */source_language?: string/** Whether to overwrite existing translations for this language. */overwrite?: booleandiff --git a/products/surveys/frontend/generated/api.zod.ts b/products/surveys/frontend/generated/api.zod.tsindex 7ecf242d71ce..94428b69c60d 100644--- a/products/surveys/frontend/generated/api.zod.ts+++ b/products/surveys/frontend/generated/api.zod.ts@@ -40,6 +40,8 @@ export const surveysCreateBodyResponseSamplingIntervalMax = 2147483647export const surveysCreateBodyResponseSamplingLimitMin = 0export const surveysCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysCreateBodyBaseLanguageMax = 20+export const SurveysCreateBody = /* @__PURE__ */ zod.object({name: zod.string().min(1).max(surveysCreateBodyNameMax).describe('Survey name.'),description: zod.string().optional().describe('Survey description.'),@@ -610,7 +612,7 @@ export const SurveysCreateBody = /* @__PURE__ */ zod.object({).nullish().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.union([@@ -782,6 +784,13 @@ export const SurveysCreateBody = /* @__PURE__ */ zod.object({'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),@@ -807,6 +816,8 @@ export const surveysUpdateBodyResponseSamplingIntervalMax = 2147483647export const surveysUpdateBodyResponseSamplingLimitMin = 0export const surveysUpdateBodyResponseSamplingLimitMax = 2147483647+export const surveysUpdateBodyBaseLanguageMax = 20+export const SurveysUpdateBody = /* @__PURE__ */ zod.object({name: zod.string().max(surveysUpdateBodyNameMax),@@ -823,7 +834,7 @@ export const SurveysUpdateBody = /* @__PURE__ */ zod.unknown().optional().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),appearance: zod.unknown().optional(),start_date: zod.iso.datetime({ offset: true }).nullish(),@@ -872,6 +883,13 @@ export const SurveysUpdateBody = /* @__PURE__ */ zodresponse_sampling_daily_limits: zod.unknown().optional(),enable_partial_responses: zod.boolean().nullish(),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysUpdateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),form_content: zod.unknown().optional(),})@@ -908,6 +926,8 @@ export const surveysPartialUpdateBodyResponseSamplingIntervalMax = 2147483647export const surveysPartialUpdateBodyResponseSamplingLimitMin = 0export const surveysPartialUpdateBodyResponseSamplingLimitMax = 2147483647+export const surveysPartialUpdateBodyBaseLanguageMax = 20+export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({name: zod.string().min(1).max(surveysPartialUpdateBodyNameMax).optional().describe('Survey name.'),description: zod.string().optional().describe('Survey description.'),@@ -1479,7 +1499,7 @@ export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({).nullish().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.union([@@ -1651,6 +1671,13 @@ export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysPartialUpdateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),@@ -1682,6 +1709,8 @@ export const surveysDuplicateToProjectsCreateBodyResponseSamplingIntervalMax = 2export const surveysDuplicateToProjectsCreateBodyResponseSamplingLimitMin = 0export const surveysDuplicateToProjectsCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysDuplicateToProjectsCreateBodyBaseLanguageMax = 20+export const SurveysDuplicateToProjectsCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(surveysDuplicateToProjectsCreateBodyNameMax),description: zod.string().optional(),@@ -1700,7 +1729,7 @@ export const SurveysDuplicateToProjectsCreateBody = /* @__PURE__ */ zod.object({.unknown().optional().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.unknown().optional(),appearance: zod.unknown().optional(),@@ -1750,20 +1779,28 @@ export const SurveysDuplicateToProjectsCreateBody = /* @__PURE__ */ zod.object({response_sampling_daily_limits: zod.unknown().optional(),enable_partial_responses: zod.boolean().nullish(),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysDuplicateToProjectsCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),})-export const surveysGenerateTranslationsCreateBodySourceLanguageDefault = `en`export const surveysGenerateTranslationsCreateBodyOverwriteDefault = falseexport const SurveysGenerateTranslationsCreateBody = /* @__PURE__ */ zod.object({target_language: zod.string().describe('Language code to generate translations for, for example pt-BR.'),source_language: zod.string()- .default(surveysGenerateTranslationsCreateBodySourceLanguageDefault)- .describe('Source language code for the existing survey copy.'),+ .optional()+ .describe(+ "Optional override for the source language code. Defaults to the survey's `base_language` (or 'en' if unset)."+ ),overwrite: zod.boolean().default(surveysGenerateTranslationsCreateBodyOverwriteDefault)@@ -1797,6 +1834,8 @@ export const surveysResponsesArchiveCreateBodyResponseSamplingIntervalMax = 2147export const surveysResponsesArchiveCreateBodyResponseSamplingLimitMin = 0export const surveysResponsesArchiveCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysResponsesArchiveCreateBodyBaseLanguageMax = 20+export const SurveysResponsesArchiveCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(surveysResponsesArchiveCreateBodyNameMax),description: zod.string().optional(),@@ -1815,7 +1854,7 @@ export const SurveysResponsesArchiveCreateBody = /* @__PURE__ */ zod.object({.unknown().optional().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.unknown().optional(),appearance: zod.unknown().optional(),@@ -1865,6 +1904,13 @@ export const SurveysResponsesArchiveCreateBody = /* @__PURE__ */ zod.object({response_sampling_daily_limits: zod.unknown().optional(),enable_partial_responses: zod.boolean().nullish(),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysResponsesArchiveCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),@@ -1893,6 +1939,8 @@ export const surveysResponsesUnarchiveCreateBodyResponseSamplingIntervalMax = 21export const surveysResponsesUnarchiveCreateBodyResponseSamplingLimitMin = 0export const surveysResponsesUnarchiveCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysResponsesUnarchiveCreateBodyBaseLanguageMax = 20+export const SurveysResponsesUnarchiveCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(surveysResponsesUnarchiveCreateBodyNameMax),description: zod.string().optional(),@@ -1911,7 +1959,7 @@ export const SurveysResponsesUnarchiveCreateBody = /* @__PURE__ */ zod.object({.unknown().optional().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.unknown().optional(),appearance: zod.unknown().optional(),@@ -1961,6 +2009,13 @@ export const SurveysResponsesUnarchiveCreateBody = /* @__PURE__ */ zod.object({response_sampling_daily_limits: zod.unknown().optional(),enable_partial_responses: zod.boolean().nullish(),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysResponsesUnarchiveCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),@@ -1986,6 +2041,8 @@ export const surveysSummarizeResponsesCreateBodyResponseSamplingIntervalMax = 21export const surveysSummarizeResponsesCreateBodyResponseSamplingLimitMin = 0export const surveysSummarizeResponsesCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysSummarizeResponsesCreateBodyBaseLanguageMax = 20+export const SurveysSummarizeResponsesCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(surveysSummarizeResponsesCreateBodyNameMax),description: zod.string().optional(),@@ -2004,7 +2061,7 @@ export const SurveysSummarizeResponsesCreateBody = /* @__PURE__ */ zod.object({.unknown().optional().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.unknown().optional(),appearance: zod.unknown().optional(),@@ -2054,6 +2111,13 @@ export const SurveysSummarizeResponsesCreateBody = /* @__PURE__ */ zod.object({response_sampling_daily_limits: zod.unknown().optional(),enable_partial_responses: zod.boolean().nullish(),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysSummarizeResponsesCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),@@ -2079,6 +2143,8 @@ export const surveysSummaryHeadlineCreateBodyResponseSamplingIntervalMax = 21474export const surveysSummaryHeadlineCreateBodyResponseSamplingLimitMin = 0export const surveysSummaryHeadlineCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysSummaryHeadlineCreateBodyBaseLanguageMax = 20+export const SurveysSummaryHeadlineCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(surveysSummaryHeadlineCreateBodyNameMax),description: zod.string().optional(),@@ -2097,7 +2163,7 @@ export const SurveysSummaryHeadlineCreateBody = /* @__PURE__ */ zod.object({.unknown().optional().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., \"es\", \"es-MX\", \"english\", \"french\")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n \"type\": \"next_question\"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n \"type\": \"end\"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n \"type\": \"response_based\",\n \"responseValues\": {\n \"responseKey\": \"value\"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n \"type\": \"specific_question\",\n \"index\": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., \"es\", \"es-MX\", \"zh-CN\"). Aliases like \"english\" or \"default\" are rejected. The survey\'s `base_language` (default \"en\") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n \"id\": \"uuid\",\n \"type\": \"rating\",\n \"question\": \"How satisfied are you?\",\n \"lowerBoundLabel\": \"Not satisfied\",\n \"upperBoundLabel\": \"Very satisfied\",\n \"translations\": {\n \"es\": {\n \"question\": \"¿Qué tan satisfecho estás?\",\n \"lowerBoundLabel\": \"No satisfecho\",\n \"upperBoundLabel\": \"Muy satisfecho\"\n },\n \"fr\": {\n \"question\": \"Dans quelle mesure êtes-vous satisfait?\"\n }\n }\n }\n ```\n '),conditions: zod.unknown().optional(),appearance: zod.unknown().optional(),@@ -2147,6 +2213,13 @@ export const SurveysSummaryHeadlineCreateBody = /* @__PURE__ */ zod.object({response_sampling_daily_limits: zod.unknown().optional(),enable_partial_responses: zod.boolean().nullish(),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysSummaryHeadlineCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 14276af03728..f48ec6e70574 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -16985,7 +16985,7 @@ export namespace Schemas {export interface GenerateSurveyTranslationsRequest {/** Language code to generate translations for, for example pt-BR. */target_language: string;- /** Source language code for the existing survey copy. */+ /** Optional override for the source language code. Defaults to the survey's `base_language` (or 'en' if unset). */source_language?: string;/** Whether to overwrite existing translations for this language. */overwrite?: boolean;@@ -24313,7 +24313,7 @@ export namespace Schemas {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -24397,6 +24397,11 @@ export namespace Schemas {enable_partial_responses?: boolean | null;/** @nullable */enable_iframe_embedding?: boolean | null;+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: string;translations?: unknown;/*** The effective access level the user has for this object@@ -30376,7 +30381,7 @@ export namespace Schemas {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -30473,6 +30478,11 @@ export namespace Schemas {enable_partial_responses?: boolean | null;/** @nullable */enable_iframe_embedding?: boolean | null;+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: string;translations?: unknown;_create_in_folder?: string;form_content?: unknown;@@ -35021,7 +35031,7 @@ export namespace Schemas {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -35103,6 +35113,11 @@ export namespace Schemas {enable_partial_responses?: boolean | null;/** @nullable */enable_iframe_embedding?: boolean | null;+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: string;translations?: unknown;_create_in_folder?: string;form_content?: unknown;@@ -35239,7 +35254,7 @@ export namespace Schemas {Translations: Each question can include inline translations.- `translations`: Object mapping language codes to translated fields.- - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")+ - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey's `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.- Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`Example with translations:@@ -35336,6 +35351,11 @@ export namespace Schemas {enable_partial_responses?: boolean | null;/** @nullable */enable_iframe_embedding?: boolean | null;+ /**+ * BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`.+ * @maxLength 20+ */+ base_language?: string;translations?: unknown;_create_in_folder?: string;form_content?: unknown;diff --git a/services/mcp/src/generated/surveys/api.ts b/services/mcp/src/generated/surveys/api.tsindex f9f18d29c82c..58d4b6ecb014 100644--- a/services/mcp/src/generated/surveys/api.ts+++ b/services/mcp/src/generated/surveys/api.ts@@ -67,6 +67,8 @@ export const surveysCreateBodyResponseSamplingIntervalMax = 2147483647export const surveysCreateBodyResponseSamplingLimitMin = 0export const surveysCreateBodyResponseSamplingLimitMax = 2147483647+export const surveysCreateBodyBaseLanguageMax = 20+export const SurveysCreateBody = /* @__PURE__ */ zod.object({name: zod.string().min(1).max(surveysCreateBodyNameMax).describe('Survey name.'),description: zod.string().optional().describe('Survey description.'),@@ -625,7 +627,7 @@ export const SurveysCreateBody = /* @__PURE__ */ zod.object({).nullish().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n "type": "next_question"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n "type": "end"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n "type": "response_based",\n "responseValues": {\n "responseKey": "value"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n "type": "specific_question",\n "index": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n "id": "uuid",\n "type": "rating",\n "question": "How satisfied are you?",\n "lowerBoundLabel": "Not satisfied",\n "upperBoundLabel": "Very satisfied",\n "translations": {\n "es": {\n "question": "¿Qué tan satisfecho estás?",\n "lowerBoundLabel": "No satisfecho",\n "upperBoundLabel": "Muy satisfecho"\n },\n "fr": {\n "question": "Dans quelle mesure êtes-vous satisfait?"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n "type": "next_question"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n "type": "end"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n "type": "response_based",\n "responseValues": {\n "responseKey": "value"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n "type": "specific_question",\n "index": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey\'s `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n "id": "uuid",\n "type": "rating",\n "question": "How satisfied are you?",\n "lowerBoundLabel": "Not satisfied",\n "upperBoundLabel": "Very satisfied",\n "translations": {\n "es": {\n "question": "¿Qué tan satisfecho estás?",\n "lowerBoundLabel": "No satisfecho",\n "upperBoundLabel": "Muy satisfecho"\n },\n "fr": {\n "question": "Dans quelle mesure êtes-vous satisfait?"\n }\n }\n }\n ```\n '),conditions: zod.union([@@ -797,6 +799,13 @@ export const SurveysCreateBody = /* @__PURE__ */ zod.object({'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysCreateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),@@ -851,6 +860,8 @@ export const surveysPartialUpdateBodyResponseSamplingIntervalMax = 2147483647export const surveysPartialUpdateBodyResponseSamplingLimitMin = 0export const surveysPartialUpdateBodyResponseSamplingLimitMax = 2147483647+export const surveysPartialUpdateBodyBaseLanguageMax = 20+export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({name: zod.string().min(1).max(surveysPartialUpdateBodyNameMax).optional().describe('Survey name.'),description: zod.string().optional().describe('Survey description.'),@@ -1410,7 +1421,7 @@ export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({).nullish().describe(- '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n "type": "next_question"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n "type": "end"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n "type": "response_based",\n "responseValues": {\n "responseKey": "value"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n "type": "specific_question",\n "index": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Any string - allows customers to use their own language keys (e.g., "es", "es-MX", "english", "french")\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n "id": "uuid",\n "type": "rating",\n "question": "How satisfied are you?",\n "lowerBoundLabel": "Not satisfied",\n "upperBoundLabel": "Very satisfied",\n "translations": {\n "es": {\n "question": "¿Qué tan satisfecho estás?",\n "lowerBoundLabel": "No satisfecho",\n "upperBoundLabel": "Muy satisfecho"\n },\n "fr": {\n "question": "Dans quelle mesure êtes-vous satisfait?"\n }\n }\n }\n ```\n '+ '\n The `array` of questions included in the survey. Each question must conform to one of the defined question types: Basic, Link, Rating, or Multiple Choice.\n\n Basic (open-ended question)\n - `id`: The question ID\n - `type`: `open`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Link (a question with a link)\n - `id`: The question ID\n - `type`: `link`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `link`: The URL associated with the question.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Rating (a question with a rating scale)\n - `id`: The question ID\n - `type`: `rating`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `display`: Display style of the rating (`number` or `emoji`).\n - `scale`: The scale of the rating (`number`).\n - `lowerBoundLabel`: Label for the lower bound of the scale.\n - `upperBoundLabel`: Label for the upper bound of the scale.\n - `isNpsQuestion`: Whether the question is an NPS rating.\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Multiple choice\n - `id`: The question ID\n - `type`: `single_choice` or `multiple_choice`\n - `question`: The text of the question.\n - `description`: Optional description of the question.\n - `descriptionContentType`: Content type of the description (`html` or `text`).\n - `optional`: Whether the question is optional (`boolean`).\n - `buttonText`: Text displayed on the submit button.\n - `choices`: An array of choices for the question.\n - `shuffleOptions`: Whether to shuffle the order of the choices (`boolean`).\n - `hasOpenChoice`: Whether the question allows an open-ended response (`boolean`).\n - `branching`: Branching logic for the question. See branching types below for details.\n\n Branching logic can be one of the following types:\n\n Next question: Proceeds to the next question\n ```json\n {\n "type": "next_question"\n }\n ```\n\n End: Ends the survey, optionally displaying a confirmation message.\n ```json\n {\n "type": "end"\n }\n ```\n\n Response-based: Branches based on the response values. Available for the `rating` and `single_choice` question types.\n ```json\n {\n "type": "response_based",\n "responseValues": {\n "responseKey": "value"\n }\n }\n ```\n\n Specific question: Proceeds to a specific question by index.\n ```json\n {\n "type": "specific_question",\n "index": 2\n }\n ```\n\n Translations: Each question can include inline translations.\n - `translations`: Object mapping language codes to translated fields.\n - Language codes: Canonical BCP-47-ish strings (e.g., "es", "es-MX", "zh-CN"). Aliases like "english" or "default" are rejected. The survey\'s `base_language` (default "en") declares the language of the untranslated text and cannot also appear as a translation key.\n - Translatable fields: `question`, `description`, `buttonText`, `choices`, `lowerBoundLabel`, `upperBoundLabel`, `link`\n\n Example with translations:\n ```json\n {\n "id": "uuid",\n "type": "rating",\n "question": "How satisfied are you?",\n "lowerBoundLabel": "Not satisfied",\n "upperBoundLabel": "Very satisfied",\n "translations": {\n "es": {\n "question": "¿Qué tan satisfecho estás?",\n "lowerBoundLabel": "No satisfecho",\n "upperBoundLabel": "Muy satisfecho"\n },\n "fr": {\n "question": "Dans quelle mesure êtes-vous satisfait?"\n }\n }\n }\n ```\n '),conditions: zod.union([@@ -1582,6 +1593,13 @@ export const SurveysPartialUpdateBody = /* @__PURE__ */ zod.object({'When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).'),enable_iframe_embedding: zod.boolean().nullish(),+ base_language: zod+ .string()+ .max(surveysPartialUpdateBodyBaseLanguageMax)+ .optional()+ .describe(+ "BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in `translations`."+ ),translations: zod.unknown().optional(),_create_in_folder: zod.string().optional(),form_content: zod.unknown().optional(),diff --git a/services/mcp/src/tools/generated/surveys.ts b/services/mcp/src/tools/generated/surveys.tsindex eb4cdb73ba3d..bcce7912a96f 100644--- a/services/mcp/src/tools/generated/surveys.ts+++ b/services/mcp/src/tools/generated/surveys.ts@@ -31,6 +31,7 @@ const SurveyCreateSchema = SurveysCreateBody.omit({response_sampling_interval: true,response_sampling_limit: true,response_sampling_daily_limits: true,+ base_language: true,_create_in_folder: true,}).extend({type: SurveysCreateBody.shape['type'].describe(@@ -201,6 +202,7 @@ const SurveyUpdateSchema = SurveysPartialUpdateParams.omit({ project_id: true })response_sampling_interval: true,response_sampling_limit: true,response_sampling_daily_limits: true,+ base_language: true,_create_in_folder: true,}).shape)