本文整理汇总了TypeScript中@angular/common.registerLocaleData函数的典型用法代码示例。如果您正苦于以下问题:TypeScript registerLocaleData函数的具体用法?TypeScript registerLocaleData怎么用?TypeScript registerLocaleData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了registerLocaleData函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: registerLocaleData
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { registerLocaleData } from '@angular/common';
import { NgModule, LOCALE_ID } from '@angular/core';
import { PerfumeModule } from 'perfume.js/angular';
import localePl from '@angular/common/locales/pl';
registerLocaleData(localePl, 'pl');
import { PogodaModule } from './pogoda/pogoda.module';
import { AppComponent } from './app.component';
import { HttpClientModule } from '@angular/common/http';
import { ServiceWorkerModule } from '@angular/service-worker';
import { MatSnackBarModule } from '@angular/material';
@NgModule({
declarations: [
AppComponent
],
imports: [
PerfumeModule.forRoot({
firstContentfulPaint: true,
timeToInteractive: true,
firstInputDelay: true,
firstPaint: true,
googleAnalytics: {
enable: true,
timingVar: 'perf'
}
示例2: registerLocaleData
SyncOutline,
MinusOutline,
FileTextOutline,
FullscreenOutline,
ArrowsAltOutline,
ReloadOutline,
DownloadOutline,
ShrinkOutline,
PicCenterOutline
} from '@ant-design/icons-angular/icons';
import { StatusService } from 'services';
import { ConfigurationInterface } from 'interfaces';
import { AppInterceptor } from './app.interceptor';
registerLocaleData(en);
export function AppInitServiceFactory(
statusService: StatusService,
injector: Injector
): () => Promise<ConfigurationInterface> {
return () => {
return statusService.boot(injector.get<Router>(Router));
};
}
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AppRoutingModule, NgZorroAntdModule, FormsModule, HttpClientModule, BrowserAnimationsModule],
providers: [
{
示例3: beforeAll
beforeAll(() => {
registerLocaleData(localeEn);
registerLocaleData(localeEsUS);
registerLocaleData(localeFr);
});
示例4: constructor
constructor() {
registerLocaleData(locale);
}
示例5: registerLocaleData
import { NgModule } from '@angular/core';
import { CommonModule, registerLocaleData } from '@angular/common';
import { WrapperChauffeurComponent } from './wrapper-chauffeur/wrapper-chauffeur.component';
import { RouterModule, Routes } from '@angular/router';
import { SharedModule } from '../shared/shared.module';
import { PlanningComponent } from './planning/planning.component';
import { OccupationComponent } from './occupation/occupation.component';
import localeFr from '@angular/common/locales/fr';
import { CalendarModule } from 'angular-calendar';
import { DataService } from './data.service';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { JwtInterceptor } from '@auth0/angular-jwt';
registerLocaleData(localeFr);
const chauffeurRoutes: Routes = [
{
path: '',
component: WrapperChauffeurComponent,
children: [
{ path: 'planning', component: PlanningComponent },
{ path: 'occupation', component: OccupationComponent },
{ path: '', redirectTo: 'planning' }
]
}
];
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(chauffeurRoutes),
SharedModule,
示例6: registerLocaleData
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';
import { NgZorroAntdModule, NZ_I18N, zh_CN } from 'ng-zorro-antd';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { BannerComponent } from './banner/banner.component';
import {LayoutComponent} from "./layout/layout.component";
registerLocaleData(zh);
@NgModule({
declarations: [
AppComponent,
HomeComponent,
BannerComponent,
LayoutComponent
],
imports: [
BrowserModule,
NgZorroAntdModule,
FormsModule,
HttpClientModule,
BrowserAnimationsModule
],
providers: [{ provide: NZ_I18N, useValue: zh_CN }],
示例7: registerLocaleData
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
// #region default language
// 参考:https://ng-alain.com/docs/i18n
import { default as ngLang } from '@angular/common/locales/zh-Hans';
import { NZ_I18N, zh_CN as zorroLang } from 'ng-zorro-antd';
import { DELON_LOCALE, zh_CN as delonLang } from '@delon/theme';
const LANG = {
abbr: 'zh-Hans',
ng: ngLang,
zorro: zorroLang,
delon: delonLang,
};
// register angular
import { registerLocaleData } from '@angular/common';
registerLocaleData(LANG.ng, LANG.abbr);
const LANG_PROVIDES = [
{ provide: LOCALE_ID, useValue: LANG.abbr },
{ provide: NZ_I18N, useValue: LANG.zorro },
{ provide: DELON_LOCALE, useValue: LANG.delon },
];
// #endregion
// #region JSON Schema form (using @delon/form)
import { JsonSchemaModule } from '@shared/json-schema/json-schema.module';
const FORM_MODULES = [JsonSchemaModule];
// #endregion
// #region Http Interceptors
import { HTTP_INTERCEPTORS } from '@angular/common/http';
示例8: registerLocaleData
* Copyright (c) 2016-2018 VMware, Inc. All Rights Reserved.
* This software is released under MIT license.
* The full license information can be found in LICENSE in the root directory of this project.
*/
import {registerLocaleData} from "@angular/common";
import localeAk from "@angular/common/locales/ak";
import localeAr from "@angular/common/locales/ar-AE";
import localeDe from "@angular/common/locales/de";
import localeFr from "@angular/common/locales/fr";
import localeHi from "@angular/common/locales/hi";
import localeHR from "@angular/common/locales/hr";
import localeKKJ from "@angular/common/locales/kkj";
import localeRu from "@angular/common/locales/ru";
import {Component} from "@angular/core";
registerLocaleData(localeFr);
registerLocaleData(localeRu);
registerLocaleData(localeAk);
registerLocaleData(localeHi);
registerLocaleData(localeAr);
registerLocaleData(localeDe);
registerLocaleData(localeKKJ);
registerLocaleData(localeHR);
@Component({
selector: "clr-datepicker-demo",
// Note the .css extension here, not .scss. That's the best we can have at the moment.
styleUrls: ["./datepicker.demo.scss"],
templateUrl: "./datepicker.demo.html"
})
export class DatepickerDemo {}
示例9: fixedLocale
function fixedLocale() {
localeZhHans[0] = 'zh-CN';
registerLocaleData(localeZhHans, localeZhHansExtra);
}
示例10: registerLocaleData
import { DeveloperCenterModule } from './dev-center/dev-center.module';
import { registerLocaleData } from '@angular/common';
import { TranslateService } from "@ngx-translate/core";
import { AppConfigService } from './app-config.service';
import { SkinableConfig } from "./skinable-config.service";
import { ProjectConfigComponent } from './project/project-config/project-config.component';
import zh from '@angular/common/locales/zh-Hans';
import es from '@angular/common/locales/es';
import localeFr from '@angular/common/locales/fr';
import { DevCenterComponent } from './dev-center/dev-center.component';
import { VulnerabilityPageComponent } from './vulnerability-page/vulnerability-page.component';
import { GcPageComponent } from './gc-page/gc-page.component';
import { OidcOnboardModule } from './oidc-onboard/oidc-onboard.module';
registerLocaleData(zh, 'zh-cn');
registerLocaleData(es, 'es-es');
registerLocaleData(localeFr, 'fr-fr');
export function initConfig(configService: AppConfigService, skinableService: SkinableConfig) {
return () => {
skinableService.getCustomFile();
configService.load().subscribe();
};
}
export function getCurrentLanguage(translateService: TranslateService) {
return translateService.currentLang;
}