Red Hat Bugzilla – Bug 888055
Newline characters in text flows not obvious enough for translators
Last modified: 2013-11-26 22:35:15 EST
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0
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.
Steps to Reproduce:
1. Open URL provided, row 457
2. Compare newline characters in msgid and msgstr
Newline characters (\n) are only represented by the grey numbers next to the msgid box.
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.
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.
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)
posted a question on code mirror group and the answer is, can't get it done completely with code mirror.
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
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 :)
Sounds promising :-) Thanks for all the effort.
committed into master:
VERIFIED with Zanata version 2.1-SNAPSHOT (20130108-1249)
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.)
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?
Closing VERIFIED bugs for Zanata versions <= 3.1.