Skip to content

Commit 5c318f3

Browse files
authored
fix: fix building axe-core translation files with region locales (#4396)
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
1 parent 44e39ec commit 5c318f3

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build/tasks/configure.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ module.exports = function (grunt) {
1818
});
1919

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

2628
buildRules(grunt, options, null, function (result) {

0 commit comments

Comments
 (0)