tools/gulp-tasks/cldr/extract.js
function generateLocale(locale, localeData, baseCurrencies) {
  // [ localeId, dateTime, number, currency, pluralCase ]
  let data = stringify([
    locale,
    ...getDateTimeTranslations(localeData),
    ...getDateTimeSettings(localeData),
    ...getNumberSettings(localeData),
    ...getCurrencySettings(locale, localeData),
    generateLocaleCurrencies(localeData, baseCurrencies)
  ], true)
  // We remove "undefined" added by spreading arrays when there is no value
    .replace(/undefined/g, 'u');

  // adding plural function after, because we don't want it as a string
  data = data.substring(0, data.lastIndexOf(']')) + `, plural]`;

  return `${HEADER}
const u = undefined;

${getPluralFunction(locale)}

export default ${data};
`;
}
function generateLocale(locale, localeData, baseCurrencies) {
  // [ localeId, dateTime, number, currency, pluralCase ]
  let data = stringify([
    locale,
    ...getDateTimeTranslations(localeData),
    ...getDateTimeSettings(localeData),
    ...getNumberSettings(localeData),
    ...getCurrencySettings(locale, localeData),
    generateLocaleCurrencies(localeData, baseCurrencies)
  ], true)
  // We remove "undefined" added by spreading arrays when there is no value
    .replace(/undefined/g, 'u');

  // adding plural function after, because we don't want it as a string
  data = data.substring(0, data.lastIndexOf(']')) + `, plural]`;

  return `${HEADER}
const u = undefined;

${getPluralFunction(locale)}

export default ${data};
`;
}
function generateLocale ( locale , localeData , baseCurrencies ) { // [ localeId, dateTime, number, currency, pluralCase ] let data = stringify ( [ locale , ... getDateTimeTranslations ( localeData ) , ... getDateTimeSettings ( localeData ) , ... getNumberSettings ( localeData ) , ... getCurrencySettings ( locale , localeData ) , generateLocaleCurrencies ( localeData , baseCurrencies ) ] , true ) // We remove "undefined" added by spreading arrays when there is no value . replace ( / undefined / g , 'u' ) ; // adding plural function after, because we don't want it as a string data = data . substring ( 0 , data . lastIndexOf ( ']' ) ) + ` ` ; return ` ${ HEADER } ${ getPluralFunction ( locale ) } ${ data } ` ; }
Generate file that contains basic locale data
Generate file that contains basic locale data