Firefox translation fails to translate website that declares the wrong language
Categories
(Firefox :: Translations, defect)
Tracking
()
People
(Reporter: danweiss, Unassigned)
References
Details
I encountered an issue with the Firefox translation feature on this website:
https://learn.microsoft.com/en-us/archive/blogs/technet/itasupport/sendsas-step-by-step
The language on the page is Italian, but the <html>, <body>, and <main> elements all contain the attribute lang="en-us" Because of this, the Firefox translation feature skips over those elements, believing the text is not in Italian.
If I use the Inspector (F12), search for lang="en-us", then manually edit every element to change the attribute into lang="it-it", then the translation feature will successfully translate the page from Italian into English.
Steps to reproduce:
- Load the page https://learn.microsoft.com/en-us/archive/blogs/technet/itasupport/sendsas-step-by-step
- Press Menu button -> Translate page...
- Select "Italian" to "English" and click Translate
Should happen:
- Page should be translated from Italian to English
Actually happens:
- Page remains in Italian
Workaround:
- Load the page
- Press F12 to open dev tools, and pick the Inspector tab
- In "Search HTML", look for
lang="en-us" - Double click on
"en-us"on the<html>tag, replace it with"it-it" - Next result
- Double click on
"en-us"on the<body>tag, replace it with"it-it" - Next result
- Double click on
"en-us"on the<main>tag, replace it with"it-it" - Press F12 to close dev tools
- Press Menu button -> Translate page
- Select "Italian" to "English" and click Translate
- Page now translates from Italian to English
Comment 1•7 months ago
•
|
||
Hi Dan, thank you for filing this bug.
At the time of writing, the current behavior is expected in Firefox, so this isn't necessarily a defect as filed.
The website itself is configured incorrectly: a node with text content that is truly in Italian should not have a lang="en-us" attribute on it. Right now Firefox is configured to trust those lang attributes since they are placed on nodes explicitly by the website author.
However, I do think that we could probably improve upon this, and change the expected behavior in Firefox to double check with the language detector. As such, I've filed Bug 2026738, which I will now mark this bug as a duplicate of.
I've filed Bug 2026738 as a "Good First Bug" and assigned myself as a mentor. It should be a fairly self-contained improvement for a new contributor. If you are a developer, then you are more than welcome to try it out yourself.
Thanks again!
Description
•