import { Component } from '@angular/core' ; import { TranslateService } from '@rxweb/ngx-translate-extension' ; import { translate , asyncTranslate , RxTranslation } from "@rxweb/translate" ; import { CountryService } from '../service/country.service' ; @ Component ( { selector : 'app-decorator' , templateUrl : './decorator.component.html' , } ) export class DecoratorComponent { @ translate ( ) global : { [ key ] : any ; } ; @ translate ( { translationName : 'global' , language : 'fr' } ) globalFrench : { [ key ] : any ; } ; @ translate ( { translationName : 'dashboard' } ) dashboard : { [ key ] : any ; } ; @ translate ( { translationName : 'customfile' , filePath : "assets/i18n/dashboard/en.json" } ) dashboardEnglish : { [ key ] : any ; } ; @ asyncTranslate ( { serviceModel : CountryService , serviceMethod : CountryService . prototype . get } ) countries : any ; @ translate ( { translationName : 'inliners' , inlineTranslations : { en : ( ) => import ( './i18n/en.json' ) , fr : ( ) => import ( './i18n/fr.json' ) } } ) inline : any ; constructor ( public translate , public rxTranslation ) { } name : string = "John" ; meridiem : string = "am" ; keys : string [ ] = [ "keyOne" , "nested.keyOne" ] ; message : string ; changeMeridiem ( ) { this . meridiem = this . meridiem == "am" ? "pm" : "am" ; } selectUser ( user ) { this . message = this . rxTranslation . translate ( this . global . selectedRecord , user ) ; } }