Ionic single language

I want my application to support only one language (for components such as a calendar, etc.), although the device language is a different language.

In this image, as you can see, the application language is Turkish, but the buttons and months are English. I want all of them to be Turkish.

enter image description here

+4
source share
1 answer

As you can see in the docs :

There is currently no single size for all; select the correct language / spelling for the name of the month or day, week name, depending on the language or locale.

and

, , , , . , .

//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>
+6

Source: https://habr.com/ru/post/1682374/


All Articles