blob: 0f4e9fce479a67b2b51e8180a6b0c4e3f88fdf0b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// 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
|