TranslationsParent.isSupportedAsToLang checks the wrong language
Categories
(Firefox :: Translations, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr115 | --- | unaffected |
firefox126 | --- | wontfix |
firefox127 | --- | wontfix |
firefox128 | --- | fixed |
People
(Reporter: nordzilla, Assigned: nordzilla)
References
(Regression)
Details
(Keywords: regression)
Attachments
(2 files)
Description
When testing the localized versions of the SelectTranslationsPanel, I noticed that languages for which we only offer translations as a source language were being offered as a target language. At the time of writing, this occurred with Finnish, which we currently only support as a source language.
This leads to an error state when the panel opens, since Finnish cannot be found as a valid target language (see attached screenshot).
This is caused by an unfortunate typo that I made, where the isSupportedAsToLang() function checks the fromLang
value instead of the toLang
value.
Thankfully, the SelectTranslationsPanel is currently the only consumer of this function call, and this fix should not require any uplifting because it will be corrected before the SelectTranslationsPanel release.
Steps to reproduce
- Download the Finnish version of Firefox Nightly.
- Open the Finnish nightly and navigate to a non-Finnish page in a translatable language, e.g. https://es.wikipedia.org.
- Select some text and open the right-click context menu.
Expected Behavior
Translation to Finnish should not be offered as it is not yet supported as a target language.
Actual Behavior
Translation to Finnish is offered, and when clicked, it leads to a panel error state with a blank to-language selection.
Comment 1•9 months ago
|
||
Set release status flags based on info from the regressing bug 1870327
Assignee | ||
Comment 2•9 months ago
|
||
The TranslationsParent.isSupportedAsToLang() function was
unintentionally checking the list of from-languages.
This patch fixes the function to check the correct languages.
Updated•9 months ago
|
Assignee | ||
Updated•9 months ago
|
Comment 3•9 months ago
|
||
Erik, can you request uplift to beta if you feel it is not too risky? Thanks!
Assignee | ||
Comment 4•9 months ago
•
|
||
Hey Liz,
I don't think this needs to be uplifted.
At the time of writing, the only consumer of this code currently is the SelectTranslationsPanel
feature, which is preffed off for the Firefox 127 release build, and is targeted for release in Firefox 128.
Searchfox Regex Query: (isSupportedAsToLang|GetTopPreferredSupportedToLang)
Core code (5 lines across 2 files)
Textual Occurrences (5 lines across 2 files)
browser/components/translations/content/selectTranslationsPanel.js
330 TranslationsParent.getTopPreferredSupportedToLang(),
366 : await TranslationsParent.isSupportedAsToLang(langTag);
toolkit/components/translations/actors/TranslationsParent.sys.mjs
2234 static async isSupportedAsToLang(langTag) {
2246 static async getTopPreferredSupportedToLang() {
2248 async langTag => await TranslationsParent.isSupportedAsToLang(langTag)
The defect is technically present in Firefox 126 and 127, but nothing is using this API surface.
That being said, this is a very low-risk change and I can uplift it if still desired.
Comment 7•9 months ago
|
||
bugherder |
Updated•8 months ago
|
Description
•