diff --git a/src/components/DisplayNameList.js b/src/components/DisplayNameList.js index cb09cb4ac..3deba980f 100644 --- a/src/components/DisplayNameList.js +++ b/src/components/DisplayNameList.js @@ -1,5 +1,6 @@ import React from 'react'; -import ListSelect from "./ListSelect"; +import intl from 'react-intl-universal'; +import ListSelect from './ListSelect'; export default function DisplayNameList({ salutation, @@ -9,25 +10,32 @@ export default function DisplayNameList({ ...restProps }) { const formats = [ - { format: '{1} {2} {3}', values: [salutation, firstName, lastName], required: [1] }, + { + format: '{1} {2} {3}', + values: [salutation, firstName, lastName], + required: [1], + }, { format: '{1} {2}', values: [firstName, lastName], required: [] }, { format: '{1}, {2}', values: [firstName, lastName], required: [1, 2] }, - { format: '{1}', values: [company], required: [1] } + { format: '{1}', values: [company], required: [1] }, ]; const formatOptions = formats - .filter((format) => !format.values.some((value, index) => { - return !value && format.required.indexOf(index + 1) !== -1; - })) + .filter( + (format) => + !format.values.some((value, index) => { + return !value && format.required.indexOf(index + 1) !== -1; + }), + ) .map((formatOption) => { const { format, values } = formatOption; let label = format; values.forEach((value, index) => { - const replaceWith = (value || ''); + const replaceWith = value || ''; label = label.replace(`{${index + 1}}`, replaceWith).trim(); }); - return { label: label.replace(/\s+/g, " ") }; + return { label: label.replace(/\s+/g, ' ') }; }); return ( @@ -35,9 +43,9 @@ export default function DisplayNameList({ items={formatOptions} selectedItemProp={'label'} textProp={'label'} - defaultText={'Select display name as'} + defaultText={intl.get('select_display_name_as')} filterable={false} - { ...restProps } + {...restProps} /> ); -} \ No newline at end of file +}