utils.js (815B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 /** 7 * The default localization just returns the last part of the key 8 * (all after the last dot). 9 */ 10 const DefaultL10N = { 11 getStr(key) { 12 const index = key.lastIndexOf("."); 13 return key.substr(index + 1); 14 }, 15 }; 16 17 /** 18 * The 'l10n' object is set by main.js in case the DOM panel content 19 * runs within a scope with chrome privileges. 20 * 21 * Note that DOM panel content can also run within a scope with no chrome 22 * privileges, e.g. in an iframe with type 'content' or in a browser tab, 23 * which allows using our own tools for development. 24 */ 25 exports.l10n = window.l10n || DefaultL10N;