gulpfile.js
function repeatTaskForAllLocales(taskName, dependencies, operation) {
  return ALL_LOCALES.map((locale) => {
    // Convert build-js-$ to build-js-fr, for example.
    const replaceTokens = (name) => name.replace(/\$/g, locale);
    const localeTaskName = replaceTokens(taskName);
    const localeDependencies = dependencies.map(replaceTokens);
    gulp.task(localeTaskName, gulp.series(
        gulp.parallel.apply(null, localeDependencies),
        () => operation(locale)
    ));
    return localeTaskName;
  });
}
function repeatTaskForAllLocales(taskName, dependencies, operation) {
  return ALL_LOCALES.map((locale) => {
    // Convert build-js-$ to build-js-fr, for example.
    const replaceTokens = (name) => name.replace(/\$/g, locale);
    const localeTaskName = replaceTokens(taskName);
    const localeDependencies = dependencies.map(replaceTokens);
    gulp.task(localeTaskName, gulp.series(
        gulp.parallel.apply(null, localeDependencies),
        () => operation(locale)
    ));
    return localeTaskName;
  });
}
function repeatTaskForAllLocales ( taskName , dependencies , operation ) { return ALL_LOCALES . map ( ( locale ) => { // Convert build-js-$ to build-js-fr, for example. const replaceTokens = ( name ) => name . replace ( / \$ / g , locale ) ; const localeTaskName = replaceTokens ( taskName ) ; const localeDependencies = dependencies . map ( replaceTokens ) ; gulp . task ( localeTaskName , gulp . series ( gulp . parallel . apply ( null , localeDependencies ) , ( ) => operation ( locale ) ) ) ; return localeTaskName ; } ) ; }
Repeats a gulp task for all locales.
@param {string} taskName The gulp task name to generate. Any $ tokens will be
replaced with the language code (e.g. build-$ becomes build-fr, build-es,
etc.).
@param {!Array<string>} dependencies The gulp tasks that each operation
depends on. Any $ tokens will be replaced with the language code.
@param {function()} operation The function to execute.
@return {!Array<string>} The list of generated task names.
Repeats a gulp task for all locales .