The Angular CLI automatically includes locale data if you run the ng build command with the --localize option.
ng build --localize
HELPFUL: The initial installation of Angular already contains locale data for English in the United States (en-US).
The Angular CLI automatically includes the locale data and sets the LOCALE_ID value when you use the --localize option with ng build 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)
import '@angular/common/locales/global/fr';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 ],});
HELPFUL: In an NgModules application, you would import it in your app.module.