Hi,
I try to use an ITranslationRequest to translate my application with the M3 file MVXCON but it doesn't work. The response for element.text is null. My code is :
import { Component, OnInit } from '@angular/core';;
import { CoreBase, ITranslationItem, ITranslationRequest, ITranslationResponse } from '@infor-up/m3-odin';;
selector: 'app-traductor',
templateUrl: './traductor.component.html',
styleUrls: ['./traductor.component.css']
})
export class TraductorComponent extends CoreBase implements OnInit {
code: string;
traduction: string;
TranslationRequest = {} as ITranslationRequest;
TranslationItem = {} as ITranslationItem;
items: ITranslationItem[];
TranslationResponse = {} as ITranslationResponse;
constructor(private formService: FormService) {
super('TraductorComponent');
}
ngOnInit() {
this.code = 'WCU1315';
}
onTranslate(): void {
this.logInfo('onTranslate');
const TranslationItem: ITranslationItem = {
language: 'FR',
key: this.code,
file: 'MVXCON'
};
const TranslationRequest: ITranslationRequest = {
language: 'FR',
items: [this.TranslationItem]
};
this.formService.translate(TranslationRequest).subscribe((TranslationResponse: ITranslationResponse) => {
this.logInfo('Code:' + TranslationItem.key);
this.logInfo('Language : ' + TranslationResponse.language);
this.items = TranslationResponse.items;
this.items.forEach(element => {
this.logInfo('items : ' + element.text );
});
// this.updateTranslate(TranslationResponse);
this.logInfo('Traduction effectuée.');
}, (error) => {
this.logError('Echec de traduction ' + error);
});
}