Run language detection on node subtrees that have a lang attribute
Categories
(Firefox :: Translations, enhancement)
Tracking
()
People
(Reporter: nordzilla, Unassigned, Mentored)
References
Details
(Keywords: good-first-bug)
Attachments
(1 file, 2 external files)
|
716 bytes,
text/html
|
Details |
Description
In Bug 2025131, a user reported an issue that https://learn.microsoft.com/en-us/archive/blogs/technet/itasupport/sendsas-step-by-step contains Italian text within DOM nodes that declare the attribute lang=en-us.
While this is currently expected behavior in Firefox to trust the lang attribute (the website itself is configured incorrectly), perhaps we could do a better job of running our language detector on nodes that have these attributes to get a second opinion.
We already do some double checking if the lang attribute is on the top-level <html> tag. We likely could extend this to check other nodes more specifically.
I think this would be a great first bug for a new contributor, so I am marking it as such. I am happy to mentor anyone who would like to give this a try.
Expectations
When we open a web page in Firefox, we determine the language of the entire page.
As we parse through the document to find translatable nodes, we may encounter a specific node that has a lang attribute on it.
We should update Firefox to perform the following logic:
- Does the node's lang tag match the document's lang tag? If so, go ahead and translate it. (We already do this).
- Does the node's lang tag differ from the document's lang tag? If so, run the language detector on the node's text content.
2a. Does the detected language match the node's lang tag? If so, skip this node.
2b. Does the detected language match the document's lang tag? If so, queue this node to be translated.
There are a few other aspects that we should consider with regard to the length of the node's text content. The shorter the text is, the less accurate the language detector's results are. So we won't always be able to fully trust the language detector if the node itself has only a single word.
I haven't decided how we want to handle this yet, but we can work out the details when a contributor takes this bug.
Note: I've attached a simple HTML test page that reproduces the same issue, in case the originally reported Microsoft link above gets fixed.
Hi, Erik!
I like to solve this one, Can you please guide me, so that we can start working on it.
Thank You!
Comment 3•7 months ago
|
||
Hi Erik,
I would like to work on this bug if it's available. I'm familiar with this bug
| Reporter | ||
Comment 4•7 months ago
•
|
||
Hi,
Yes, any new contributor is welcome to work on this.
I didn't expect to get so much activity all at once. I can only review an accept one patch to land.
ROSHAAN, I've written a fairly detailed "Expectations" section in the main comment. Did you have any specific questions?
Pranjali, it seems that you expressed interest in a different "Good First Bug" that I filed. You're welcome to look at this one, but it would be best to only look at one at a time.
Comment 5•7 months ago
|
||
I agree, first I’ll continue with the one I initially picked and come back to this one later if it’s still available.
Really appreciate the guidance
Comment 7•2 months ago
|
||
Hey Erik,
I'm a new contributor, and I'll be submitting a patch for this soon.
Comment 8•2 months ago
|
||
Comment 9•2 months ago
|
||
Updated•2 months ago
|
Comment 10•16 days ago
|
||
This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit BugBot documentation.
Description
•