Skip to content

Commit

Permalink
fix: fix building axe-core translation files with region locales (#4396)
Browse files Browse the repository at this point in the history
Figured a simple `split` would do the job without needing to write a
complicated regex to do it. Otherwise we'd need something like
`/\.([a-zA-Z_]+)\.js$/`

Closes: #4388
  • Loading branch information
straker authored Apr 10, 2024
1 parent 44e39ec commit 5c318f3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build/tasks/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ module.exports = function (grunt) {
});

this.files.forEach(function (file) {
const match = file.dest.auto.match(/\.([a-z]{2,3})\.js/);
if (match) {
options.locale = match[1];
// locale will always be the 2nd to last part of the
// filename and in the format of "<name>.<locale>.js"
const parts = file.dest.auto.split('.');
if (parts.length > 2) {
options.locale = parts[parts.length - 2];
}

buildRules(grunt, options, null, function (result) {
Expand Down

0 comments on commit 5c318f3

Please sign in to comment.