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) {