import { Injectable } from '@angular/core' ; import { ImageLocalizationOptions , LocalizationService } from './localization.service' ; import { OverwolfService } from './overwolf.service' ; @ Injectable ( ) export class LocalizationFacadeService { private service : LocalizationService ; constructor ( private readonly ow ) { this . init ( ) ; } public init ( ) { this . service = this . ow . getMainWindow ( ) . localizationService ; if ( ! this . service ) { console . warn ( 'localization init failed, retrying' ) ; setTimeout ( ( ) => this . init ( ) , 20 ) ; return ; } } public getCardImage ( cardId , options ? ) { return this . service . getCardImage ( cardId , options ) ; } public getNonLocalizedCardImage ( cardId , options ? ) { return this . service . getNonLocalizedCardImage ( cardId , options ) ; } public getCardName ( cardId , defaultName = null ) { return this . service . getCardName ( cardId , defaultName ) ; } public getCreatedByCardName ( creatorCardId ) { return this . service . getCreatedByCardName ( creatorCardId ) ; } public getUnknownCardName ( playerClass = null ) { return this . service . getUnknownCardName ( this , playerClass ) ; } public getUnknownManaSpellName ( manaCost ) { return this . service . getUnknownManaSpellName ( manaCost ) ; } public getUnknownRaceName ( race ) { return this . service . getUnknownRaceName ( race ) ; } public translateString ( key , params = null ) { return this . service . translateString ( key , params ) ; } public formatCurrentLocale ( ) { return this . service . formatCurrentLocale ( ) ; } }