Skip to content

Commit

Permalink
Full implementation of --all-langs
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Mar 9, 2017
1 parent 9cce3da commit 515ac16
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ node_modules
test/*/index.html
test/integration/*/index.html
axe.js
axe.min.js
axe.es2016.js
axe.*.js
*.tgz
npm-shrinkwrap.json
typings/axe-core/axe-core-tests.js
doc/rule-descriptions.*.md
12 changes: 8 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-parallel');

var langs;
if (grunt.option('all-lang')) {
langs = ['.nl', '.en', '.de'];

} else if (grunt.option('lang')) {
if (grunt.option('lang')) {
langs = ['.' + grunt.option('lang')];

} else if (grunt.option('all-lang')) {
var localeFiles = require('fs').readdirSync('./locales');
langs = localeFiles.map(function (file) {
return '.' + file.replace('.json', '');
});
langs.unshift(''); // Add default

} else {
langs = [''];
}
Expand Down
7 changes: 2 additions & 5 deletions build/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ dot.templateSettings.strip = false;

function getLocale(grunt, options) {
var locale, localeFile;
if (grunt.option('lang')) {
localeFile = './locales/' + grunt.option('lang') + '.json';
} else {
localeFile = options.locale;
if (options.locale) {
localeFile = './locales/' + options.locale + '.json';
}

if (localeFile) {
Expand All @@ -26,7 +24,6 @@ function getLocale(grunt, options) {

function buildRules(grunt, options, commons, callback) {
var locale = getLocale(grunt, options);

options.getFiles = false;
buildManual(grunt, options, commons, function (result) {

Expand Down
4 changes: 4 additions & 0 deletions build/tasks/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ module.exports = function (grunt) {

this.files.forEach(function (file) {
var commons = file.src[0];
var match = file.dest.auto.match(/\.([a-z]{2,3})\.js/);
if (match) {
options.locale = match[1];
}

buildRules(grunt, options, commons, function (result) {
grunt.file.write(file.dest.auto, 'axe._load(' + result.auto + ');');
Expand Down

0 comments on commit 515ac16

Please sign in to comment.