Closed Bug 1712214 Opened 3 years ago Closed 2 years ago

i18n.detectLanguage does not work


(WebExtensions :: Android, defect, P3)



(firefox-esr91 unaffected, firefox-esr102 unaffected, firefox104 wontfix, firefox105 wontfix, firefox106 fixed)

106 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- unaffected
firefox104 --- wontfix
firefox105 --- wontfix
firefox106 --- fixed


(Reporter: kbrosnan, Unassigned)




(Keywords: dev-doc-complete, regression)

From github:

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.

Rob, how important is this issue to be fixed soon?

Severity: -- → S3
Flags: needinfo?(rob)
Priority: -- → P3

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:

The API fails because LanguageDetector.jsm only exists on desktop at

Flags: needinfo?(rob)
Regressed by: 1357902
Has Regression Range: --- → yes
Depends on: 1764698

John, your patch at bug 1764698 has landed. Could you now remove the skip-if = os == "android" at ?

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.

Flags: needinfo?(john)

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:

Did something go wrong?

Flags: needinfo?(john)

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 -

Closed: 2 years ago
Component: Extensions → Android
Product: GeckoView → WebExtensions
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch

FYI only.
BCD fix in , so changed state to dev-doc-complete (just ran into this while doing release prep).

You need to log in before you can comment on or make changes to this bug.