monkey-front-core 0.0.519 → 0.0.520

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3684,6 +3684,21 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3684
3684
  this.translateService = translateService;
3685
3685
  this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
3686
3686
  }
3687
+ async loadInternalDefaultFromError(environment) {
3688
+ const lang = 'pt-BR';
3689
+ const url = `${environment.localAssets}/i18n/${lang}.json`;
3690
+ const resp = await this.monkeyecxService?.get(url).pipe(take(1)).toPromise();
3691
+ this.translateService.setTranslation(lang, resp.data, true);
3692
+ }
3693
+ async loadDefaultFromError(environment, name) {
3694
+ const lang = 'pt-BR';
3695
+ const url = MonkeyEcxUtils.replaceVariables(environment.urli18nAssets, {
3696
+ name,
3697
+ lang
3698
+ });
3699
+ const resp = await this.monkeyecxService?.get(url).pipe(take(1)).toPromise();
3700
+ this.translateService.setTranslation(lang, resp.data, true);
3701
+ }
3687
3702
  async loadAuth(environment, lang) {
3688
3703
  try {
3689
3704
  const url = MonkeyEcxUtils.replaceVariables(environment.urli18nAssets, {
@@ -3695,7 +3710,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3695
3710
  }
3696
3711
  catch (e) {
3697
3712
  console.error(`loadAuth i18n ${lang} not found!`);
3698
- this.monkeyecxErrorConfigService.apply('i18n');
3713
+ this.loadDefaultFromError(environment, 'auth');
3699
3714
  }
3700
3715
  }
3701
3716
  async loadAlerts(environment, lang) {
@@ -3709,7 +3724,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3709
3724
  }
3710
3725
  catch (e) {
3711
3726
  console.error(`loadAlerts i18n ${lang} not found!`);
3712
- this.monkeyecxErrorConfigService.apply('i18n');
3727
+ this.loadDefaultFromError(environment, 'alerts');
3713
3728
  }
3714
3729
  }
3715
3730
  async loadShared(environment, lang) {
@@ -3723,7 +3738,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3723
3738
  }
3724
3739
  catch (e) {
3725
3740
  console.error(`loadShared i18n ${lang} not found!`);
3726
- this.monkeyecxErrorConfigService.apply('i18n');
3741
+ this.loadDefaultFromError(environment, 'shared');
3727
3742
  }
3728
3743
  }
3729
3744
  async loadRegister(environment, lang) {
@@ -3737,7 +3752,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3737
3752
  }
3738
3753
  catch (e) {
3739
3754
  console.error(`loadRegister i18n ${lang} not found!`);
3740
- this.monkeyecxErrorConfigService.apply('i18n');
3755
+ this.loadDefaultFromError(environment, 'register');
3741
3756
  }
3742
3757
  }
3743
3758
  async loadInternal(environment, lang) {
@@ -3748,7 +3763,7 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
3748
3763
  }
3749
3764
  catch (e) {
3750
3765
  console.error(`loadInternal i18n ${lang} not found!`);
3751
- this.monkeyecxErrorConfigService.apply('i18n');
3766
+ this.loadInternalDefaultFromError(environment);
3752
3767
  }
3753
3768
  }
3754
3769
  async apply(environment) {