From 5c318f3537056be5779cb53374bc6f4785947c91 Mon Sep 17 00:00:00 2001 From: Steven Lambert <2433219+straker@users.noreply.github.com> Date: Wed, 10 Apr 2024 09:25:08 -0600 Subject: [PATCH] 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 --- build/tasks/configure.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/tasks/configure.js b/build/tasks/configure.js index f4a3c6d262..19a8372efc 100644 --- a/build/tasks/configure.js +++ b/build/tasks/configure.js @@ -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 "..js" + const parts = file.dest.auto.split('.'); + if (parts.length > 2) { + options.locale = parts[parts.length - 2]; } buildRules(grunt, options, null, function (result) {