'Using i18n.detectLanguage() in Vue
I was reading Moxilla documentation and found the function i18n.detectLanguage(). The document states that it can be used in the following way:
var detectingLanguages = browser.i18n.detectLanguage(
text // string
)
However, when I try to use the code above in my Vue application I just get variable not defined on browser
.
How can I use the builtin i18n API which should be supported in all browsers except Safari?
Solution 1:[1]
The API is only available in browser extensions, not for scripts on the page.
You can see that in the breadcrumbs of the page:
Mozilla > Add-ons > Browser Extensions > JavaScript APIs > i18n > i18n.detectLanguage()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
And also the URL:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/i18n/detectLanguage
^^^^^^^^^^^^^^^^^^^^^
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | VLAZ |