Closed Bug 1903044 Opened 6 months ago Closed 6 months ago

SelectTranslationsPanel languageInfo cache is not correctly load selecting a word very similar to English

Categories

(Firefox :: Translations, defect)

defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox128 --- affected
firefox129 --- affected

People

(Reporter: zstimi, Unassigned)

References

Details

Attachments

(1 file)

Attached image translate.png

Found in

  • Firefox 128.0b3

Affected versions

  • Firefox 128.0b3
  • Firefox 129.0a1

Tested platforms

  • Affected platforms: Windows 10, Ubuntu 22, macOS 12

Steps to reproduce

  1. Ensure Select Translations is enabled.
    browser.translations.select.enable = TRUE
  2. Load a webpage that is displayed in a different language than the browser's (and supported).
    https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Accueil_principal
  3. Select a very similar word to English
  4. Left-click on the "Translate selection to <<browser language>>" button.

Expected result

  • The SelectTranslationsPanel opens and translates from French, based on the current document's language tag, and the "Translate full page" button have to be in active state.

Actual result

  • The SelectTranslationsPanel opens and translates from the recognized word language (English in this STR) and the "Translate full page" button is inactive.

Additional notes

  • Tested with telemetry, found fromLanguage: "en" insted fromLanguage: "fr" message without choosing/changing the language from the dropdown.
    See the issue in the attached screenshot: translate.png
See Also: → 1903087

Hi Timea, thanks for filing this!

There are a few things to unpack here. Firstly, this exact STR that you described is not a defect and is expected behavior. Secondly, when investigating this, I did discover a different defect with the languageInfo cache.


The expected behavior for this case

In the STR that you described, the unfortunate reality is that "La construction" is detected by our language detector as English, likely due to the French/English cognate "construction" which is spelled the same in both languages.

When we have a case where our language detector gets something different than the page language and both the detected language and page language are supported languages for translation, then we have no choice but to go with the detected language, which is English in this case.

If we did not do this, instead always trusting the page language, then dictionary websites like https://spanishdict.com, which show ample Spanish content but are, themselves, in English as a page language, would try to translate from English all the time even if you clearly selected a Spanish paragraph.

The case with "La construction" is just an unfortunate scenario where we have to trust the false positive in this case, and the behavior may improve when we improve our language detection algorithm in the future.


The actual defect with the language info cache

While investigating this, I did notice an actual issue with the language info cache: The detected document language tag is still not correctly being updated between panel opens.

I've filed a bug for it: Bug 1903087


Conclusion

I am marking this bug as invalid, as the "Actual result" behavior described here is the expected behavior in this case.

But I have filed Bug 1903087 for the other defect that I discovered while looking into this.

Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: