Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add locale/_template.json #3536

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ module.exports = function(grunt) {
}
},
'add-locale': {
template: {
options: {
lang: 'xyz'
},
src: ['tmp/core/core.js'],
dest: './locales/_template.json'
},
newLang: {
options: {
lang: grunt.option('lang')
Expand Down Expand Up @@ -249,7 +256,7 @@ module.exports = function(grunt) {
}
});

grunt.registerTask('translate', ['validate', 'esbuild', 'add-locale']);
grunt.registerTask('translate', ['validate', 'esbuild', 'add-locale:newLang']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we generate this template every time we build?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That happens here:
https://github.com/dequelabs/axe-core/pull/3536/files#diff-8e7e5f941c67b0cf481a9d650295119d4922b96117e7adc069ba30a81a78c65fR270

Because I added a template prop to add-locale, I need to explicitly call add-locale:newLang, otherwise both commands will run in translate.

grunt.registerTask('build', [
'clean:core',
'validate',
Expand All @@ -260,7 +267,8 @@ module.exports = function(grunt) {
'concat:engine',
'uglify',
'aria-supported',
'bytesize'
'add-locale:template',
'bytesize',
]);
grunt.registerTask('default', ['build']);
grunt.registerTask('dev', ['watch']);
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ or equivalently:

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).
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. Alternatively, you could copy `./locales/_template.json`. 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).

To update existing translation file, re-run `grunt translate --lang=<langcode>`. This will add new messages used in English and remove messages which were not used in English.

Expand Down
Loading