Skip to content

Commit

Permalink
feat: Support multiple languages at once in builds (#2994)
Browse files Browse the repository at this point in the history
* aria-supported doesn't throw if multiple languages used

* include info on targeting multiple languages in readme
  • Loading branch information
clottman committed Jun 15, 2021
1 parent d6a72f9 commit f18a56b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
},
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ or equivalently:

`npm run build -- --lang=nl`

This will create a new build for axe, called `axe.<lang>.js` and `axe.<lang>.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.<lang>.js` and `axe.<lang>.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=<langcode>`. 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).

Expand Down
5 changes: 2 additions & 3 deletions build/tasks/aria-supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit f18a56b

Please sign in to comment.