Skip to content

#886 Localisation: component and shared text - #968

Closed
ivanfenenko wants to merge 1 commit into
feature/886-l10n-timelinefrom
feature/886-l10n-components
Closed

ivanfenenko wants to merge 1 commit into
feature/886-l10n-timelinefrom
feature/886-l10n-components

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Stage 2 slice for #886 (Localisation): text built inside design-system components and in domain/shared code now comes from the string files on both platforms. Part of the unmerged localisation stack, based on feature/886-l10n-settings (#957). Not compiled yet; the whole stack is built and verified once.

  • Components keyed (both platforms): session list (status pills, Recent/Today/Yesterday/"Week of" sections, scope-load placeholder, worktree-empty state), dock ("New session", "Add project", hold action, project-filter labels and hints, worktree pill), project picker, live-updates status and labels, top bar (Close default, project/worktree subtitles), composer (placeholder, buttons, send labels, revert chip, shell / side-question modes, child lockout, permission and question panels, selection hints, request pager), dictation card (all unavailable states, actions, progress), activity card and sheet (stepsLabel, "Working", agent and status words), step rail, image gallery and viewer, attachments, outgoing message, branch pill actions, code-file line and diff summary labels, drop overlay, page indicator, file tabs, hunk pill, split pane, list item, selectable card, reorderable list, server address input, section header count, session-list skeleton, onboarding skeleton illustration.
  • Shared/domain text:
    • Relative times ("now", "5m ago", "1d ago") are plurals. Android RelativeTimeFormatting.format returns UiText; iOS resolves String(localized:). The Add Project caption no longer uses .unlocalized.
    • iOS "New Session" placeholder and untitled fallback (session.new_title).
    • Android Diagnostics share subject and chooser title move from the ViewModel to Navigation.kt. The Feedback share subject becomes UiText.
    • ThemeManager.loadError is UiText / OpenCodeText.
    • ProjectFilesException.detail is UiText; its fallback reuses files.error.check_server_connection.
    • Session list section titles: Android HomeSessionLadderSection.title is UiText.
  • Component API changes (all callers, gallery and tests updated):
    • Android:
      • SessionListSession.caption: UiText
      • SessionListStatus.toListItemStatus(…, text: UiTextLookup), compactStatus(text)
      • SessionListScopeLoad / SessionListWorktreeEmptyCopy constants are @StringRes; WorktreeFilterClear.message is @StringRes
      • OpenCodeSessionConnectionStatus.label is @StringRes
      • OpenCodeAttachmentVariant.label is @StringRes (kindLabel() for display)
      • OpenCodeTopBarLeading.Close.contentDescription: String? (defaults to component_close)
      • openCodeDetailLeading, openCodeActivityStepCount, openCodeActivityAgentSectionLabel are @Composable
      • Modifier.composerAttachmentPasteMenu(pasteLabel = …) uses the system android.R.string.paste
      • sessionComposerSendLabel, questionSelectionHint and unavailableCopy return UiText
      • ServerAddressInput.hint and ReorderableList.contextActionLabel defaults come from resources
    • iOS:
      • New OpenCodeText.localized(_:) / localized(ifPresent:) for app text that shared code already resolved with String(localized:). It is not counted as debt.
      • WorktreeFilterClear.message and the SessionListWorktreeEmptyCopy / scope-load title, message and retry values are OpenCodeText
      • ThemeManager.loadError: OpenCodeText?
      • OpenCodeDictationUnavailableReason.actionTitle: OpenCodeText
      • OpenCodeSessionConnectionStatus.label / accessibilityLabel (LocalizedStringResource)
  • Keys: 211 new keys under component.*, session_list.*, live_updates.*, relative_time.*, dictation.*, share.*, theme.* and session.*, in one contiguous block in strings.xml. The catalog stays sorted; the change is insertions only (git diff --diff-algorithm=histogram). Existing keys reused where the meaning matches: common.retry, common.selected, common.open, common.cancel, common.remove, common.loading_sessions, top_bar.back, home.show_worktrees / home.hide_worktrees, home.worktree_count, files.error.check_server_connection, and session_list.status.running for the illustration.
  • scripts/check-hardcoded-text.mjs:
    • Now scans Android ui/components and iOS Components/.
    • Still skips galleries, developer tools and previews, and now also top-level *Preview* / *Sample* declarations and Compose animation debug labels.
    • Literals whose letters come only from interpolations or \u{…} escapes ("+$additions") no longer count.
    • Still warning-only.

Checks

  • node scripts/check-string-keys.mjs: pass, 932 shared keys (933 Android names including app_name).
  • node scripts/check-hardcoded-text.mjs: 75.
    • Same script on the base branch: 283 (the old script reported 77 because it skipped components).
    • Zero findings left in components except one (see Risks).
    • The other 74 are in Changes and Session Chat, owned by other slices.
  • xmllint --noout on strings.xml and python3 -m json.tool on the catalog: pass.
  • xcrun swiftc -parse on every changed Swift file: pass.
  • Every R.string / R.plurals and structured iOS key referenced in changed files exists.
  • Not built and no tests run: no Gradle, Xcode, simulator or emulator in this slice. Tests updated to compare resolved English:
    • Android: RelativeTimeFormattingTest, HomeSessionLadderTest, HomeSessionOrderStabilizerTest, SessionListStatusMappingTest, SessionListCompactRowTest, SessionListItemIndexTest, SessionListFilterTest, CrossProjectSessionListSessionsTest, SessionComposerSendLabelTest, DictationUnavailableCopyTest, ProjectFilesRepositoryTest.
    • iOS: DictationUnavailableCopyTests. Other iOS tests compare English strings that are unchanged.
  • gitleaks is not installed locally; the Secret Scan workflow covers it.

Evidence

Verified once for the whole stack.

Issue

#886

Risks / Follow-ups

  • Not compiled. Spots to watch at integration:
    • Android: new @Composable helpers called from modifier chains and default parameters (openCodeDetailLeading, scopeControlDescription, stepRailAccessibilityLabel, OpenCodeActivityStatus.spoken(), titleBlockAccessibilityLabel, outgoingMessageInteractionModifier, questionSelectionDecorator). Also @StringRes val in companion objects, the ProjectFilesException secondary constructor, and the UiText caption on SessionListSession.
    • iOS: String(localized:defaultValue:) inside nonisolated domain code (OptimisticSessionCreate.placeholderTitle, SessionDomainAdapter). Also OpenCodeText / LocalizedStringKey ternaries in OpenCodeHunkNavigationPill, StartDecorator and RequestPagerKind, switch expressions in OpenCodeAttachmentVariant.label, and the new OpenCodeText.localized factory.
  • Wording choices (one key, one wording):
    • Apostrophes: "Couldn't load …" and "didn't return this project's sessions" now use ' on iOS too (was ’).
    • iOS image tile "Could not load" → "Couldn't load", as on Android.
    • Skeleton row label: Android "Loading sessions" → "Loading session", as on iOS. The whole list stays "Loading sessions".
    • Dictation details: Android "this phone" → "this device", as on iOS. The OS name (Android / iOS) is a placeholder, not translated.
    • Platform accessibility conventions keep separate keys:
      • iOS label plus hint vs Android combined description: *_hint vs *_description (scheme picker, outgoing message, shell and side-question modes, activity rows).
      • Android-only keys (queued speech model, dictation status line, dock Previous/Next project) and iOS-only keys (dock hints, split-pane hint) exist in both files for parity.
  • Counts that keep today's English: "N sessions", "N more running", "N agents" and the relative-time units keep the same text in the one form (1 sessions, 1m ago). The multi-argument "Added file %1$s, %2$d additions, %3$d deletions" and "%1$d of %2$d" are plain strings.
  • Left hardcoded, and why:
    • Android "New Session" fallback (OptimisticSessionCreate.PLACEHOLDER_TITLE, SessionDomainAdapter): Session.title is a String carried through data, cache and every display site, and ViewModels must not call getString. The session.new_title key exists on both platforms; iOS uses it.
    • Android Session Chat "Move" list "main checkout" (HomeWorktreeCopy.worktreeSubtitle): the row model lives in ui/sessionchat, which another slice owns. HomeText.worktreeSubtitle is ready to swap in.
    • Android Files "The server responded with N.": needs a files.* key, outside this slice's prefixes.
    • iOS composer variant chip (.unlocalized(prompt.selectedVariantLabel)): "Default" comes from ModelModels.defaultVariantLabel and Session Chat's UI models.
    • Accessibility phrase builders not flagged by the check: tool chip, branch-pill summary, image-gallery position, review-changes pill, child-session row, message note, todo pill, timeline notice state, and the Android message-time "Yesterday". Several have English-asserting tests; each is a small follow-up.
    • Component defaults that callers always override: SessionListFilterTab.all() ("All", "N projects") and HomeSessionLadder.RECENT_HINT (not shown).
    • The iOS markdown bridge diagnostic is internal (logs/tests), now a named constant.
    • The "/btw" command token and "IMG" badge stay verbatim.
    • Absolute dates ("MMM d") keep their fixed pattern.
  • Component gallery: no new components; gallery screens were only updated where APIs changed.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Design-system components and the domain/shared code they read now take
their English from the string files on both platforms: session list,
dock and picker, live updates, top bar, composer, dictation card, activity
card and sheet, step rail, image gallery and viewer, attachments, and small
default labels. Relative times, session list section titles, share
subjects, theme errors and the new-session title are keyed too.

The hardcoded-text check now scans design-system components (galleries,
previews, sample declarations and animation labels excluded).
@ivanfenenko
ivanfenenko force-pushed the feature/886-l10n-components branch from c68ff6d to 78ba524 Compare November 2, 2026 23:16
@ivanfenenko
ivanfenenko changed the base branch from feature/886-l10n-settings to feature/886-l10n-timeline November 2, 2026 23:16
@ivanfenenko ivanfenenko mentioned this pull request Nov 3, 2026
14 tasks done
@ivanfenenko
ivanfenenko marked this pull request as ready for review November 3, 2026 15:59
@ivanfenenko ivanfenenko mentioned this pull request Nov 3, 2026
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Superseded by #975, which combines the whole #886 localisation stack into one pull request against main. Review and merge happen there.

@ivanfenenko ivanfenenko closed this Nov 3, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review: no finding that 2+ of 1 passes agreed on.

1 finding(s) from a single pass, not posted
  • android/app/src/main/java/dev/opencode/mobile/ui/components/chrome/OpenCodeSessionListDock.kt:710 low: Ask about worktree expand/collapse reuse (glm-5.3-flash)

opencode pr-review · passes: muse-spark-1.3-contributor, glm-5.3-flash, deepseek-v4.1-flash · $0.148 · 2 pass(es) failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant