0

I'm new in ionic and currently I'm building a little app. I successfully got my ionic app localized with ngx-translate and also the angular localization for pipelines. Only thing I am wondering is how do I get the default ionic elements translated?

Let's say I have the following code:

...
<ion-item>
  <ion-label position="stacked">{{'item.brand' | translate }}</ion-label>
   <ion-select formControlName="itemBrand">
     <ion-select-option *ngFor="let option of brands | async" [value]="option.id">{{ option.name }}
     </ion-select-option>
   </ion-select>
</ion-item>

In any language the buttons of the popup will be in English.

Example of ion-select popup

I'm sure I am missing a little piece, but I didn't found anything searching the internet so far.

I'm using Ionic 5 with Angular 8.2 and ngx-translate 12.

Thanks for your help

omido
  • 76
  • 5
  • The option.name itself should be changed, since its getting the value in the set language (en), what you need to do is to set array for each language and for item.brand , what is the name of it inside json file, for example in en json file its name is "something":"anything, and in fr "something":"çava" so in the html you call the something and according to the language set it will change something to its corresponding. – Mostafa Harb May 03 '20 at 01:19
  • Thank you for your response, Mostafa. The problem is not the translation of the data (here option.name). My question is how I get the buttons of the popup translated. In "en" its "Cancel". In "de" it should be "Abbrechen", in "fr" "casser" (?) – omido May 03 '20 at 09:52
  • For cancel button cancelText="{{you translation}} , for ok button okText="{{your translation}}" – Mostafa Harb May 03 '20 at 12:15
  • @MostafaHarb Thank you very much. That was the trick. – omido May 03 '20 at 15:55
  • Your welcome mate <3. – Mostafa Harb May 03 '20 at 16:00

0 Answers0