首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >角度猫头鹰日期时间选取器标签和按钮未本地化

角度猫头鹰日期时间选取器标签和按钮未本地化
EN

Stack Overflow用户
提问于 2019-10-10 18:34:13
回答 2查看 2.9K关注 0票数 1

在猫头鹰日期时间选取器中,From和To标签以及Set和Cancel按钮未本地化。我用于指定区域设置的代码是:

代码语言:javascript
运行
复制
constructor(
  private dateTimeAdapter: DateTimeAdapter<any>
) {
    dateTimeAdapter.setLocale(localStorage.getItem('localeId'));
}

已尝试使用de、fr、zh

"ng-pick-datetime":"^7.0.0“

可能的问题是什么?

编辑:

为了进行测试,我尝试了:

代码语言:javascript
运行
复制
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SampleTableComponent } from './sample-table/sample-table.component';
import { MaterialModule } from './material.module';
import { MatFormComponent } from './mat-form/mat-form.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { OwlDateTimeModule, OwlNativeDateTimeModule, OwlDateTimeIntl } from 'ng-pick-datetime';

export class DefaultIntl extends OwlDateTimeIntl {
  cancelBtnLabel: 'C';
  setBtnLabel: 'S';
  rangeFromLabel: 'F';
  rangeToLabel: 'T';
}

@NgModule({
  declarations: [
    AppComponent,
    SampleTableComponent,
    MatFormComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule,
    BrowserAnimationsModule,
    MaterialModule,
    OwlDateTimeModule,
    OwlNativeDateTimeModule,
  ],
  providers: [{provide: OwlDateTimeIntl, useClass: DefaultIntl}],
  bootstrap: [AppComponent]
})
export class AppModule { }

但我仍然在看从,到,设置,取消

EN

Stack Overflow用户

发布于 2020-02-25 20:22:41

代码语言:javascript
运行
复制
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';

import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';


 import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime';
 import { OWL_DATE_TIME_LOCALE } from 'ng-pick-datetime';

@NgModule({
  imports:      [ BrowserModule, BrowserAnimationsModule, FormsModule, OwlDateTimeModule, OwlNativeDateTimeModule ],
  declarations: [ AppComponent, HelloComponent ],
  bootstrap:    [ AppComponent ],
  providers: [
    // use french locale
    {provide: OWL_DATE_TIME_LOCALE, useValue: 'fr'},
  ]`enter code here`
})
export class AppModule { }

    enter code here
票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58320916

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档