Inline paragraphs are not translated by Bergamot when they're the minority
Categories
(Firefox :: Translations, defect, P3)
Tracking
()
People
(Reporter: cvqvxrdvfg, Unassigned)
References
Details
Steps to reproduce:
Translate https://baginett.blogspot.com/2023/05/18280-24-2023.html from Russian to English.
Actual results:
Most of the paragraphs get translated, because most are wrapped in a <p> tag.
However some paragraphs such as 'А вот и прижизненные фото СРК "Иван Хурс".' are not wrapped in a <p> and therefore remain untranslated.
The parent element of both kinds of paragraph is a <div> where Bergamot sets x-bergamot-translated="skipped does-not-have-text-of-its-own", because there are more <p> tags than bare text nodes.
Expected results:
All text nodes should have been translated.
I took a look at InPageTranslation.js and my understanding is that when processing the big <div> node:
- hasInlineContent(node) returns false when inlineElements < blockElements.
- Therefore in that case validateNode() returns NodeFilter.FILTER_SKIP and sets "does-not-have-text-of-its-own".
- Therefore the tree walker gets called, and it seems that when this is the case bare text nodes fail to get translated.
I'm not sure if step 1 or step 3 is to blame, but the end result is that if the <div> has both inline and block elements then inline elements will only be translated if they're not in the minority.
Minimal testcase, to be translated from English to any language:
<div>
Inline paragraph won't be translated unless you remove a block paragraph or add another inline element at the end of the div.
<p>Block paragraph will always be translated.</p>
<p>Block paragraph will always be translated.</p>
</div>
Reporter | ||
Updated•2 years ago
|
Comment 1•2 years ago
|
||
I think this report is for the addon, but it will most likely reproduce in Firefox's port of the code. This would be fixed by Bug 1837424. I haven't verified the behavior since it seems like a reasonable thing to be happening given the implementation.
This will be a good test case to verify after Bug 1837424 is fixed.
Comment 2•2 years ago
|
||
I've reproduced this issue in the latest Nightly 118.0a1 version on Windows 10 x64.
Setting as NEW.
Comment 3•1 year ago
|
||
I don't reproduce in Nightly anymore, and the specific case I have as a test in Bug 1837424, which fixes the underlying issue here.
Description
•