diff --git a/build/configure.js b/build/configure.js index fe3da8536e..a0e1fe09d5 100644 --- a/build/configure.js +++ b/build/configure.js @@ -276,6 +276,7 @@ function buildRules(grunt, options, commons, callback) { auto: replaceFunctions( JSON.stringify( { + lang: options.locale || 'en', data: metadata, rules: rules, checks: checks, diff --git a/lib/core/base/audit.js b/lib/core/base/audit.js index 497295e718..d97195685d 100644 --- a/lib/core/base/audit.js +++ b/lib/core/base/audit.js @@ -308,6 +308,7 @@ Audit.prototype._init = function() { axe.commons = commons = audit.commons; + this.lang = audit.lang || 'en'; this.reporter = audit.reporter; this.commands = {}; this.rules = []; diff --git a/test/core/public/load.js b/test/core/public/load.js index 50deb3af8c..611e3a3349 100644 --- a/test/core/public/load.js +++ b/test/core/public/load.js @@ -49,6 +49,13 @@ describe('axe._load', function() { assert.equal(axe.commons, 'foo'); }); + it('should load with a lang', function() { + axe._load({ + lang: 'ja' + }); + assert.equal(axe._audit.lang, 'ja'); + }); + describe('respondable subscriber', function() { it('should add a respondable subscriber', function() { var mockAudit = {