gpt4 book ai didi

angular - ionic 单一语言

转载 作者:太空狗 更新时间:2023-10-29 17:48:08 24 4
gpt4 key购买 nike

我想让我的应用程序只支持一种语言(对于日历等组件),即使设备语言是另一种语言。

在这张图片中,您可以看到应用程序语言是土耳其语,但按钮和月份是英语。我希望他们都是土耳其人。

enter image description here

最佳答案

就像你在the docs中看到的一样:

At this time, there is no one-size-fits-all standard to automatically choose the correct language/spelling for a month name, or day of the week name, depending on the language or locale

All things considered, the by far easiest solution is to just provide an array of names if the app needs to use names other than the default English version of month and day names. The month names and day names can be either configured at the app level, or individual ion-datetime level.

应用配置级别

//app.module.ts
@NgModule({
...,
imports: [
IonicModule.forRoot(MyApp, {
monthNames: ['janeiro', 'fevereiro', 'mar\u00e7o', ... ],
monthShortNames: ['jan', 'fev', 'mar', ... ],
dayNames: ['domingo', 'segunda-feira', 'ter\u00e7a-feira', ... ],
dayShortNames: ['dom', 'seg', 'ter', ... ],
})
],
...
})

分量输入电平

<ion-item>
<ion-label>Período</ion-label>
<ion-datetime displayFormat="DDDD MMM D, YYYY" [(ngModel)]="myDate"
monthNames="janeiro, fevereiro, mar\u00e7o, ..."
monthShortNames="jan, fev, mar, ..."
dayNames="domingo, segunda-feira, ter\u00e7a-feira, ..."
dayShortNames="dom, seg, ter, ..."></ion-datetime>
</ion-item>

为了改变按钮的文本:

<ion-datetime cancelText="'CustomCancel'" doneText="'CustomDone'" ...></ion-datetime>

关于angular - ionic 单一语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45343611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com