Skip to content

feat: translate commits in the native app - #167

Draft
ricardovfreixo wants to merge 3 commits into
NativePHP:mainfrom
ricardovfreixo:feat/commit-translations
Draft

ricardovfreixo wants to merge 3 commits into
NativePHP:mainfrom
ricardovfreixo:feat/commit-translations

Conversation

@ricardovfreixo

@ricardovfreixo ricardovfreixo commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bring the web's commit translation experience to native mobile screens: automatically display shared cached translations when enabled, generate a missing translation only after tapping Translate, and switch back with Show original.

Closes #166.

Dependency: backend API support in dev-null-sh/dev-null.sh#1494 must be merged and deployed. This PR is a draft pending end-to-end verification of translated posts against that deployment.

Changes

  • Add native translation language search/selection and automatic-display settings in Account, using the saved preference or the phone's primary language with English fallback.
  • Render translated rich text and previews without replacing original post content used by quote/report/share actions; support compact quoted posts and nested replies.
  • Use cache-only reads for shared translations and explicit-only generation, with loading, retry feedback, stale-response guards, and cross-screen cache updates.
  • Recover settings saves interrupted by navigation and prevent older feed/detail requests from erasing a newly generated translation.
  • Hide unsupported translation controls on older backend responses.
  • Merge current main and pin the two NativePHP SDK revisions required by its swipe-to-reply feature: core 10c21b24 (Let a gesture area's pan trigger when let go far enough mobile-air#651) and UI 55f7c42c (Let a gesture area's pan trigger when let go far enough, on iOS and Android mobile-ui#197). Only these two dependency package records changed; no tests were removed or skipped to fix CI.

Validation

  • GitHub Tests PASS at 605db16ef30c9545045ae220e272ad4159436ea4: 1,871 passed, 37 skipped, 17,388 assertions. Successful run.
  • PHP_INI_SCAN_DIR=/tmp/devnull-local/php COMPOSER=composer.free.json php artisan test --compact -d memory_limit=1G — 1,869 passed, 37 skipped, 2 deprecated; 17,388 assertions; exit 0 after merging current main and updating the SDK pins.
  • CI regression reproduced locally: 8 failures in Remotes tests with the old locked SDK. With the compatible SDK pair, the same three test files pass: 136 tests, 1,601 assertions.
  • Isolated CI free-install dependency resolution retains both exact SDK pins after removing the three paid plugins. Installed, tracked, and local free-lock SDK references match.
  • Composer reports a valid schema. composer validate --strict exits nonzero solely for its expected warnings about the approved explicit commit references.
  • vendor/bin/pint --dirty --format agent and git diff --check — passed.
  • Before the CI dependency follow-up, the reviewed translation implementation was compiled, installed, and launched on a Pixel 9 running Android 17. The phone was not touched during the CI fix.
  • On-device checks: Following feed, Account controls, language sheet, search with the keyboard open, Portuguese selection/save/reopen, return to phone language, and automatic-display switch off/on. Original language preference, automatic-display setting, and dark mode were restored.
  • Independent code review PASS after fixing both asynchronous-response races and the truncated-code preview regression. Reviewed base 68c388f86276133b52585112a187a899e0cb7f8c; committed head 2b3505335656d759e8b908ae79d0b238d664db81 has the same reviewed content. Reviewer inspected source, tests, and supplied validation artifacts; did not independently rerun the suite or operate the device.

Limitations

  • Live translated-post display/generation remains unverified until the backend dependency is deployed. The refreshed live feed did not offer translation controls during device testing; no translation success is claimed from that check. Automated tests cover the new API contract and rendered translated states.
  • The new SDK pins include native code and require native-shell regeneration/rebuild and renewed device verification. The existing screenshots and phone checks predate this dependency-only follow-up.
  • iOS screenshots, recordings, and device verification are unavailable on this Linux machine.
  • The live feed changed between before and after captures; those images show compatibility, not a staged translation demonstration. Settings/picker evidence shows the actual new controls.
  • Media is published on a separate orphan branch; screenshots, recordings, and generated native runtime lock changes remain outside the code branch. The two approved SDK dependency updates are included.

Screenshots

  • No visible change

Android-only evidence, light and dark mode. The language sheet is new, so it has after-only captures. Recordings show real picker/search/save and preference restoration/toggling; encoded durations are approximately 8.6 seconds (light) and 12.9 seconds (dark).

Log — compatibility with the current backend

Android light Android dark
Before
After

Account settings

Android light Android dark
Before
After

New language picker and search

Android light Android dark
Picker
Search with keyboard

Recordings: Android light · Android dark

@ricardovfreixo

Copy link
Copy Markdown
Contributor Author

Fixed the CI integration failure in 605db16. The pull-request merge included the newer swipe-to-reply implementation from main, but its locked NativePHP packages lacked the required gesture trigger props and test API. Merged current main and pinned the matching core/UI upstream revisions; no tests were weakened or skipped.

GitHub Tests now pass: 1,871 passed, 37 skipped, 17,388 assertions.
https://github.com/NativePHP/dev-null-app/actions/runs/42168435217

These pins include native code and will require a rebuild before renewed device verification. The installed phone build was not changed during this fix.

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.

Bring web commit translations to the mobile app

1 participant