summaryrefslogtreecommitdiff
path: root/browser/devtools/profiler/ProfilerHelpers.jsm
blob: cfd03ba18b67fa688c767be86efc1e4f72ce5b56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

const Cu = Components.utils;
const ProfilerProps = "chrome://browser/locale/devtools/profiler.properties";

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");

this.EXPORTED_SYMBOLS = ["L10N"];

/**
 * Localization helper methods.
 */
let L10N = {
  /**
   * Returns a simple localized string.
   *
   * @param string name
   * @return string
   */
  getStr: function L10N_getStr(name) {
    return this.stringBundle.GetStringFromName(name);
  },

  /**
   * Returns formatted localized string.
   *
   * @param string name
   * @param array params
   * @return string
   */
  getFormatStr: function L10N_getFormatStr(name, params) {
    return this.stringBundle.formatStringFromName(name, params, params.length);
  }
};

XPCOMUtils.defineLazyGetter(L10N, "stringBundle", function () {
  return Services.strings.createBundle(ProfilerProps);
});