Skip to content

Highlight placeables in the Translation Memory Tab#4061

Open
MundiaNderi wants to merge 4 commits intomozilla:mainfrom
MundiaNderi:fix-3445-highlight-placeables-in-translation-memory
Open

Highlight placeables in the Translation Memory Tab#4061
MundiaNderi wants to merge 4 commits intomozilla:mainfrom
MundiaNderi:fix-3445-highlight-placeables-in-translation-memory

Conversation

@MundiaNderi
Copy link
Copy Markdown
Collaborator

Fixes #3445

Placeables are now highlighted in this view: http://localhost:8000/sl/translation-memory/

To test, navigate to that link and see if they're highlighted.

Highlight placeables in the Translation Memory Tab
@MundiaNderi MundiaNderi requested a review from mathjazz April 4, 2026 09:30
@MundiaNderi MundiaNderi self-assigned this Apr 4, 2026
@functionzz
Copy link
Copy Markdown
Collaborator

Hey @MundiaNderi thanks for the patch, although I believe by what "highlight" means in this context refers to a similar feature found in the translate module like so:

image

As you can see the placeable is "highlighted" in grey. The issue with the current implementation is that it interferes with the search functionality of translation memory, as observed here: http://localhost:8000/sl/translation-memory/?search=amount.

@MundiaNderi
Copy link
Copy Markdown
Collaborator Author

Hey @MundiaNderi thanks for the patch, although I believe by what "highlight" means in this context refers to a similar feature found in the translate module like so:

image As you can see the placeable is "highlighted" in grey. The issue with the current implementation is that it interferes with the search functionality of translation memory, as observed here: http://localhost:8000/sl/translation-memory/?search=amount.

Hey Jamie, I had followed a similar approach first, reusing the regex from pontoon/translate/src/modules/placeable/placeholder.ts in pontoon/teams/static/js/translation_memory.js to identify placeables in the template, but ran into issues because the TM entries are loaded dynamically via AJAX, the JS ran before the DOM was populated. Since this is a server-rendered template, I switched to the Python approach to avoid that timing issue.
On my end, searching for other strings works without interference. "Amount" doesn't appear to be an available string in my local Translation Memory, here's a screenshot from a different string search:

Screenshot 2026-04-06 at 19 04 31

I ran Command F on all the 9 pages of Translation memory for the string amount to be sure, and that string doesn't exist on my local instance ie : Phrase not found

Screenshot 2026-04-06 at 19 12 02

@functionzz
Copy link
Copy Markdown
Collaborator

functionzz commented Apr 6, 2026

On my end, searching for other strings works without interference. "Amount" doesn't appear to be an available string in my local Translation Memory, here's a screenshot from a different string search:

Sorry about that. I am referring to the orange-yellow colour scheme of the highlight - since searching already uses the orange-yellow colour, you can't tell the difference between a placeable and a search. That's why I showed the first picture - not the implementation but rather the colour scheme itself.

I guess the next issue that follows is whether the highlight from search and the highlight from placeable will conflict with each other, if they are both using mark for highlighting.

@MundiaNderi
Copy link
Copy Markdown
Collaborator Author

On my end, searching for other strings works without interference. "Amount" doesn't appear to be an available string in my local Translation Memory, here's a screenshot from a different string search:

Sorry about that. I am referring to the orange-yellow colour scheme of the highlight - since searching already uses the orange-yellow colour, you can't tell the difference between a placeable and a search. That's why I showed the first picture - not the implementation but rather the colour scheme itself.

I guess the next issue that follows is whether the highlight from search and the highlight from placeable will conflict with each other, if they are both using mark for highlighting.

Okay, my bad. Will look into that and revert

@mathjazz
Copy link
Copy Markdown
Collaborator

mathjazz commented Apr 7, 2026

Confirming placeables are now properly highlighted!
Screenshot 2026-04-07 at 13 47 55

The bug that @functionzz mentioned is demonstrated here:
Screenshot 2026-04-07 at 13 48 14

@github-project-automation github-project-automation bot moved this to 🆕 Needs triage in Pontoon Roadmap Apr 8, 2026
@functionzz functionzz moved this from 🆕 Needs triage to 🏗 In progress in Pontoon Roadmap Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

Highlight placeables in Translation Memory tab

3 participants