Closed Bug 1015535 Opened 7 years ago Closed 7 years ago

Comment nodes shouldn't be considered for translation

Categories

(Firefox :: Translation, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
Firefox 32

People

(Reporter: Felipe, Assigned: Felipe)

References

Details

(Whiteboard: [translation] p=1 s=it-32c-31a-30b.2 [qa-])

Attachments

(1 file)

Comment nodes are nsGenericDOMDataNodes with textual content, so they were returning true for HasTextForTranslation, but that should be obviously false. (More generally, any non-text node).

This was not causing any problems in the translation itself, and they are already replaced with placeholders in a later step of the process. However, it causes otherwise-empty nodes to be unnecessarily considered for translation. E.g:

<div><!-- Comment --></div>

Which would be sent to the translation service as "<div><br></div>", while it doesn't need to be sent at all.
Attachment #8428193 - Flags: review?(bugs)
Flags: firefox-backlog+
Comment on attachment 8428193 [details] [diff] [review]
Comment nodes shouldn't be considered for translation

Hmm, this is a bit too strict.
CDATA nodes are filtered out.
So

CDATA_SECTION_NODE
if (NodeType() != nsIDOMNode::TEXT_NODE && NodeType() != nsIDOMNode::CDATA_SECTION_NOD) {
Attachment #8428193 - Flags: review?(bugs) → review+
Marco, please add this bug to the current iteration
Whiteboard: [translation] p=1 [qa-]
Flags: needinfo?(mmucci)
Added to Iteration 32.2
Flags: needinfo?(mmucci)
Whiteboard: [translation] p=1 [qa-] → [translation] p=1 s=it-32c-31a-30b.2 [qa-]
https://hg.mozilla.org/mozilla-central/rev/a311f34398c2
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 32
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.