/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; import { FormControl } from '@angular/forms' ; /** Custom Services */ import { I18nService } from '../../core/i18n/i18n.service' ; /**
 * Language selector component.
 *
 * TODO: Decision to be taken on using ngx-translate or angular-internationalization
 *       to provide language support in the application.
 */ @ Component ( { selector : 'mifosx-language-selector' , templateUrl : './language-selector.component.html' , styleUrls : [ './language-selector.component.scss' ] } ) export class LanguageSelectorComponent implements OnInit { /** Language selector form control. */ languageSelector = new FormControl ( ) ; param { I18nService } i18nService constructor ( private i18nService ) { this . languageSelector . setValue ( this . currentLanguage ) ; this . languageSelector . valueChanges . subscribe ( language => this . setLanguage ( language ) ) ; } ngOnInit ( ) { } param { string } language setLanguage ( language ) { this . i18nService . language = language ; } returns { string } get currentLanguage ( ) : string { return this . i18nService . language ; } return { string [ ] } get languages ( ) : string [ ] { return this . i18nService . supportedLanguages ; } }