PostHog / PostHog/posthog-flutter

Re-translate displayed survey on language change

Open
#483 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Survey
Dominant language
Dart
Stars
97
Forks
85
Avg merge
1d 8h
Merged PRs (30d)
31

Description

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: https://github.com/PostHog/posthog-ios/pull/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read posthog_flutter/lib/src/surveys/survey_service.dart and the native serialization path at posthog_flutter/darwin/posthog_flutter/Sources/posthog_flutter/PostHogDisplaySurvey+Dict.swift, plus Android's toMap(). After the linked native SDK work is available, trace the existing showSurvey/hideSurveys channel flow. Done means an updateSurvey payload reaches the displayed Flutter survey and causes it to rebuild with the new translation.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.