Use the i18n browser API to get the current browser language.
For Mozilla go here :
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n
The namespace for Firefox is browser.i18n and for chrome is chrome.i18n
Functions are same in both browsers as far as I know, but the namespace name has to taken care of.