Skip to content

feat: surface previous translation memory hints in editor ( Issue #502 )#912

Open
zanzo2003 wants to merge 2 commits intowagtail:mainfrom
zanzo2003:feature/502-translation-memory-diff
Open

feat: surface previous translation memory hints in editor ( Issue #502 )#912
zanzo2003 wants to merge 2 commits intowagtail:mainfrom
zanzo2003:feature/502-translation-memory-diff

Conversation

@zanzo2003
Copy link
Copy Markdown

Summary ( PR for Issue #502 )

  • preload prior StringTranslations per segment so the React editor can reference them when the source text changes
  • expose historic translation/comment/author to the UI and render a “Previous translation” banner with a reuse shortcut
  • add a regression test that covers the stale-segment scenario for pages

Testing

  • python3 -m pytest wagtail_localize/tests/
    test_edit_translation.py::TestGetEditTranslationView::test_segments_include_previous_translation_when_source_changes
    --ds=wagtail_localize.test.settings
  • npm run build (after npm install)
  • Manual: change EN source text, open FR translation editor, verify banner + “Reuse previous translation” button saves
    cleanly

Adding test and Browser screen shots

Screenshot 2026-03-19 at 9 08 50 PM Screenshot 2026-03-19 at 9 13 50 PM Screenshot 2026-03-19 at 9 08 00 PM Screenshot 2026-03-19 at 9 18 50 PM

@zanzo2003
Copy link
Copy Markdown
Author

Previous source and tests screenshots

Screenshot 2026-03-19 at 8 21 26 PM Screenshot 2026-03-19 at 8 55 12 PM

@shreyasbhaskar2001
Copy link
Copy Markdown

Some minor feedbacks!!

  • wagtail_localize/locales/templates/wagtaillocales/edit.html:29, wagtail_localize/templates/wagtail_localize/admin/
    _components.html:7, wagtail_localize/templates/wagtail_localize/admin/submit_translation.html:24, wagtail_localize/
    templates/wagtail_localize/admin/update_translations.html:36: the includes for wagtailadmin/shared/
    non_field_errors.html have dropped out, so form-level validation errors (including component-level ones) will no
    longer be rendered. This regresses fixes merged recently—please restore the includes (a rebase onto current main
    should bring them back).
  • wagtail_localize/locales/views.py:75 and wagtail_localize/locales/templates/wagtaillocales/index.html:3: removing
    paginate_by = 20 and the pagination block undoes the new locale list pagination. On sites with many locales this will
    make the index slow and unwieldy, and the corresponding tests were also deleted. Reinstating the pagination logic
    (again, via rebase) is important to avoid that regression.

Highlights

  • Nice work enriching TranslationEditor with a previousTranslation payload and UI so translators can re-use the last
    human translation when the source string changes. This was a major pain point for the user, saw a discussion dating back to Jan 22

  • The backend changes in edit_translation.py efficiently gather the historical translation metadata and you added
    test_segments_include_previous_translation_when_source_changes, which gives good coverage of the new behaviour.

    Additionally @thibaudcolas , can you also check if these feedbacks are valid from you p.o.v ? I think this adds some good value to the product .

margin-left: 10px;

&--green {
color: #15704d;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks like the closing } for &--green got removed here along with the blank lines. Without it, &--red ends up nested inside &--green, so it'd compile to .icon--green--red instead of .icon--red — which would break the red error icon styling.

Copy link
Copy Markdown
Author

@zanzo2003 zanzo2003 Mar 23, 2026

Choose a reason for hiding this comment

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

Hey @Phinart98 , thanks for pointing that out !! totally missed that brace. I have updated the PR. Please let me know if there is anything else ? Thanks!

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.

3 participants