From f18a56b3efafdb14989b45bfff0f94e1863b3899 Mon Sep 17 00:00:00 2001 From: Cassey Lottman Date: Tue, 15 Jun 2021 10:06:43 -0500 Subject: [PATCH] feat: Support multiple languages at once in builds (#2994) * aria-supported doesn't throw if multiple languages used * include info on targeting multiple languages in readme --- Gruntfile.js | 3 +++ README.md | 2 +- build/tasks/aria-supported.js | 5 ++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index d308e0fd4e..37f31aa97e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -110,6 +110,9 @@ module.exports = function(grunt) { data: { entry: 'lib/commons/aria/index.js', destFile: 'doc/aria-supported.md', + options: { + langs: langs + }, listType: 'unsupported' // Possible values for listType: 'supported', 'unsupported', 'all' } }, diff --git a/README.md b/README.md index c3a6b6f9eb..da4134acb0 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ or equivalently: `npm run build -- --lang=nl` -This will create a new build for axe, called `axe..js` and `axe..min.js`. If you want to build localized versions, simply pass in `--all-lang` instead. +This will create a new build for axe, called `axe..js` and `axe..min.js`. If you want to build localized versions, simply pass in `--all-lang` instead. If you want to build multiple localized versions (but not all of them), you can pass in a comma-separated list of langages to the `--lang` flag, like `--lang=nl,ja`. To create a new translation for axe, start by running `grunt translate --lang=`. This will create a json file fin the `./locales` directory, with the default English text in it for you to translate. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below. For details on the message syntax, see [Check Message Template](/docs/check-message-template.md). diff --git a/build/tasks/aria-supported.js b/build/tasks/aria-supported.js index 04e2ae69fe..81de153d75 100644 --- a/build/tasks/aria-supported.js +++ b/build/tasks/aria-supported.js @@ -16,9 +16,8 @@ module.exports = function(grunt) { * as `axe` does not exist until grunt task `build:uglify` is complete, * hence cannot be required at the top of the file. */ - const langOption = grunt.option('lang'); - const fileNameSuffix = - langOption && langOption.length > 0 ? `.${langOption}` : ''; + const { langs } = this.options(); + const fileNameSuffix = langs && langs.length > 0 ? `${langs[0]}` : ''; const axe = require(`../../axe${fileNameSuffix}`); const listType = this.data.listType.toLowerCase(); const headings = {