You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
538 B
20 lines
538 B
|
|
// cross-browser connection to extension i18n API
|
|
|
|
const chrome = chrome || null
|
|
const browser = browser || null
|
|
let getMessage = null
|
|
|
|
if ((chrome && chrome.i18n && chrome.i18n.getMessage) ||
|
|
(browser && browser.i18n && browser.i18n.getMessage)) {
|
|
getMessage = (chrome || browser).i18n.getMessage
|
|
} else {
|
|
// fallback function
|
|
console.warn('browser.i18n API not available?')
|
|
let msg = require('../app/_locales/en/messages.json')
|
|
getMessage = function (key) {
|
|
return msg[key].message
|
|
}
|
|
}
|
|
|
|
module.exports = getMessage
|
|
|