@tilde-nlp/ngx-translate 9.1.37 → 9.1.38

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.
@@ -733,6 +733,7 @@ const i18n_en = {
733
733
  "E_413102_TITLE": "Uploading file error",
734
734
  "E_413102": "Uploaded file is too large",
735
735
  "E_400103": "Translation filtered due to content",
736
+ "E_429": "Too many requests. Please try again later.",
736
737
  "TRANSLATION_FAILED_TITLE": "Translation failed",
737
738
  "TRANSLATION_FAILED": "An unexpected error occurred.",
738
739
  "TRANSLATION_FAILED_SUPPORT": " If the problem continues, contact <a href=\"mailto:{{email}}\"><strong>support</strong></a>.",
@@ -8533,6 +8534,7 @@ class TldTranslateTextService {
8533
8534
  standbyEngineNotificationErrorKey = '21';
8534
8535
  standbySystemRetranslationTimeout = 3000;
8535
8536
  engineTermCollectionNotFoundErrorKey = '404201';
8537
+ tooManyRequestsErrorKey = '429';
8536
8538
  /** Whether progress indicator should be shown. This value must be set to true only if configured time has passed. */
8537
8539
  _shouldShowProgressIndicator = false;
8538
8540
  get shouldShowProgressIndicator() { return this._shouldShowProgressIndicator; }
@@ -8744,6 +8746,9 @@ class TldTranslateTextService {
8744
8746
  }, this.standbySystemRetranslationTimeout);
8745
8747
  throw err;
8746
8748
  }
8749
+ else if (error?.error?.code === this.tooManyRequestsErrorKey) {
8750
+ this.alertsService.error('ERRORS.E_429', err);
8751
+ }
8747
8752
  else if (error?.error?.code == this.engineTermCollectionNotFoundErrorKey) {
8748
8753
  this.alertsService.error('ERRORS.E_404201', err);
8749
8754
  }
@@ -8877,6 +8882,7 @@ class TldTranslateTextService {
8877
8882
  ...item,
8878
8883
  dictionaryDomainUrl: urls[i],
8879
8884
  sourceLabel: isTermPortalCollection ? this.translate.instant('TERM_PORTAL_NAME') : null,
8885
+ isTermPortalCollection
8880
8886
  };
8881
8887
  const termSummary = termWithSource.languageSummaries?.find((summary) => summary.lang === this.activeData.targetLanguage);
8882
8888
  if (termSummary) {
@@ -9098,13 +9104,13 @@ class TldDictionaryComponent {
9098
9104
  set dictionary(data) {
9099
9105
  this.groupDictionariesByDomain(data);
9100
9106
  }
9101
- dictionaryGroups = {};
9107
+ dictionaryGroups = [];
9102
9108
  groupDictionariesByDomain(data) {
9103
9109
  if (!data?.length) {
9104
9110
  this.dictionaryGroups = null;
9105
9111
  return;
9106
9112
  }
9107
- this.dictionaryGroups = data.reduce((acc, dictionary) => {
9113
+ const groups = data.reduce((acc, dictionary) => {
9108
9114
  const domain = dictionary.sourceLabel ?? dictionary.dictionaryDomainUrl;
9109
9115
  if (!acc[domain]) {
9110
9116
  acc[domain] = [];
@@ -9112,13 +9118,23 @@ class TldDictionaryComponent {
9112
9118
  acc[domain].push(dictionary);
9113
9119
  return acc;
9114
9120
  }, {});
9121
+ this.dictionaryGroups = Object.keys(groups)
9122
+ .map((key) => ({
9123
+ key: key,
9124
+ value: groups[key],
9125
+ }))
9126
+ .sort((a, b) => {
9127
+ const aIsTermPortal = a.value.some((d) => d.isTermPortalCollection);
9128
+ const bIsTermPortal = b.value.some((d) => d.isTermPortalCollection);
9129
+ return Number(bIsTermPortal) - Number(aIsTermPortal);
9130
+ });
9115
9131
  }
9116
9132
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TldDictionaryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
9117
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: TldDictionaryComponent, isStandalone: false, selector: "tld-dictionary", inputs: { dictionary: "dictionary" }, ngImport: i0, template: "<div *ngFor=\"let domain of dictionaryGroups | keyvalue\">\r\n\t<div fxFlex fxLayout=\"column\" class=\"dictionary-area\">\r\n\t\t<div fxFlex fxLayout=\"column\">\r\n\t\t\t<p class=\"dictionary-source\">{{ 'DICTIONARY.SOURCE' | translate: { src: domain.key | titlecase } }}</p>\r\n\r\n\t\t\t<div *ngFor=\"let dictionary of domain.value\" class=\"dictionary-target-wrapper\">\r\n\t\t\t\t<a [href]=\"dictionary.collectionUrl\" target=\"_blank\" class=\"dictionary-target-word\">{{ dictionary.targetWord }}</a>\r\n\r\n\t\t\t\t<div class=\"dictionary-word-source\">{{ dictionary.termSource }}</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", styles: [".dictionary-area{margin-top:1rem}.dictionary-source{font-size:1rem}.dictionary-source{font-weight:600}.dictionary-target-wrapper{margin-bottom:.75rem}.dictionary-target-word{font-size:1rem;font-weight:500;text-decoration:underline;color:inherit}.dictionary-word-source{font-size:.75rem;font-style:italic;color:var(--primary);margin-top:.25rem}\n"], dependencies: [{ kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "pipe", type: i3$1.TitleCasePipe, name: "titlecase" }, { kind: "pipe", type: i3$1.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] });
9133
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: TldDictionaryComponent, isStandalone: false, selector: "tld-dictionary", inputs: { dictionary: "dictionary" }, ngImport: i0, template: "<div *ngFor=\"let domain of dictionaryGroups\">\r\n\t<div fxFlex fxLayout=\"column\" class=\"dictionary-area\">\r\n\t\t<div fxFlex fxLayout=\"column\">\r\n\t\t\t<p class=\"dictionary-source\">\r\n\t\t\t\t{{ \"DICTIONARY.SOURCE\" | translate: { src: domain.key | titlecase } }}\r\n\t\t\t</p>\r\n\r\n\t\t\t<div *ngFor=\"let dictionary of domain.value\" class=\"dictionary-target-wrapper\">\r\n\t\t\t\t<a [href]=\"dictionary.collectionUrl\" target=\"_blank\" class=\"dictionary-target-word\">\r\n\t\t\t\t\t{{ dictionary.targetWord }}\r\n\t\t\t\t</a>\r\n\r\n\t\t\t\t<div class=\"dictionary-word-source\">{{ dictionary.termSource }}</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", styles: [".dictionary-area{margin-top:1rem}.dictionary-source{font-size:1rem}.dictionary-source{font-weight:600}.dictionary-target-wrapper{margin-bottom:.75rem}.dictionary-target-word{font-size:1rem;font-weight:500;text-decoration:underline;color:inherit}.dictionary-word-source{font-size:.75rem;font-style:italic;color:var(--primary);margin-top:.25rem}\n"], dependencies: [{ kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i3.DefaultFlexDirective, selector: " [fxFlex], [fxFlex.xs], [fxFlex.sm], [fxFlex.md], [fxFlex.lg], [fxFlex.xl], [fxFlex.lt-sm], [fxFlex.lt-md], [fxFlex.lt-lg], [fxFlex.lt-xl], [fxFlex.gt-xs], [fxFlex.gt-sm], [fxFlex.gt-md], [fxFlex.gt-lg]", inputs: ["fxFlex", "fxFlex.xs", "fxFlex.sm", "fxFlex.md", "fxFlex.lg", "fxFlex.xl", "fxFlex.lt-sm", "fxFlex.lt-md", "fxFlex.lt-lg", "fxFlex.lt-xl", "fxFlex.gt-xs", "fxFlex.gt-sm", "fxFlex.gt-md", "fxFlex.gt-lg"] }, { kind: "pipe", type: i3$1.TitleCasePipe, name: "titlecase" }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] });
9118
9134
  }
9119
9135
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: TldDictionaryComponent, decorators: [{
9120
9136
  type: Component,
9121
- args: [{ selector: 'tld-dictionary', standalone: false, template: "<div *ngFor=\"let domain of dictionaryGroups | keyvalue\">\r\n\t<div fxFlex fxLayout=\"column\" class=\"dictionary-area\">\r\n\t\t<div fxFlex fxLayout=\"column\">\r\n\t\t\t<p class=\"dictionary-source\">{{ 'DICTIONARY.SOURCE' | translate: { src: domain.key | titlecase } }}</p>\r\n\r\n\t\t\t<div *ngFor=\"let dictionary of domain.value\" class=\"dictionary-target-wrapper\">\r\n\t\t\t\t<a [href]=\"dictionary.collectionUrl\" target=\"_blank\" class=\"dictionary-target-word\">{{ dictionary.targetWord }}</a>\r\n\r\n\t\t\t\t<div class=\"dictionary-word-source\">{{ dictionary.termSource }}</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", styles: [".dictionary-area{margin-top:1rem}.dictionary-source{font-size:1rem}.dictionary-source{font-weight:600}.dictionary-target-wrapper{margin-bottom:.75rem}.dictionary-target-word{font-size:1rem;font-weight:500;text-decoration:underline;color:inherit}.dictionary-word-source{font-size:.75rem;font-style:italic;color:var(--primary);margin-top:.25rem}\n"] }]
9137
+ args: [{ selector: 'tld-dictionary', standalone: false, template: "<div *ngFor=\"let domain of dictionaryGroups\">\r\n\t<div fxFlex fxLayout=\"column\" class=\"dictionary-area\">\r\n\t\t<div fxFlex fxLayout=\"column\">\r\n\t\t\t<p class=\"dictionary-source\">\r\n\t\t\t\t{{ \"DICTIONARY.SOURCE\" | translate: { src: domain.key | titlecase } }}\r\n\t\t\t</p>\r\n\r\n\t\t\t<div *ngFor=\"let dictionary of domain.value\" class=\"dictionary-target-wrapper\">\r\n\t\t\t\t<a [href]=\"dictionary.collectionUrl\" target=\"_blank\" class=\"dictionary-target-word\">\r\n\t\t\t\t\t{{ dictionary.targetWord }}\r\n\t\t\t\t</a>\r\n\r\n\t\t\t\t<div class=\"dictionary-word-source\">{{ dictionary.termSource }}</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", styles: [".dictionary-area{margin-top:1rem}.dictionary-source{font-size:1rem}.dictionary-source{font-weight:600}.dictionary-target-wrapper{margin-bottom:.75rem}.dictionary-target-word{font-size:1rem;font-weight:500;text-decoration:underline;color:inherit}.dictionary-word-source{font-size:.75rem;font-style:italic;color:var(--primary);margin-top:.25rem}\n"] }]
9122
9138
  }], propDecorators: { dictionary: [{
9123
9139
  type: Input
9124
9140
  }] } });