Skip to content

i18n(player): resolve PlayerViewModel messages in the composable - #641

Merged
ProdigyV21 merged 1 commit into
ProdigyV21:mainfrom
ReichiMD:claude/reichimd-i18n-cleanup-im43fl
Sep 4, 2026
Merged

i18n(player): resolve PlayerViewModel messages in the composable#641
ProdigyV21 merged 1 commit into
ProdigyV21:mainfrom
ReichiMD:claude/reichimd-i18n-cleanup-im43fl

Conversation

@ReichiMD

@ReichiMD ReichiMD commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What

Same approach as #632/#634, applied to the player's view-model messages — this
time following the pattern you added yourself in 4691412 (PluginMessage +
localizedText()), because these strings are built outside a composable.

PlayerViewModel assembled its own user-facing text: the loading phases, the
playback errors, the AI-translation toast and every "Find best match" status and
result. A view model only holds the application context, whose resources follow
the system language rather than the language selected in the app, so those
messages ignored the in-app language — the six context.getString(...) calls in
that file did, and the 34 remaining string literals could not be moved at all
without hitting the same problem.

  • messages now travel through PlayerUiState as PlayerMessage (a @param:StringRes
    id plus its format arguments) and PlayerScreen resolves them
  • 31 new keys added to values/strings.xml in the player section, with German
    values in values-de/strings.xml
  • the 6 context.getString(...) calls in the view model are gone (0 left)
  • nested messages are supported, so the reference-source label ("Built-in" /
    "Hearing") inside a match status is localized too
  • one extra PlayerMessage.Raw case carries a platform exception message, which
    has no resource — this keeps the existing behaviour of that one error path exactly

Why

Approved in Discord (28 Aug): "Yes try to also bring hardcoded things into this.
That has been kinda a long time bug. They dont have to be in English yea."

This benefits all 50 language folders, not just German — untranslated locales fall
back to English exactly as before.

Notes

  • Rendered English text is unchanged, character for character. Where a message had
    an optional suffix (" (auto-offset +2.0s)", " (best 87%)"), it became a second
    full-sentence resource instead of a concatenation, so translators get whole
    sentences and word order can differ per language.
  • reportPlaybackError now records the stable resource entry name
    (player_fail_render_failed) in telemetry instead of the displayed sentence, so
    error reports stay comparable across languages.
  • Stored and compared values are untouched: subtitle/audio preference values, the
    "Built-in" / "Hearing" label used in the SubMatch log line, and the
    language names all stay English. Log and telemetry strings are out of scope.
  • No layout or behaviour change — the same messages appear in the same places, now
    in the app's language. Happy to add screenshots if useful.
  • Verified by ./gradlew testSideloadDebugUnitTest in CI (compile + unit tests green).

created by Claude (Anthropic) on behalf of @ReichiMD

The player view model built its user-facing text itself: loading phases,
playback errors, the AI translation toast and every "Find best match"
status and result. A view model only holds the application context, whose
resources follow the system language rather than the language selected in
the app, so those strings ignored the in-app language even once they lived
in strings.xml.

The messages now travel through the UI state as a PlayerMessage - a string
resource id plus its format arguments - and PlayerScreen resolves them.
Nested messages are supported so the reference-source label ("Built-in" /
"Hearing") inside a match status is localized too. Same shape as
PluginMessage, with an extra Raw case for a platform exception message
that has no resource.

The playback error telemetry now records the stable resource entry name
instead of the displayed sentence, so error reports stay comparable
across languages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018j1WJm8A8ZwaiUp6WmQ5qB
@github-actions github-actions Bot added the area: android Changes to the Android app or Gradle build label Sep 4, 2026
@ProdigyV21
ProdigyV21 merged commit 0cab422 into ProdigyV21:main Sep 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: android Changes to the Android app or Gradle build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants