Skip to content

[i18n] follow up for PR 18284 (moving away from the Intl API) #18763

@vicb

Description

@vicb

@ocombe

Could you please generate a file named locale_all.ts in the folder common/i18n-data with the following structure:

// import all locales
import af from './locale_af';
import ardz from './locale_ar-DZ';


import {registerLocaleData} from '@angular/common';

let locale: any;

// add cases for each locale
switch (goog.LOCALE) {
  case 'af':
    locale = af;
    break;
  case 'ar_DZ':
  case 'ar-DZ':
    locale = ardz;
    break;
  default:
    locale = en;
}

registerLocaleData(locale);

The model is https://github.com/google/closure-library/blob/048a4c201e1b3c40ef55ba753aabe7287ce341a0/closure/goog/i18n/datetimepatterns.js#L2134

The rationale is that this file will be included automatically when building the CommonModule with closure. The effect will be that the data for the target locale will be included and all other files will be tree shaken away.

Edit: We probably do not want all the locales in the imports and switch case. Please add the ability to pass a list of locales to your generation script. Thanks !

Metadata

Metadata

Assignees

Labels

area: i18nIssues related to localization and internationalizationfeatureLabel used to distinguish feature request from other issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions