i18n.getAcceptLanguages()
Gets theaccept-languages of the browser. This is different from the locale used by the browser. To get the locale, usei18n.getUILanguage
.
This is an asynchronous function that returns aPromise
.
See theInternationalization page for a guide on using this function.
Syntax
js
let gettingAcceptLanguages = browser.i18n.getAcceptLanguages()
Parameters
None.
Return value
APromise
that will be fulfilled with anarray
ofi18n.LanguageCode
objects.
Examples
js
function onGot(languages) { console.log(languages); // e.g. Array [ "en-US", "en" ]}let gettingAcceptLanguages = browser.i18n.getAcceptLanguages();gettingAcceptLanguages.then(onGot);
Browser compatibility
Note:This API is based on Chromium'schrome.i18n
API. This documentation is derived fromi18n.json
in the Chromium code.