import { Injectable } from '@angular/core' ; import { Language } from '@data/poe/schema' ; import { ContextService } from '../context' ; import { ClientStringProvider } from './client-string.provider' ; @ Injectable ( { providedIn : 'root' } ) export class ClientStringService { constructor ( private readonly context , private readonly clientString ) { } public translate ( id , language ? ) { language = language || this . context . get ( ) . language ; const strings = this . clientString . provide ( language ) ; const result = strings [ id ] ; if ( ! result ) { console . warn ( `untranslated: '${ id }' for language: '${ Language [ language ] }'` ) ; return `untranslated: '${ id }' for language: '${ Language [ language ] }'` ; } return result ; } }