@porscheinformatik/clr-addons 12.4.0 → 12.4.1
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.
- package/esm2020/multilingual/abstract-multilingual.mjs +13 -9
- package/fesm2015/clr-addons.mjs +12 -8
- package/fesm2015/clr-addons.mjs.map +1 -1
- package/fesm2020/clr-addons.mjs +12 -8
- package/fesm2020/clr-addons.mjs.map +1 -1
- package/multilingual/abstract-multilingual.d.ts +2 -2
- package/package.json +1 -1
package/fesm2020/clr-addons.mjs
CHANGED
|
@@ -1532,25 +1532,29 @@ class ClrMultilingualAbstract extends ClrAbstractFormComponent {
|
|
|
1532
1532
|
setText(key, value) {
|
|
1533
1533
|
this.texts.set(key, value);
|
|
1534
1534
|
this.onChange(new Map(this.texts));
|
|
1535
|
-
this.updateShownTexts();
|
|
1535
|
+
this.updateShownTexts(key);
|
|
1536
1536
|
}
|
|
1537
|
-
updateShownTexts() {
|
|
1537
|
+
updateShownTexts(currentlyEditingLang) {
|
|
1538
1538
|
if (this.texts) {
|
|
1539
1539
|
if (this.languages) {
|
|
1540
|
-
this.shownTexts = this.applyMissingPrefix(new Map(this.languages.map(lang => [lang, this.texts.get(lang) || ''])));
|
|
1540
|
+
this.shownTexts = this.applyMissingPrefix(new Map(this.languages.map(lang => [lang, this.texts.get(lang) || ''])), currentlyEditingLang);
|
|
1541
1541
|
}
|
|
1542
1542
|
else {
|
|
1543
|
-
this.shownTexts = this.applyMissingPrefix(new Map(this.texts));
|
|
1543
|
+
this.shownTexts = this.applyMissingPrefix(new Map(this.texts), currentlyEditingLang);
|
|
1544
1544
|
}
|
|
1545
1545
|
}
|
|
1546
1546
|
}
|
|
1547
|
-
applyMissingPrefix(texts) {
|
|
1547
|
+
applyMissingPrefix(texts, currentlyEditingLang) {
|
|
1548
1548
|
if (!this.missingPrefix) {
|
|
1549
1549
|
return texts;
|
|
1550
1550
|
}
|
|
1551
|
-
|
|
1551
|
+
let fallbackText = this.determineFallbackText();
|
|
1552
|
+
if (!fallbackText) {
|
|
1553
|
+
return texts;
|
|
1554
|
+
}
|
|
1555
|
+
fallbackText = this.missingPrefix + fallbackText;
|
|
1552
1556
|
for (const lang of texts.keys()) {
|
|
1553
|
-
if (!texts.get(lang)) {
|
|
1557
|
+
if (!texts.get(lang) && lang !== currentlyEditingLang) {
|
|
1554
1558
|
texts.set(lang, fallbackText);
|
|
1555
1559
|
}
|
|
1556
1560
|
}
|
|
@@ -1574,7 +1578,7 @@ class ClrMultilingualAbstract extends ClrAbstractFormComponent {
|
|
|
1574
1578
|
if (nonEmptyTextFromHiddenTexts) {
|
|
1575
1579
|
return nonEmptyTextFromHiddenTexts;
|
|
1576
1580
|
}
|
|
1577
|
-
return
|
|
1581
|
+
return undefined;
|
|
1578
1582
|
}
|
|
1579
1583
|
showLanguageSelector() {
|
|
1580
1584
|
return this.shownTexts?.size > 1 || this.showSingleLanguageSelector;
|