Closed Bug 1902711 Opened 5 months ago Closed 5 months ago

TranslationsParent.getTopPreferredSupportedToLang returns false positives

Categories

(Firefox :: Translations, defect, P2)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
129 Branch
Tracking Status
firefox-esr115 --- disabled
firefox127 --- disabled
firefox128 --- verified
firefox129 --- verified

People

(Reporter: nordzilla, Assigned: nordzilla)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

Description

When I landed the TranslationsParent.getTopPreferredSupportedToLang() function, I did not sufficiently test all edge cases. I recently discovered that this function is capable of returning a false positive.

It always returns the first language in the preferred languages list, regardless of its supported status.

This works out for languages that we support, but for a language such as Finnish, which, at the time of writing, is only supported as a source language and not a target language, this will return a false positive.


Steps to reproduce

  • Download Firefox Nightly in a language that is not supported as a translations target language, e.g. Finnish at the time of writing.
  • Navigate to a web page, e.g. https://es.wikipedia.org.
  • Select some text.
  • Open the right-click context menu.

Expected Behavior
The context menu offers to translate the text to English since the app locale language is not supported as a translations target.

Actual Behavior
The context menu offers to translate the text to the app locale language, even though it is not supported.


Steps to implement


Tests to implement

  • Add tests for this function in various supported/unsupported app locales.

Fixes the TranslationsParent.getTopPreferredSupportedToLang()
function to no longer return false positives if the top
language is not supported as a translations target language.

Adds several test cases to test the SelectTranslations
context-menu offering with various locale and web content
languages.

Depends on D213808

Attachment #9407639 - Attachment description: Bug 1902711 - Add multi-locale context menu tests r=#translations-reviewers! → Bug 1902711 - Add multi-locale context menu tests r=#translations-reviewers!,ohall
Blocks: 1902859

Comment on attachment 9407639 [details]
Bug 1902711 - Add multi-locale context menu tests r=#translations-reviewers!,ohall

Revision D213844 was moved to bug 1902859. Setting attachment 9407639 [details] to obsolete.

Attachment #9407639 - Attachment is obsolete: true
Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a047490b0519 Fix TranslationsParent.getTopPreferredSupportedToLang() r=ohall,translations-reviewers
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch

Fixes the TranslationsParent.getTopPreferredSupportedToLang()
function to no longer return false positives if the top
language is not supported as a translations target language.

Original Revision: https://phabricator.services.mozilla.com/D213808

Attachment #9407742 - Flags: approval-mozilla-beta?
See Also: → 1903092
Attachment #9407742 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: in-testsuite+

I can reproduce this issue in Nightly v129.0a1 (2024-06-15) (FI locale, Suomi) and verify the fix in Nightly v129.0a1 (2024-06-20) (FI locale, Suomi) and Beta v128.0b5 (FI locale, Suomi language). When attempting to translate a supported language, the target language is English by default since Suomi is not supported as a target language. This was tested in Windows 10, MacOS11 and Ubuntu22.

Status: RESOLVED → VERIFIED
Flags: needinfo?(enordin)
OS: Unspecified → All
Hardware: Unspecified → Desktop
Flags: needinfo?(enordin)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: