How to use the cldr-core/supplemental/aliases.json.supplemental function in cldr-core

To help you get started, we’ve selected a few cldr-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleChrome / lighthouse / lighthouse-core / scripts / validate-locale-lookups.js View on Github external
const fs = require('fs');
const path = require('path');
const glob = require('glob');

const i18n = require('../lib/i18n/i18n.js');
const lookupClosestLocale = require('lookup-closest-locale');

const cldrAliasData = require('cldr-core/supplemental/aliases.json');
const cldrAliases = cldrAliasData.supplemental.metadata.alias.languageAlias;

const cldrParentsData = require('cldr-core/supplemental/parentLocales.json');
const cldrParentLocales = cldrParentsData.supplemental.parentLocales.parentLocale;


// const
// Object.entries(cldrAliases).forEach(([alias, entry]) => { if (locales[entry._replacement]) console.log(alias, entry) })

const lhLocales = glob
  .sync('./lighthouse-core/lib/i18n/locales/*.json')
  .filter(f => !f.includes('.ctc.json'))
  .map(filename => path.parse(filename).name);

//
// 1. Validate the locales we store are canonical and not an alias
//