angular-cn/tools/gulp-tasks/cldr
Pete Bacon Darwin a3c44124ab build: support generating global locale files from CLDR data (#33523)
In order to support adding locales during compile-time
inlining of translations (i.e. after the TS build has completed),
we need to be able to attach the locale to the global scope.

This commit modifies CLDR extraction to emit additional "global"
locale files that appear in the `@angular/common/locales/global` folder.

These files are of the form:

```
(function() {
  const root = typeof globalThis !== 'undefined' && globalThis ||
      typeof global !== 'undefined' && global || typeof window !== 'undefined' && window;
  root.ng = root.ng || {};
  root.ng.common = root.ng.common || {};
  root.ng.common.locale = root.ng.common.locale || {};
  const u = undefined;
  function plural(n) {
    if (n === 1) return 1;
    return 5;
  }
  root.ng.common.locale['xx-yy'] = [...];
})();
```

The IIFE will ensure that `ng.common.locale` exists and attach the
given locale (and its "extras") to it using it "normalized" locale
name.

* "extras": in the UMD module locale files the "extra" locale data,
currently the day period rules, and extended day period data, are
stored in separate files under the "common/locales/extra" folder.

* "normalized": Angular references locales using a normalized form,
which is lower case with `_` replaced by `-`. For example:
`en_UK` => `en-uk`.

PR Close #33523
2019-11-05 17:26:59 +00:00
..
cldr-data.js build: update npm dependencies (#19328) 2017-09-22 13:20:52 -07:00
cldr-urls.json refactor(common): update CLDR data to v33.0.0 (#23265) 2018-04-11 15:34:46 -07:00
closure.js fix(common): register locale data for all equivalent closure locales (#25867) 2018-09-10 13:59:56 -07:00
extract.js build: support generating global locale files from CLDR data (#33523) 2019-11-05 17:26:59 +00:00
util.js refactor: remove unused parameters (#28203) 2019-01-23 10:58:37 -08:00