Fix result pluralization

This commit is contained in:
Greg Shuflin 2021-09-13 01:04:43 -07:00
parent 0b9cd7ff54
commit 48d8cef2fd

View File

@ -106,9 +106,10 @@ const Results = (props: ResultsProps) => {
const renderedName = renderConlang(conlang); const renderedName = renderConlang(conlang);
const searchType = (props.direction === SearchDirection.ToConlang) ? `English -> ${renderedName}` : `${renderedName} -> English`; const searchType = (props.direction === SearchDirection.ToConlang) ? `English -> ${renderedName}` : `${renderedName} -> English`;
const result = num === 1 ? 'result' : 'results';
const header = ( const header = (
<div className="searchResultHeader" key="header"> <div className="searchResultHeader" key="header">
Searched for <b>{ props.searchTerm }</b>, { searchType }, found { num } result(s) Searched for <b>{ props.searchTerm }</b>, { searchType }, found { num } { result }
</div>); </div>);
const entries = props.searchResults.map( const entries = props.searchResults.map(
(entry, _idx) => <Entry entry={ entry } key= { entry.id } conlang={ conlang } />, (entry, _idx) => <Entry entry={ entry } key= { entry.id } conlang={ conlang } />,