Closed
Bug 1288263
Opened 9 years ago
Closed 8 years ago
If chrome.tabs.detectLanguage can't detect the language, Firefox reports "un" while Chrome reports "und"
Categories
(WebExtensions :: General, defect, P2)
WebExtensions
General
Tracking
(firefox51 fixed)
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: wbamberg, Assigned: zombie)
Details
(Whiteboard: compat, triaged)
Attachments
(2 files)
chrome.tabs.detectLanguage is supposed to detect the language of the content in a tab, and pass the language code into a callback.
According to the docs[1], if the language can't be detected, "und" should be passed to the callback (it seems that "und" is actually a special value for "Undetermined"[2]).
Firefox passes "un" in this situation.
I've attached a WebExtension you can use to verify this.
[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/detectLanguage
[2] https://www.loc.gov/standards/iso639-2/php/code_list.php
Reporter | ||
Updated•9 years ago
|
Summary: If chrome.tabs.detectLanguage can't detect the language, Firefox reports "un" while Chrome passes "und" → If chrome.tabs.detectLanguage can't detect the language, Firefox reports "un" while Chrome reports "und"
Updated•8 years ago
|
Priority: -- → P2
Whiteboard: compat, triaged
Assignee | ||
Comment 1•8 years ago
|
||
It looks this is just a simple nomenclature mismatch: "un" was an non-official two-letter language code, that only later got standardized as "und" three-letter ISO 639-2 [1] code, which Chrome responds with, even if they use "un" internally [2], just like we do [3].
A simple replace seems enough for compatibility.
[1] https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes
[2] https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc
[3] http://searchfox.org/mozilla-central/source/browser/components/translation/LanguageDetector.jsm#134
Assignee: nobody → tomica
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Comment 3•8 years ago
|
||
mozreview-review |
Comment on attachment 8790044 [details]
bug 1288263 - tabs.detectLanguage() returns "und" for undetermined,
https://reviewboard.mozilla.org/r/78034/#review76482
This looks good, but we should probably do the same thing for i18n.detectLanguage.
Attachment #8790044 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 4•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8790044 [details]
bug 1288263 - tabs.detectLanguage() returns "und" for undetermined,
https://reviewboard.mozilla.org/r/78034/#review76482
`i18n.detectLanguage` never returns "un". it indicates weather the detection `isReliable`, and the array of `languages` found, which is simply empty in the case where `tabs.detectLanguage` would return "und".
Assignee | ||
Updated•8 years ago
|
Attachment #8790044 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 5•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8790044 [details]
bug 1288263 - tabs.detectLanguage() returns "und" for undetermined,
https://reviewboard.mozilla.org/r/78034/#review76482
http://searchfox.org/mozilla-central/source/toolkit/components/extensions/ExtensionUtils.jsm#1421
Comment 6•8 years ago
|
||
mozreview-review |
Comment on attachment 8790044 [details]
bug 1288263 - tabs.detectLanguage() returns "und" for undetermined,
https://reviewboard.mozilla.org/r/78034/#review76680
Attachment #8790044 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Pushed by kwierso@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/e4e5156020e8
tabs.detectLanguage() returns "und" for undetermined, r=kmag
Keywords: checkin-needed
Comment 8•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox51:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Comment 9•8 years ago
|
||
Thanks for the fix--I've added it here: https://wiki.mozilla.org/Add-ons/Contribute/Recognition#September_2016
Updated•7 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•