Online

Import global variants of the locale data

The [Angular CLI][CliMain] automatically includes locale data if you run the [ng build][CliBuild] command with the --localize option.

shell
ng build --localize

The [Angular CLI][CliMain] automatically includes the locale data and sets the LOCALE_ID value when you use the --localize option with [ng build][CliBuild] command.

The @angular/common package on npm contains the locale data files. Global variants of the locale data are available in @angular/common/locales/global.

import example for French

For example, you could import the global variants for French \(fr\) in main.ts where you bootstrap the application.

src/main.ts (import locale)
// #docregion global-locale
import '@angular/common/locales/global/fr';
// #enddocregion global-locale

import {provideProtractorTestingSupport} from '@angular/platform-browser';
import {bootstrapApplication} from '@angular/platform-browser';
import {AppComponent} from './app/app.component';

bootstrapApplication(AppComponent, {
  providers: [
    provideProtractorTestingSupport(), // essential for e2e testing
  ],
});

[CliMain]: cli 'CLI Overview and Command Reference | Angular' [CliBuild]: cli/build 'ng build | CLI | Angular'