Skip to content

Commit

Permalink
refactor: clean-up pre-CLDR 39 safety check (#46606)
Browse files Browse the repository at this point in the history
This commit cleans-up/removes a check we added before we supported CLDR
39. This check was necessary due to a incomplete/invalid list of locales
provided as part of the JSON data.

PR Close #46606
  • Loading branch information
devversion authored and dylhunn committed Jun 29, 2022
1 parent 957744f commit b1ac3d9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions packages/common/locales/generate-locales-tool/cldr-data.ts
Expand Up @@ -106,17 +106,11 @@ export class CldrData {
for (const localeName of allLocales) {
const localeData = this.getLocaleData(localeName);

// If `cldrjs` is unable to resolve a `bundle` for the current locale, then there is no data
// for this locale, and it should not be generated. This can happen as with older versions of
// CLDR where `availableLocales.json` specifies locales for which no data is available
// (even within the `full` tier packages). See:
// http://cldr.unicode.org/development/development-process/design-proposals/json-packaging.
// TODO(devversion): Remove if we update to CLDR v39 where this seems fixed. Note that this
// worked before in the Gulp tooling without such a check because the `cldr-data-downloader`
// overwrote the `availableLocales` to only capture locales with data.
if (localeData !== null) {
localesWithData.push(localeData);
if (localeData === null) {
throw new Error(`Missing locale data for the "${localeName}" locale.`);
}

localesWithData.push(localeData);
}

return localesWithData;
Expand Down

0 comments on commit b1ac3d9

Please sign in to comment.