Bug 831056 - RFE: [Translation Memory] Option for highlight only the search terms
Summary: RFE: [Translation Memory] Option for highlight only the search terms
Alias: None
Product: Zanata
Classification: Retired
Component: Component-UI
Version: 1.6-SNAPSHOT
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 2.1
Assignee: Patrick Huang
QA Contact: Ding-Yi Chen
Depends On:
TreeView+ depends on / blocked
Reported: 2012-06-12 06:06 UTC by Ding-Yi Chen
Modified: 2013-02-26 04:06 UTC (History)
4 users (show)

Fixed In Version: 2.1-SNAPSHOT (20121206-1113)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-02-26 04:06:14 UTC

Attachments (Terms of Use)
Screenshot that demonstrates the issue (157.36 KB, image/png)
2012-06-12 06:08 UTC, Ding-Yi Chen
no flags Details
Current diff can not cope with fuzzy search (17.60 KB, application/octet-stream)
2012-11-30 04:48 UTC, Patrick Huang
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 805737 0 high CLOSED Incorrect / unexpected relative percentages of TM matches 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 817548 0 unspecified CLOSED RFE: UI legend/documentation for Translation Memory diff colour coding 2021-02-22 00:41:40 UTC

Internal Links: 805737 817548

Description Ding-Yi Chen 2012-06-12 06:06:40 UTC
Description of problem:
User story: As a casual translator I want my search terms highlighted in Suggestions from the Translation Memory.

Current view show the diff between the search terms and translation memory. 

However this view:
1. Does not provide an easy view where the search terms located in translation memory suggestions.

2. Does not match the usual behaviour of "search result", which only highlights exact search terms.

3. Does not look good for long source messages and translation memory suggestion. Scrolling is needed to see whole sentences. See attachment for how it looks like for long strings.

Version-Release number of selected component (if applicable):
Zanata version 1.6.1-SNAPSHOT (20120608-0019). 

How reproducible:

Steps to Reproduce:
1. Ensure the translation memory has something to show. (Translated messages exists)
2. Visit any document
3. Search on any string that the translation memory is likly to contain, such as "Enable" or "Ok"
Actual results:
Only diff view is presented.

Expected results:
An option is available for highlight only the search terms.

Comment 1 Ding-Yi Chen 2012-06-12 06:08:24 UTC
Created attachment 591099 [details]
Screenshot that demonstrates the issue

Comment 2 Runa Bhattacharjee 2012-07-30 13:07:00 UTC
The attachment does not seem to have a search item in the search box. However the error can be replicated.

Requesting for technical evaluation.

Comment 3 Sean Flanigan 2012-07-31 02:17:30 UTC
The screenshot is demonstrating the automatic TM search you get when clicking on any text flow.

I think we need to provide an alternative mode for the highlighter, so that non-matching/missing text is hidden, matching text is highlighted, and added text is shown plain.  It should just require a bit of CSS class tweaking, and a checkbox to turn it on and off.

Comment 4 Patrick Huang 2012-11-30 03:33:46 UTC
highlighting search term only make sense when there is 100% match. If it's not, i.e. fuzzy search, how do we want to highlight? Picking out matching words?

Comment 5 Patrick Huang 2012-11-30 03:35:52 UTC
Ok got the meaning. Basically we just use diff result.

Comment 6 Patrick Huang 2012-11-30 04:48:27 UTC
Created attachment 654812 [details]
Current diff can not cope with fuzzy search

See attachment. 
Search term: 
Fedora is an open

Item number three: 
Visit the Fedora community Wiki at <ulink url="http://fedoraproject.org/wiki/" />.

Entire string is showing as missing(diff delete) and added(diff insert). There is no diff equal. Back to the question I asked in Comment 4

Comment 7 Sean Flanigan 2012-11-30 07:32:14 UTC
I don't think we want to make a big thing of this RFE.  Just highlight the matching bits, according to diffmatchpatch, hide the missing bits, and show the added bits unhighlighted.  Some edge cases may not highlight well, but they may not be worth worrying about.

If we really wanted to, we could tell diffmatchpatch not to do "semantic cleanup" (see org.zanata.webtrans.client.ui.Highlighting.diff(String, String)), but this will probably make the highlighting uglier in most cases.

I suppose it could be useful to turn off semantic cleanup only in the cases where it makes a complete mess (eg one big deletion, and one big insertion).  But it's probably not worth the effort.

Or you could try turning off semantic cleanup whenever term highlighting is active, and we could see if we like the results.

Comment 8 Patrick Huang 2012-12-02 23:53:22 UTC
Turning semantic cleanup off when doing match term highlight. Semantic cleanup is on in normal diff mode.

committed into master:

Comment 9 Patrick Huang 2012-12-04 06:29:17 UTC
According to Hedda adding a user option that can be persisted is helpful

Comment 10 Patrick Huang 2012-12-04 07:00:21 UTC
committed again into master:

Comment 11 Ding-Yi Chen 2012-12-07 05:55:38 UTC
VERIFIED with Zanata version 2.1-SNAPSHOT (20121206-1113)

Note You need to log in before you can comment on or make changes to this bug.