Skip to content

Commit

Permalink
Fix #6220: MultiSelect locale selectionMessage (#6221)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Mar 25, 2024
1 parent 54df499 commit 4cafa77
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/lib/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import PrimeReact, { FilterService, PrimeReactContext } from '../api/Api';
import PrimeReact, { FilterService, PrimeReactContext, localeOption } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { ChevronDownIcon } from '../icons/chevrondown';
Expand Down Expand Up @@ -791,12 +791,13 @@ export const MultiSelect = React.memo(

const getSelectedItemsLabel = () => {
const pattern = /{(.*?)}/;
const selectedItemsLabel = props.selectedItemsLabel || localeOption('selectionMessage');

if (pattern.test(props.selectedItemsLabel)) {
return props.selectedItemsLabel.replace(props.selectedItemsLabel.match(pattern)[0], props.value.length + '');
if (pattern.test(selectedItemsLabel)) {
return selectedItemsLabel.replace(selectedItemsLabel.match(pattern)[0], props.value.length + '');
}

return props.selectedItemsLabel;
return selectedItemsLabel;
};

const getLabel = () => {
Expand Down

0 comments on commit 4cafa77

Please sign in to comment.