color in gtxml

Bug #924979 reported by Daniel Mustieles
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyG3T
Fix Committed
Undecided
Ask Hjorth Larsen

Bug Description

it would be greatful if gtxml could highlight mismatched tags with, for example, a red color.

Some strings have several tags, and sometimes there are 1-character differences between the original and the translated tag, so it's difficult to see where is the typo. Hightlighting the mismatched tag in the translated string could help translator to see and fix it quickly.

I hope you agree with this idea :)

Cheers

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

I think this is possible if I parse the error message from the xml parser and grab the info on where in the string the error is. Then the surrounding characters can be highlighted.

Changed in pyg3t:
assignee: nobody → Ask Hjorth Larsen (askhl)
status: New → In Progress
Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

The -c or --color option now highlights the surrounding characters with bright red. A similar option has not yet been added to poabc, but would probably be a nice feature there as well.

Changed in pyg3t:
status: In Progress → Fix Committed
Revision history for this message
Daniel Mustieles (daniel-mustieles) wrote :

Many thanks for implementing it, but I've seen one bug and one possible improve to it.

The bug is, in the same string are several errors, in different tags, only the first error is highlighted. I think it should highlight all the erros found in the same string, not just the first one.

Also, the script bases in character counting/positioning, so tags are partially highlighted. Well, it isn't a ver big problem, since hightlighting errors is a big step, but it would be great if you could highlight the hole mismatched tag.

Just an example to ilustrate both cases:

msgid ""
"Some elements in <app>Accerciser</app> may enable certain functionalities via"
" hotkeys. An example is the <link xref=\"quick_select_plugin\">Quick Select "
"Plugin</link>. The hotkey combination for each functionality can be changed "
"via the Preferences dialog, under the \"Global Hotkeys\" tab. Under this tab,"
" you will find a list of all features for which hotkeys can be configured. "
"Use the <cmd>ctrl</cmd>, <cmd>alt</cmd>, and <cmd>shift</cmd> checkboxes to "
"enable or disable these modifiers."

msgstr ""
"Algunos elementos en <app>Accerciser</aBUG> puede activar ciertas "
"funcionalidades mediante teclas rápidas. Un ejemplo es el <link "
"xref=\"quick_select_plugin\">complemento de selección rápida</link>. La "
"combinación de teclas rápidas para cada funcionalidad se puede cambiar en "
"el diálogo de preferencias, en la pestaña «Teclas rápidas globales». En "
"esta pestaña encontrará una lista de todas las características para las "
"que se pueden configurar las teclas rápidas. Use las casillas "
"<cmd>Ctrl</cmd>, <cmd>Alt</cmd>, y <cmd>Mayús</cBUG> para activar o "
"desactivar estos modificadores."

Note the first and the last one tags, marked with «BUG». The output of gtxml -c pofile.po highlights the substring «r</aBUG» in the first tag, and nothing in the last one. I think it should be highlight the substring «</aBUG>» in both cases.

I've tried to fix it, but I'm not a developer, so I've not been able to help you fixing it :(

BTW, may thanks for you effort attending this bug so quickly :)

Revision history for this message
Ask Hjorth Larsen (askhl) wrote :

Once a string is bad xml, it is not necessarily easy to figure out if there is more than one error. All the computer knows is that </aBUG> isn't preceded by <aBUG> anywhere. Should the computer now assume that </aBUG> was supposed to close the most recently opened tag, or should it completely disregard </aBUG>? Depending on this assumption, subsequent tags could be either correct or wrong, and this could lead to very confusing error messages.

Practically speaking, the easiest is to fix whichever errors are found, then rerun gtxml until there are no more errors (having more than 1 or 2 xml errors in the same string is probably not so usual in any case).

PS. other suggestions are very welcome.

Revision history for this message
Daniel Mustieles (daniel-mustieles) wrote :

I agree with you it is a not usual case, so we can forget about it.

About highlighting the hole tag, if it is tecnically possible, and it isn't very hard to do it, it would be great, but if it's too mucho complicated, just having 3-4 characters highlighted is enought to identify where the bug is.

If I can help you anyway, please let me know :)

Thanks again

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.