Skip to content

Re-translate displayed survey on language change #483

Description

@ioannisj

Summary

The Flutter SDK renders a pre-translated snapshot serialized from the native SDKs. There's no channel message to update a displayed survey, so even once the native SDKs support live re-translation, a displayed Flutter survey stays in the language it was shown with.

Current State

  • The native SDK resolves the translation and serializes only the resolved strings (posthog_flutter/darwin/posthog_flutter/Sources/posthog_flutter/PostHogDisplaySurvey+Dict.swift on iOS, toMap() on Android). The Dart models are immutable and have no language or translation fields.
  • The delegate → Dart channel only has showSurvey and hideSurveys, and SurveyService drops renders while _isShowingSurvey (posthog_flutter/lib/src/surveys/survey_service.dart), so there's no path to update a survey that's already on screen.

Expected Behavior

When the native SDK re-resolves the active survey's translation (e.g. the language person property changed), the plugin's native delegates should forward an updateSurvey channel message and the displayed survey widget should rebuild from the new payload.

Dependencies

Needs the native SDKs to support live re-translation and expose it on their surveys delegates first:

Reference Implementation

posthog-ios: PostHog/posthog-ios#686 subscribes to person-property changes, re-resolves the active survey's translation, and pushes the update to the rendering delegate, no-oping when the matched language is unchanged.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions