mozilla

Revision 235769 of Template:MDN:Common

  • Revision slug: Template:MDN:Common
  • Revision title: Template:MDN:Common
  • Revision id: 235769
  • Created:
  • Creator: lmorchard
  • Is current revision? No
  • Comment

Revision Content

<% module.exports = { /** * Given a set of strings like this: * { "en-US": "Foo", "de": "Bar", "es": "Baz" } * Return the one which matches the current locale. */ localString: function (strings) { var lang = env.locale; if (!(lang in strings)) lang = 'en-US'; return strings[lang]; } } %>

Revision Source

<% module.exports = {
    
    /**
     * Given a set of strings like this:
     *     { "en-US": "Foo", "de": "Bar", "es": "Baz" }
     * Return the one which matches the current locale.
     */
    localString: function (strings) {
        var lang = env.locale;
        if (!(lang in strings)) lang = 'en-US';
        return strings[lang];
    }
    
} %>