22 Commits

Author SHA1 Message Date
Pete Bacon Darwin
ed2f5e0efa feat: i18n - include currency code in locale data ()
PR Close 
2020-01-13 09:57:06 -08:00
Feliks Khantsis
3c2438425b feat: add direction property to locale files ()
PR Close 
2019-12-03 15:58:09 -08:00
Pete Bacon Darwin
db2c606d41 build(common): fix bad root reference in global locale files ()
There was a mistake in the generation of the global
locale files, where `root` was being used instead of
the correctl `global`.

PR Close 
2019-11-12 11:39:19 -08:00
Joey Perrott
6cb9988d63 build: move clang formating out of gulp stream for cldr ()
PR Close 
2019-11-11 09:38:58 -08:00
Joey Perrott
42d394973d build: move cldr dependency to npm ()
PR Close 
2019-11-07 17:49:19 +00:00
Pete Bacon Darwin
a3c44124ab build: support generating global locale files from CLDR data ()
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 
2019-11-05 17:26:59 +00:00
Pete Bacon Darwin
502dd89290 build: reformat (clang) extract.js ()
PR Close 
2019-11-05 17:26:59 +00:00
Olivier Combe
5e0f982961 feat(ivy): use i18n locale data to determine the plural form of ICU expressions ()
Plural ICU expressions depend on the locale (different languages have different plural forms). Until now the locale was hard coded as `en-US`.
For compatibility reasons, if you use ivy with AOT and bootstrap your app with `bootstrapModule` then the `LOCALE_ID` token will be set automatically for ivy, which is then used to get the correct plural form.
If you use JIT, you need to define the `LOCALE_ID` provider on the module that you bootstrap.
For `TestBed` you can use either `configureTestingModule` or `overrideProvider` to define that provider.
If you don't use the compat mode and start your app with `renderComponent` you need to call `ɵsetLocaleId` manually to define the `LOCALE_ID` before bootstrap. We expect this to change once we start adding the new i18n APIs, so don't rely on this function (there's a reason why it's a private export).
PR Close 
2019-05-30 15:09:02 -04:00
Alex Rickabaugh
9147092a15 Revert "feat(ivy): use i18n locale data to determine the plural form of ICU expressions ()" ()
This reverts commit 6a8cca797536dc69e18266741d70790eccb2121d.

PR Close 
2019-04-15 16:55:51 -07:00
Olivier Combe
6a8cca7975 feat(ivy): use i18n locale data to determine the plural form of ICU expressions ()
Plural ICU expressions depend on the locale (different languages have different plural forms). Until now the locale was hard coded as `en-US`.
For compatibility reasons, if you use ivy with AOT and bootstrap your app with `bootstrapModule` then the `LOCALE_ID` token will be set automatically for ivy, which is then used to get the correct plural form.
If you use JIT, you need to define the `LOCALE_ID` provider on the module that you bootstrap.
For `TestBed` you can use either `configureTestingModule` or `overrideProvider` to define that provider.
If you don't use the compat mode and start your app with `renderComponent` you need to call `ɵsetLocaleId` manually to define the `LOCALE_ID` before bootstrap. We expect this to change once we start adding the new i18n APIs, so don't rely on this function (there's a reason why it's a private export).
PR Close 
2019-04-15 10:40:26 -07:00
Olivier Combe
dcabb05102 fix(common): use correct currency format for locale de-AT ()
Fixes 
PR Close 
2018-07-09 15:10:06 -07:00
Olivier Combe
5706810af2 fix(common): replace i18n locale undefined values by a const ()
Fixes 
PR Close 
2018-04-11 15:34:46 -07:00
Olivier Combe
44154e71fd fix(common): round currencies based on decimal digits in CurrencyPipe ()
By default, we now round currencies based on the number of decimal digits available for that currency instead of using the rouding defined in the number formats.
More info about that can be found in http://www.unicode.org/cldr/charts/latest/supplemental/detailed_territory_currency_information.html#format_info

Fixes 

PR Close 
2018-02-09 14:42:23 -08:00
Olivier Combe
420cc7afc6 fix(common): add locale currency values ()
we now use locale currency symbols, since they may be different in each locale (we were only using english data previously)

Fixes 

PR Close 
2018-02-09 14:42:23 -08:00
Olivier Combe
97b18b2a5c fix(common): extract plural function from i18n locale data files for TS 2.6 ()
Fixes 

PR Close 
2018-01-19 13:23:34 -08:00
Olivier Combe
135a2822ea fix(common): don't remove special characters when extracting CLDR data ()
PR Close 
2018-01-19 13:23:34 -08:00
Olivier Combe
0f5c70d563 build: update npm dependencies ()
PR Close 
2017-09-22 13:20:52 -07:00
Olivier Combe
48789360b1 feat(common): generate closure-locale.ts to tree shake locale data ()
Closure will only keep the data for the locale defined in `goog.LOCALE`

PR Close 
2017-08-29 11:26:10 -05:00
Victor Berchet
4c5aac8cd5 refactor(common): move generated locale files ()
PR Close 
2017-08-29 11:26:10 -05:00
Victor Berchet
832876d0a1 refactor(common): refactor i18n code to ease tree shaking ()
PR Close 
2017-08-29 11:26:09 -05:00
Olivier Combe
4c45347635 refactor(common): remove AVAILABLE_LOCALES ()
Fixes 

PR Close 
2017-08-29 11:26:09 -05:00
Olivier Combe
33d250ffaa build(common): extract i18n locale data from cldr ()
PR Close 
2017-08-22 15:43:04 -05:00