<commit_before>// Copyright 2002-2015, University of Colorado Boulder

var fs = require( 'fs' );

/**
 * For internal use only.
 * Do things before the requirejs:build step.
 * Shares the following information with other grunt tasks by via global.phet:
 * (TODO document these)
 * strings
 * localesToBuild
 * mipmapsToBuild
 *
 * @param grunt
 * @param {string} repositoryName
 * @param {string} version
 * @param {string[]} phetLibs
 * @param {string[]} preload
 * @param {string} fallbackLocale
 */
module.exports = function( grunt, repositoryName, version, phetLibs, preload, fallbackLocale ) {
  'use strict';

  /*
   * Look up the locale strings provided in the simulation.
   * Requires a form like energy-skate-park-basics_ar_SA, where no _ appear in the sim name.
   */
  var getLocalesForDirectory = function( directory ) {
    var stringFiles = fs.readdirSync( directory );
    return stringFiles.map( function( stringFile ) {
      return stringFile.substring( stringFile.indexOf( '_' ) + 1, stringFile.lastIndexOf( '.' ) );
    } );
  };

  /*
   * Look up which locales should be built, accounting for flags provided by the developer on the command line
   * --all-locales true: to build all of the provided locales
   * --locales beers-law-lab: use locales from another sim's strings directory
   * --locale fr: to build just the French locale
   * [no options] to build just the fallback locale (typically English)
   */
  var getLocalesToBuild = function() {
    return grunt.option( 'all-locales' ) ? getLocalesForDirectory( 'strings' ) :
           grunt.option( 'locales' ) ? getLocalesForDirectory( '../' + grunt.option( 'locales' ) + '/strings' ) :
           grunt.option( 'locale' ) ? [ grunt.option( 'locale' ) ] :
           [ fallbackLocale ];
  };

  grunt.log.writeln( 'Building simulation: ' + repositoryName + ' ' + version );<commit_msg>add TODO<commit_after>// Copyright 2002-2015, University of Colorado Boulder

var fs = require( 'fs' );

/**
 * For internal use only.
 * Do things before the requirejs:build step.
 * Shares the following information with other grunt tasks by via global.phet:
 * (TODO document these)
 * strings
 * localesToBuild
 * mipmapsToBuild
 *
 * @param grunt
 * @param {string} repositoryName
 * @param {string} version
 * @param {string[]} phetLibs
 * @param {string[]} preload
 * @param {string} fallbackLocale
 */
module.exports = function( grunt, repositoryName, version, phetLibs, preload, fallbackLocale ) {
  'use strict';

  /*
   * Look up the locale strings provided in the simulation.
   * Requires a form like energy-skate-park-basics_ar_SA, where no _ appear in the sim name.
   */
  var getLocalesForDirectory = function( directory ) {
    var stringFiles = fs.readdirSync( directory );
    return stringFiles.map( function( stringFile ) {
      return stringFile.substring( stringFile.indexOf( '_' ) + 1, stringFile.lastIndexOf( '.' ) );
    } );
  };

  /*
   * Look up which locales should be built, accounting for flags provided by the developer on the command line
   * --all-locales true: to build all of the provided locales
   * --locales beers-law-lab: use locales from another sim's strings directory
   * --locale fr: to build just the French locale
   * [no options] to build just the fallback locale (typically English)
   */
  var getLocalesToBuild = function() {
    return grunt.option( 'all-locales' ) ? getLocalesForDirectory( 'strings' ) :
           grunt.option( 'locales' ) ? getLocalesForDirectory( '../' + grunt.option( 'locales' ) + '/strings' ) :
           grunt.option( 'locale' ) ? [ grunt.option( 'locale' ) ] :
           [ fallbackLocale ];
  };

  //TODO move this elsewhere, so we don't need to pass in version
  grunt.log.writeln( 'Building simulation: ' + repositoryName + ' ' + version );
{'fraction_non_alphanumeric': 0.11628518810839253, 'fraction_numerical': 0.004735595895816891, 'mean_word_length': 3.410672853828306, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2468655', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1121, 'n_words': 375}