Repository navigation
Description
Summary
The Android SDK resolves a survey's display language once, at show time. A displayed survey is frozen after that: changing the language person property doesn't re-translate it, and there's no delegate hook to update a rendered survey in place.
Current State
showSurvey()inposthog-android/src/main/java/com/posthog/android/surveys/PostHogSurveysIntegration.ktresolves the language (overrideDisplayLanguage→ person propertylanguage→ device locale) and the translations into locals, then hands the delegate a one-shotPostHogDisplaySurvey.$survey_languageis stamped from that snapshot.PostHogSurveysDelegate(posthog/src/main/java/com/posthog/surveys/PostHogSurveysDelegate.kt) only exposesrenderSurveyandcleanupSurveys, so there's no way to push new content to a survey that's already rendered.setPersonPropertiesForFlags()only triggers a flags reload, and that path doesn't reprocess surveys.canShowNextSurvey()bails while a survey is active, so nothing ever revisits the one on screen.
Expected Behavior
When person properties change while a survey is displayed and the resolved language differs from what's shown, the SDK should re-resolve the active survey's translation and push it to the delegate for an in-place update. $survey_language on subsequent survey events should match what's actually on screen.
Concretely this needs an optional updateSurvey on PostHogSurveysDelegate (implemented by the Compose delegate) plus a person-properties-changed subscription in PostHogSurveysIntegration.
Reference Implementation
posthog-ios: PostHog/posthog-ios#686 adds an optional updateSurvey to the surveys delegate and a person-properties-for-flags change subscription, and no-ops when the matched language is unchanged.
Related
- posthog-js (browser): Re-translate displayed survey on language change posthog-js#4174
- posthog-js (React Native): Re-translate displayed survey on language change for React Native posthog-js#4175
- posthog-flutter: Re-translate displayed survey on language change posthog-flutter#483
Activity