Skip to content

(fix) O3-4964: Preserve translation builder edits with per-language cache#1097

Open
Chinmay7070 wants to merge 4 commits intoopenmrs:mainfrom
Chinmay7070:O3-4964-refactor-translation-builderr
Open

(fix) O3-4964: Preserve translation builder edits with per-language cache#1097
Chinmay7070 wants to merge 4 commits intoopenmrs:mainfrom
Chinmay7070:O3-4964-refactor-translation-builderr

Conversation

@Chinmay7070
Copy link
Copy Markdown

@Chinmay7070 Chinmay7070 commented Feb 28, 2026

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR refactors the Translation Builder to:

  • Add per-language in-memory cache (localTranslations)
    to preserve user edits across language switches
  • Add mergeTranslations(local, backend, fallback) utility
    function outside component with priority: local > backend > fallback
  • Update handleUpdateValue to save edits to per-language cache
  • Update languageChanger to check cache first before fetching backend
  • Fix handleEditClick to remove duplicate setTranslations call

Screenshots

Before

openmrs-google-chrome-2026-02-27-22-24-14_DJ6SNEBe.mp4

After

openmrs-google-chrome-2026-03-06-19-17-51_B0Q2iUqc.mp4

Related Issue

https://openmrs.atlassian.net/browse/O3-4964

Other

Testing

  • Verified language switching preserves edits
  • Verified backend fetch happens only once per language

@Chinmay7070
Copy link
Copy Markdown
Author

Hi Everyone,
please review the PR when you get a chance?
Thank you!

@Chinmay7070
Copy link
Copy Markdown
Author

hi @denniskigen , @NethmiRodrigo
please review the PR when you get a chance?
Thank you!

@Chinmay7070
Copy link
Copy Markdown
Author

hi @denniskigen
please review the PR when you get a chance?
Thank you!

@Chinmay7070
Copy link
Copy Markdown
Author

hi @ibacher ,
please review the PR when you get a chance?
Thank you!

@denniskigen denniskigen changed the title O3-4964: Refactor translation builder with per-language cache and merge priority (fix) O3-4964: Preserve translation builder edits with per-language cache Mar 11, 2026
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