Runs Metalsmith build on specified locale.

@param {Object} config
@param {string} locale
@param {Function} done
326906
function build(config, locale, done) {
  const shouldWatch = (util.env[`watch`] || util.env[`w`]) && (config.watch !== false);

  if (locale && config.i18n && (config.i18n.locales instanceof Array) && (locale === config.i18n.locales[0]))
    locale = undefined;

  config = normalizeConfig(config, locale);

  metalsmith(config.base || __dirname)
    .clean(false)
    .source(config.src)
    .ignore(config.ignore)
    .destination(config.dest)
    .metadata(config.metadata.global)
    .use(collections(config.collections))
    .use(related(config.related))
    .use((config.tags) ? tags(config.tags) : noop())
    .use(pagination(config.pagination))
    .use(metadata(config.metadata.collections))
    .use(markdown(config.markdown))
    .use(config.multilingual ? multilingual(locale) : noop())
    .use(permalinks(config.permalinks))
    .use(pathfinder(locale, config.i18n && config.i18n.locales))
    .use(layouts(config.layouts))
    .use(inPlace(config.inPlace))
    .use((config.prism !== false) ? prism(config.prism, locale) : noop())
    .use((config.mathjax !== false) ? mathjax(config.mathjax, locale) : noop())
    .use(permalinks(config.permalinks))
    .use(reporter(locale))
    .build(function(err) {
      if (err && shouldWatch) util.log(util.colors.blue(`[metalsmith]`), util.colors.red(err));
      done(!shouldWatch && err);
    });
}
293285
function defineTasksForConfig(taskData) {
  // Define gulp tasks (build and optionally watch)
  // For the task name:
  // - single config, no 'name' key: <callback>
  // - single config, 'name' key: <callback>_<name>
  // - multiple configs, no 'name' key: <callback>_<index>
  const { callback, name, normalizedConfigs } = taskData
  normalizedConfigs.forEach((config, index) => {
    let taskId = name
    if (typeof config.name === 'string') {
      taskId += `_${config.name.trim()}`
    } else if (normalizedConfigs.length > 1) {
      taskId += `_${index + 1}`
    }
    const buildId = options.buildPrefix + taskId
    const watchId = options.watchPrefix + taskId

    // Register build task
    gulp.task(buildId, done => {
      return callback(config, {
        done: done,
        catchErrors: catchErrors,
        showError: showError,
        showSizes: showSizes,
        simpleStream: simpleStream
      })
    })

    // Register matching watch task
    if (Array.isArray(config.watch) && config.watch.length > 0) {
      gulp.task(watchId, () => {
        return gulp.watch(config.watch, gulp.series(buildId))
      })
    }
  })
}
982967
def custom_capify(data={}, config=nil)
      # defaults
      data[:server_url] = ""
      data[:branch] = "master"

      FileUtils.mkdir_p AppDirectory.deploy

      build_capfile

      deploy_rb = AppDirectory.config.join('deploy.rb')
      build_template("templates/deploy.rb.erb", deploy_rb, binding)

      FileUtils.mkdir_p AppDirectory.tasks

      puts I18n.t :capified, scope: :negroku

    end
654764
function build(config) {
	return lazypipe()
		.pipe(() => polymerBuild(config))
		.pipe(() => addCspCompliance())
		.pipe(() => addCacheBusting())
		.pipe(() => optimizeAssets())
		.pipe(() => injectCustomElementsEs5Adapter());
}
42463
function generateBundle(locale, messages, reactElements, options) {
  var builtContent;
  var onBuildWrite = options.onBuildWrite || defaultOnBuildWrite;
  options = options || {};

  init();

  assertLocale(locale);
  assertMessages(messages);
  assertReactElements(reactElements);

  // Load i18n content.
  loadCldr(locale);
  loadMessages(messages);

  // Set locale.
  Globalize.locale(locale);

  // Have react to render all passed components, therefore the formatters in
  // use will be created in Globalize.cache.
  _reactElements(reactElements).forEach(function(reactElement) {
    React.renderToString(reactElement);
   });

  // Compile all generated formatters.
  builtContent = GlobalizeCompiler(Globalize.cache);

  // Cleanup.
  Globalize.cache = {};

  return onBuildWrite(locale, builtContent);
}
147111
function browserBuild(config) {
  const compiler = webpack(config);
  return new Promise((resolve, reject) => {
    compiler.run((err, stats) => {
      if (err) {
        return reject(err);
      }
      const messages = formatWebpackMessages(stats.toJson({}, true));
      if (messages.errors.length) {
        return reject(new Error(messages.errors.join('\n\n')));
      }
      return resolve({ stats, warnings: messages.warnings });
    });
  });
}
722446
def localize(object, locale: nil, format: nil, **options)
      locale ||= config.locale
      raise Disabled.new('l') if locale == false
      enforce_available_locales!(locale)

      format ||= :default
      config.backend.localize(locale, object, format, options)
    end
364696
function(files, metalsmith, done){
            var yuiDocsData = require('../docs/data.json');

            var makeUrl = function(docClass, method){
                var out = '/docs/classes/' + docClass + '.html';
                if(method){
                    out += '#method_' + method;
                }
                return out;
            };

            for(var key in files){
                var file = files[key];
                if(file.docs_class){
                    file.yui_class_data = yuiDocsData.classes[file.docs_class];
                    if(file.docs_method){
                        file.yui_method_url = makeUrl(file.docs_class) + '#method_' + file.docs_class;
                    }
                }
                var relatedDocs = file.related_methods;
                var relatedDocsFormatted = [];
                if(relatedDocs){
                    relatedDocs.forEach(function(doc){
                        if(doc.indexOf('.') !== -1){
                            var arr = doc.split('.');
                            relatedDocsFormatted.push({
                                name: arr[0] + '.prototype.' + arr[1] + '()',
                                class: arr[0],
                                method: arr[1],
                                url: makeUrl(arr[0], arr[1])
                            });
                        } else {
                            relatedDocsFormatted.push({
                                name: doc + '()',
                                class: doc,
                                url: makeUrl(doc)
                            });
                        }
                    });
                    file.related_docs = relatedDocsFormatted;
                }
            }
            done();
        }
1315725
function serve(done) {
  gulp.watch(['src/**/*.css'], () => {
    reset();
    gulp.series('build-css', 'generate-preview', outputDevServerInfo);
  });

  gulp.watch(['previewer-src/**', 'patterns.yaml'], () => {
    reset();
    gulp.series('generate-preview-force', outputDevServerInfo)
  });

  browserSync.emitter.on('init', outputDevServerInfo);

  browserSync.init({
    logLevel: 'silent',
    ui: false,
    port: 4321,
    notify: false,
    server: {
      baseDir: __dirname + '/build',
      middleware: [historyApiFallback()],
    },
    startPath: '/',
    open: false
  });
}
483780
@NonNull
    public static Context applyLanguageForContext(@NonNull Context context, @NonNull Locale locale) {
        Resources resources = context.getResources();
        Configuration config = resources.getConfiguration();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            config.setLocale(locale);
            return context.createConfigurationContext(config);
        } else {
            config.locale = locale;
            resources.updateConfiguration(config, resources.getDisplayMetrics());
            return context;
        }
    }
412417
private function handleLocale(array $config, ContainerBuilder $container, FileLoader $loader)
    {
        $loader->load('locale.yml');
        $container->setParameter(
            'ezpublish.locale.conversion_map',
            $config['locale_conversion'] + $container->getParameter('ezpublish.locale.conversion_map')
        );
    }
1351248
function watch(done) {
  var mainWatcher = gulp.watch([
    'src/**/*.js',
    'modules/**/*.js',
    'test/spec/**/*.js',
    '!test/spec/loaders/**/*.js'
  ]);
  var loaderWatcher = gulp.watch([
    'loaders/**/*.js',
    'test/spec/loaders/**/*.js'
  ]);

  connect.server({
    https: argv.https,
    port: port,
    root: './',
    livereload: true
  });

  mainWatcher.on('all', gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test)));
  loaderWatcher.on('all', gulp.series(lint));
  done();
}
468896
function loadConfig(done) {
  fs.stat('package.json', function(err) {
    if (err) return done(undefined, {});
    fs.readFile('package.json', function(err, contents) {
      if (err) return done(err);
      try {
        done(undefined, JSON.parse(contents).config || {});
      } catch(err) {
        done(err);
      }
    });
  });
}
550771
def join_locale(comps):
    '''
    
    '''
    loc = comps['language']
    if comps.get('territory'):
        loc += '_' + comps['territory']
    if comps.get('codeset'):
        loc += '.' + comps['codeset']
    if comps.get('modifier'):
        loc += '@' + comps['modifier']
    if comps.get('charmap'):
        loc += ' ' + comps['charmap']
    return loc
688664
async function finaliseRepo(config, branchList) {
  // TODO: Promise.all
  await validatePrs(config);
  await pruneStaleBranches(config, branchList);
  await platform.ensureIssueClosing(
    `Action Required: Fix ${appName} Configuration`
  );
}
14450
async function combineLocales(localesPath) {
  const localesFiles = await fs.readdir(localesPath);
  const jsonFiles = localesFiles.filter((fileName) =>
    fileName.endsWith('.json'),
  );

  return jsonFiles.reduce(async (promise, file) => {
    const accumulator = await promise;
    const localeCode = path
      .basename(file)
      .split('.')
      .shift();
    const fileContents = JSON.parse(
      await fs.readFile(path.resolve(localesPath, file), 'utf-8'),
    );
    accumulator[localeCode] = fileContents;
    return accumulator;
  }, Promise.resolve({}));
}
165740
function buildDocs() {
  return Promise.resolve()
    .then(() => new Promise((resolve, reject) => {
      Metalsmith(__dirname)
        .source('./source/docs')
        .destination('./docs')
        .clean(true)
        .use(Markdown())
        .metadata({
          version: __version
        })
        .use(Layouts({
          engine: 'handlebars',
          directory: './source/layouts',
          rename: false
        }))
        // Update {{version}} in content since it's not processed with Handlebars
        .use((files, metalsmith, done) => {
          Object.keys(files).forEach((key) => {
            let file = files[key];

            file.contents = new Buffer(
              file.contents
                .toString()
                .replace(/\{\{version\}\}/g, __version)
            );
          });

          done();
        })
        .build((err) => {
          if(err) {
            reject(err);
            return;
          }
          console.log(Chalk.green('Docs generated! 📚'));

          resolve();
        });
    }));
}