Bug 888055 - Newline characters in text flows not obvious enough for translators
Newline characters in text flows not obvious enough for translators
Product: Zanata
Classification: Community
Component: Component-UI (Show other bugs)
Unspecified Linux
urgent Severity medium
: ---
: 2.2
Assigned To: Patrick Huang
Ding-Yi Chen
Depends On:
  Show dependency treegraph
Reported: 2012-12-17 17:41 EST by Hedda Peters
Modified: 2013-11-26 22:35 EST (History)
3 users (show)

See Also:
Fixed In Version: 2.1-SNAPSHOT (20130108-1249)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-11-26 22:24:29 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Newline characters not obvious enough (136.70 KB, image/png)
2012-12-17 17:44 EST, Hedda Peters
no flags Details

  None (edit)
Description Hedda Peters 2012-12-17 17:41:20 EST
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0
Build Identifier: 

Newline characters (\n) within a msgid string are not obvious enough to translators. At the moment they are only represented by the grey numbers to the left of the msgid entry which are easily overlooked.

Reproducible: Always

Steps to Reproduce:
1. Open URL provided, row 457
2. Compare newline characters in msgid and msgstr
Actual Results:  
Newline characters (\n) are only represented by the grey numbers next to the msgid box.

Expected Results:  
Additionally display newline characters (\n) as such within the msgid.

Several translators (including myself) overlooked these "implied" newline characters, omitted them by accident and caused issues with the resulting translation being too long for the UI spot it was intended for... So this seems to be an issue for more people.
Comment 1 Hedda Peters 2012-12-17 17:44:21 EST
Created attachment 665161 [details]
Newline characters not obvious enough

I actually need to fix this error asap, so the URL provided will not show you a different number of newline characters in msgid and msgstr anymore. 

Screenshot attached though from before fixed translation.
Comment 2 Sean Flanigan 2012-12-20 22:20:29 EST
There seems to be no way of getting codemirror to show visible newline characters, so I think it's time we investigated the competition: http://ace.ajax.org/

ACE does support visible tabs, and visible newlines.

However, we will need to check on its Unicode support:

https://github.com/ajaxorg/ace/issues/1153 (a similar bug seems to be in codemirror)

https://github.com/ajaxorg/ace/issues/460 (codemirror seems to support variable width)
Comment 3 Patrick Huang 2013-01-01 18:26:45 EST
posted a question on code mirror group and the answer is, can't get it done completely with code mirror. 
to summary:
with code mirror, we can append a symbol at the end of each line (including last line which technically do not have newline character). It's not visible newline but more of an emphasis that the text flow is NOT wrapped but is broken up into lines. It serves the same purpose as line number on the left. Therefore not suitable to use the pilcrow character. This will be a quick fix.

Continue to investigate other editor
Comment 4 Patrick Huang 2013-01-07 19:46:02 EST
the other syntax highlighting editor - ACE editor does not integrate well with our code. Tried to integrate it myself and also tried to use https://github.com/daveho/AceGWT 
Can't get it to show.

Finally found a solution working in Code Mirror editor. It will display pilcrow for each line it encountered. 

For plain text area editor, at the moment it won't support visible newline. But in source text it will now display visible newline. Plus newly added validation rules to check line numbers. 

Since 2.1 CodeMirror editor under firefox should also support spell check. One less reason to choose plain text area editor :)
Comment 5 Hedda Peters 2013-01-07 19:47:37 EST
Sounds promising :-) Thanks for all the effort.
Comment 6 Patrick Huang 2013-01-07 19:54:16 EST
committed into master:
Comment 7 Ding-Yi Chen 2013-01-08 00:02:09 EST
VERIFIED with Zanata version 2.1-SNAPSHOT (20130108-1249)
Comment 8 Sean Flanigan 2013-01-08 00:48:23 EST
Great work, Patrick!

You should mention the solution you found to the CodeMirror group: https://groups.google.com/forum/?fromgroups=#!topic/codemirror/tab01KLV3DU

(And perhaps someone there can suggest a way of avoiding the slight gap before the pilchard, er, pilcrow, which is seen on empty lines.)
Comment 9 Hedda Peters 2013-02-12 23:23:51 EST
The implemented solution seems to work somewhat, sometimes, but there are several issues:

I encountered some weird behaviour when playing around with one string that already contained this syntax error. Opening the string in the editor does not seem  to trigger the validation warning, typing normal characters doesn't seem to trigger it either. (see screenshot 1)

Only when I entered another line break character into the translation the validation warning appears. But then the warning is somewhat unexpected (see screenshot 2) The msgid contains 3 lines, the translation contains 2 lines - yet the warning tells me that the translation contains too many lines. 

Occasionally by clicking in and out of this particular string, the msgid disappears and shows only an empty box, with two scroll bars at the right hand side. Not sure if that's related, or how exactly to reproduce. (screenshot 3)

All this only works with CodeMirror enabled, the newline characters are not displayed when CodeMirror is not selected - is that expected?
Comment 16 Sean Flanigan 2013-11-26 22:14:51 EST
Closing VERIFIED bugs for Zanata versions <= 3.1.
Comment 17 Sean Flanigan 2013-11-26 22:16:30 EST
Closing VERIFIED bugs for Zanata versions <= 3.1.
Comment 18 Sean Flanigan 2013-11-26 22:18:18 EST
Closing VERIFIED bugs for Zanata versions <= 3.1.
Comment 19 Sean Flanigan 2013-11-26 22:24:29 EST
Closing VERIFIED bugs for Zanata versions <= 3.1.
Comment 20 Sean Flanigan 2013-11-26 22:33:00 EST
Closing VERIFIED bugs for Zanata versions <= 3.1.
Comment 21 Sean Flanigan 2013-11-26 22:35:15 EST
Closing VERIFIED bugs for Zanata versions <= 3.1.

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