@hmcts/ccd-case-ui-toolkit 7.3.43-exui-4368-rc-1 → 7.3.43-exui-4297

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.
@@ -6624,7 +6624,6 @@ class LabelSubstitutorDirective {
6624
6624
  contextFields = [];
6625
6625
  formGroup;
6626
6626
  elementsToSubstitute = ['label', 'hint_text'];
6627
- initialLabel;
6628
6627
  initialHintText;
6629
6628
  languageSubscription;
6630
6629
  constructor(fieldsUtils, placeholderService, rpxTranslationPipe, rpxTranslationService) {
@@ -6634,10 +6633,9 @@ class LabelSubstitutorDirective {
6634
6633
  this.rpxTranslationService = rpxTranslationService;
6635
6634
  }
6636
6635
  ngOnInit() {
6637
- this.initialLabel = this.caseField.label;
6638
6636
  this.initialHintText = this.caseField.hint_text;
6639
- this.noCacheProcessing();
6640
6637
  this.caseField.originalLabel = this.caseField.label;
6638
+ this.noCacheProcessing();
6641
6639
  this.formGroup = this.formGroup || new FormGroup({});
6642
6640
  this.languageSubscription = this.rpxTranslationService.language$.pipe(skip(1)).subscribe(() => {
6643
6641
  this.onLanguageChange();
@@ -6660,17 +6658,15 @@ class LabelSubstitutorDirective {
6660
6658
  }
6661
6659
  }
6662
6660
  }
6663
- applySubstitutions(isLanguageChange = false) {
6661
+ applySubstitutions() {
6664
6662
  const fields = this.getReadOnlyAndFormFields();
6665
6663
  if (this.shouldSubstitute('label')) {
6666
6664
  const oldLabel = this.caseField.label;
6667
6665
  const substitutedLabel = this.resolvePlaceholders(fields, this.caseField.label);
6668
6666
  if (oldLabel && oldLabel !== substitutedLabel) {
6669
6667
  // we need to translate the uninterpolated data then substitute the values in translated string
6670
- this.caseField.originalLabel = oldLabel;
6671
- const translated = isLanguageChange && this.rpxTranslationService.language === 'en'
6672
- ? oldLabel
6673
- : this.rpxTranslationPipe.transform(oldLabel);
6668
+ this.caseField.originalLabel = substitutedLabel;
6669
+ const translated = this.rpxTranslationPipe.transform(oldLabel);
6674
6670
  const transSubstitutedLabel = this.resolvePlaceholders(fields, translated);
6675
6671
  this.caseField.label = transSubstitutedLabel;
6676
6672
  this.caseField.isTranslated = this.rpxTranslationService.language === 'cy' && translated !== oldLabel;
@@ -6688,16 +6684,13 @@ class LabelSubstitutorDirective {
6688
6684
  }
6689
6685
  }
6690
6686
  onLanguageChange() {
6691
- this.resetToInitialValues(true);
6692
- this.applySubstitutions(true);
6687
+ this.resetToInitialValues();
6688
+ this.applySubstitutions();
6693
6689
  }
6694
- resetToInitialValues(isLanguageChange = false) {
6695
- if (isLanguageChange && this.caseField?.originalLabel) {
6690
+ resetToInitialValues() {
6691
+ if (this.caseField?.originalLabel) {
6696
6692
  this.caseField.label = this.caseField.originalLabel;
6697
6693
  }
6698
- if (!isLanguageChange && this.initialLabel) {
6699
- this.caseField.label = this.initialLabel;
6700
- }
6701
6694
  if (this.initialHintText) {
6702
6695
  this.caseField.hint_text = this.initialHintText;
6703
6696
  }