aboutsummaryrefslogtreecommitdiffstats
path: root/ui/i18n.js
blob: c2cf9b44991c6b49f274ca59fd3e2773d5263f61 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

// cross-browser connection to extension i18n API

var getMessage;

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;