Skip to content

O3-4964: Refactor translation builder with per-language cache and merge priority#1097

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

O3-4964: Refactor translation builder with per-language cache and merge priority#1097
Chinmay7070 wants to merge 2 commits intoopenmrs:mainfrom
Chinmay7070:O3-4964-refactor-translation-builderr

Conversation

@Chinmay7070
Copy link

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

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
Author

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

@Chinmay7070
Copy link
Author

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

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