答案 0 :(得分:2)
感谢Himanshu,
我能够解决此问题:
import { Component, OnInit } from '@angular/core';
import { setTheme } from 'ngx-bootstrap/utils';
import { BsLocaleService } from 'ngx-bootstrap/datepicker';
import { defineLocale } from 'ngx-bootstrap/chronos';
import { enGbLocale } from 'ngx-bootstrap/locale';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'app';
constructor(private localeService: BsLocaleService) {
setTheme('bs4');
enGbLocale.weekdaysShort = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];
enGbLocale.week.dow = 0;
defineLocale('en', enGbLocale);
}
ngOnInit() {
this.localeService.use('en');
}
}
答案 1 :(得分:0)
就我而言,我想使用西班牙语
import { Component, OnInit } from '@angular/core';
import { setTheme } from 'ngx-bootstrap/utils';
import { BsLocaleService } from 'ngx-bootstrap/datepicker';
import { defineLocale } from 'ngx-bootstrap/chronos';
import { esDoLocale } from 'ngx-bootstrap/locale';
@Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent implements OnInit { title = 'app';
constructor(private localeService: BsLocaleService) {
esDoLocale.weekdaysShort = ['L', 'M', 'M', 'J', 'V', 'S', 'D'];
esDoLocale.week.dow = 0;
defineLocale('es', esDoLocale); }
ngOnInit() {
this.localeService.use('es'); }
}
答案 2 :(得分:0)
这对我有用(en-gb)
constructor(private localeService: BsLocaleService) {
enGbLocale.weekdaysShort = ["S", "M", "T", "W", "T", "F", "S"];
enGbLocale.week.dow = 0;
defineLocale("en-gb", enGbLocale);
}
ngOnInit() {
this.localeService.use("en-gb");
}