From 6a5d2999ca058b3b1cdcef2661f972103b148edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Wed, 24 Jan 2024 15:14:39 +0300 Subject: [PATCH] Fixed #14554 --- src/app/components/api/translationkeys.ts | 1 + src/app/components/multiselect/multiselect.ts | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/components/api/translationkeys.ts b/src/app/components/api/translationkeys.ts index 6472681e872..2c93a0ea02e 100644 --- a/src/app/components/api/translationkeys.ts +++ b/src/app/components/api/translationkeys.ts @@ -43,4 +43,5 @@ export class TranslationKeys { public static readonly EMPTY_FILTER_MESSAGE = 'emptyFilterMessage'; public static readonly SHOW_FILTER_MENU = 'Show Filter Menu'; public static readonly HIDE_FILTER_MENU = 'Hide Filter Menu'; + public static readonly SELECTION_MESSAGE = '{0} items selected'; } diff --git a/src/app/components/multiselect/multiselect.ts b/src/app/components/multiselect/multiselect.ts index 92cf0ecaa5d..4dd21258214 100755 --- a/src/app/components/multiselect/multiselect.ts +++ b/src/app/components/multiselect/multiselect.ts @@ -1407,12 +1407,13 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft getSelectedItemsLabel() { let pattern = /{(.*?)}/; + let message = this.selectedItemsLabel ? this.selectedItemsLabel : this.config.getTranslation(TranslationKeys.SELECTION_MESSAGE); - if (pattern.test(this.selectedItemsLabel)) { - return this.selectedItemsLabel.replace(this.selectedItemsLabel.match(pattern)[0], this.modelValue().length + ''); + if (pattern.test(message)) { + return message.replace(message.match(pattern)[0], this.modelValue().length + ''); } - return this.selectedItemsLabel; + return message; } getOptionLabel(option: any) {