Bug 831056 - RFE: [Translation Memory] Option for highlight only the search terms
RFE: [Translation Memory] Option for highlight only the search terms
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-UI (Show other bugs)
1.6-SNAPSHOT
Unspecified Unspecified
medium Severity medium
: ---
: 2.1
Assigned To: Patrick Huang
Ding-Yi Chen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-12 02:06 EDT by Ding-Yi Chen
Modified: 2013-02-25 23:06 EST (History)
4 users (show)

See Also:
Fixed In Version: 2.1-SNAPSHOT (20121206-1113)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-25 23:06:14 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


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

  None (edit)
Description Ding-Yi Chen 2012-06-12 02:06:40 EDT
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:
Always

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 02:08:24 EDT
Created attachment 591099 [details]
Screenshot that demonstrates the issue
Comment 2 Runa Bhattacharjee 2012-07-30 09:07:00 EDT
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-30 22:17:30 EDT
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-29 22:33:46 EST
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-29 22:35:52 EST
Ok got the meaning. Basically we just use diff result.
Comment 6 Patrick Huang 2012-11-29 23:48:27 EST
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 02:32:14 EST
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 18:53:22 EST
Turning semantic cleanup off when doing match term highlight. Semantic cleanup is on in normal diff mode.

committed into master:
https://github.com/zanata/zanata/commit/4b1d06485090490c8bd297f1d67ffbd8db5601ad
Comment 9 Patrick Huang 2012-12-04 01:29:17 EST
According to Hedda adding a user option that can be persisted is helpful
Comment 10 Patrick Huang 2012-12-04 02:00:21 EST
committed again into master:
https://github.com/zanata/zanata/commit/83974ebe0a822173bd6d464df691a08a74e7ce09
Comment 11 Ding-Yi Chen 2012-12-07 00:55:38 EST
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.