• 개요
@angular/core

LOCALE_ID

상수
안정화

Provide this token to set the locale of your application. It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe, DecimalPipe and PercentPipe) and by ICU expressions.

API

    
      const LOCALE_ID: InjectionToken<string>;
    
    

설명

Provide this token to set the locale of your application. It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe, DecimalPipe and PercentPipe) and by ICU expressions.

See the i18n guide for more information.

사용 시 참고사항

Example

In standalone apps:

import { LOCALE_ID, ApplicationConfig } from '@angular/core';
import { AppModule } from './app/app.module';

const appConfig: ApplicationConfig = {
  providers: [{provide: LOCALE_ID, useValue: 'en-US' }]
};

In module based apps:

import { LOCALE_ID } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';
import { AppModule } from './app/app.module';

platformBrowser().bootstrapModule(AppModule, {
  providers: [{provide: LOCALE_ID, useValue: 'en-US' }]
});
상세 내용으로 이동