i18n.detectLanguage does not work
Categories
(WebExtensions :: Android, defect, P3)
Tracking
(firefox-esr91 unaffected, firefox-esr102 unaffected, firefox104 wontfix, firefox105 wontfix, firefox106 fixed)
Tracking | Status | |
---|---|---|
firefox-esr91 | --- | unaffected |
firefox-esr102 | --- | unaffected |
firefox104 | --- | wontfix |
firefox105 | --- | wontfix |
firefox106 | --- | fixed |
People
(Reporter: kbrosnan, Unassigned)
References
(Regression)
Details
(Keywords: dev-doc-complete, regression)
From github: https://github.com/mozilla-mobile/fenix/issues/18633.
Steps to reproduce
Call the function browser.i18n.detectLanguage
Example:browser.i18n.detectLanguage("Hello", r => console.log(r))
Expected behavior
...
Actual behavior
This error is generated
[Exception... "File error: Not found" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: chrome://extensions/content/parent/ext-i18n.js :: detectLanguage :: line 34" data: no]
Device information
- Device vendor / model and Android version: Moto g7 play Android 10
- Firefox for Android version: Nightly 210324
This problem has been occurring for more than 1 year.
Change performed by the Move to Bugzilla add-on.
Comment 1•4 years ago
|
||
Rob, how important is this issue to be fixed soon?
Comment 2•4 years ago
|
||
This API has been broken since Firefox 56 without any previous reports. It would be nice to fix, but not urgent.
The relevant unit test was disabled in: https://hg.mozilla.org/mozilla-central/rev/1955c9d37186#l11.5
The API fails because LanguageDetector.jsm
only exists on desktop at https://searchfox.org/mozilla-central/rev/2b372b94ce057097a6ef8eb725f209faa9d1dc4d/browser/components/translation/LanguageDetector.jsm
Updated•4 years ago
|
Comment 3•2 years ago
|
||
John, your patch at bug 1764698 has landed. Could you now remove the skip-if = os == "android"
at https://searchfox.org/mozilla-central/rev/d01591796d5faccf762adb09a311d8ee12f7ca7f/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini#2 ?
PS. I just updated Nightly to check whether i18n.detectLanguage
is supported, but the build version seems too old. I expect the feature to work after an update tomorrow.
Comment 4•2 years ago
|
||
Hm. Since I was able to test this on the Android Emulator, I removed the skip before landing the patch (it was reviewed and approved). I do not see a skip for android here:
https://searchfox.org/mozilla-central/source/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini#2
Did something go wrong?
Comment 5•2 years ago
|
||
I have verified on Firefox Nightly for Android, 106.0a1 (Build #2015901675) that the i18n.detectLanguage
method works. I did so by opening about:debugging
on desktop Firefox Nightly, connecting it with the phone and running the following snippet in the background page of one of the built-in add-ons (WebCompat Reporter).
(await browser.i18n.detectLanguage("Bonjour")).languages;
// result: [{"language":"fr","percentage":88}]"
For documentation purposes, we should update BCD to note that in Firefox for Android, i18n.detectLanguage
is only supported since version 106. The method existed in previous versions, but did not do anything meaningful (it rejected with an error).
The current BCD incorrectly asserts that the method is supported on Android since 48 - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/detectLanguage#browser_compatibility
Updated•2 years ago
|
Comment 6•2 years ago
|
||
FYI only.
BCD fix in https://github.com/mdn/browser-compat-data/pull/18096 , so changed state to dev-doc-complete (just ran into this while doing release prep).
Description
•