TranslationsParent.getTopPreferredSupportedToLang returns false positives
Categories
(Firefox :: Translations, defect, P2)
Tracking
()
People
(Reporter: nordzilla, Assigned: nordzilla)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files, 1 obsolete file)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-beta+
|
Details | Review |
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
- Fix the TranslationsParent.getTopPreferredSupportedToLang() to properly await functions that it calls.
Tests to implement
- Add tests for this function in various supported/unsupported app locales.
Assignee | ||
Comment 1•5 months ago
|
||
Fixes the TranslationsParent.getTopPreferredSupportedToLang()
function to no longer return false positives if the top
language is not supported as a translations target language.
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Comment 2•5 months ago
|
||
Adds several test cases to test the SelectTranslations
context-menu offering with various locale and web content
languages.
Depends on D213808
Updated•5 months ago
|
Comment 3•5 months ago
|
||
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.
Comment 5•5 months ago
|
||
bugherder |
Assignee | ||
Comment 6•5 months ago
|
||
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
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Updated•5 months ago
|
Comment 8•5 months ago
|
||
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.
Assignee | ||
Updated•5 months ago
|
Description
•