diff options
Diffstat (limited to 'ui/i18n.js')
-rw-r--r-- | ui/i18n.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/i18n.js b/ui/i18n.js new file mode 100644 index 000000000..e842c9ef9 --- /dev/null +++ b/ui/i18n.js @@ -0,0 +1,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; |