import { HttpClient } from '@angular/common/http' ; import { TranslateService , TranslateLoader } from '@ngx-translate/core' ; import { TranslateHttpLoader } from '@ngx-translate/http-loader' ; export const TRANSLATE_STORAGE_KEY = 'ngx-translate-lang' ; export const SUPPORTED_LANGS = [ 'en' ] ; /**
 * Utility method to get selected language from sessionStorage or browser
 */ export function getSelectedLanguage ( translateService ) { const storedLanguage = sessionStorage . getItem ( TRANSLATE_STORAGE_KEY ) ; if ( storedLanguage && translateService . getLangs ( ) . indexOf ( storedLanguage ) > - 1 ) { return storedLanguage ; } else if ( translateService . getLangs ( ) . indexOf ( translateService . getBrowserLang ( ) ) > - 1 ) { return translateService . getBrowserLang ( ) ; } return translateService . getDefaultLang ( ) ; } export function getSelectedLocale ( translateService ) { return translateService . getBrowserCultureLang ( ) ; } /**
 * Crate custom TranslateLoader since we have a diff dir structure for our json files
 */ export function createTranslateLoader ( httpClient ) { return new TranslateHttpLoader ( httpClient , 'assets/i18n/' , '.json' ) ; }