Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 429b32e

Browse files
committed
fix: plural "is"/"are"
ref issue #46
1 parent b332de9 commit 429b32e

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/routes/WorkPeriods/components/PeriodsSelectionMessage/index.jsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from "store/selectors/workPeriods";
1212
import { toggleWorkingPeriodsAll } from "store/actions/workPeriods";
1313
import styles from "./styles.module.scss";
14-
import { formatPlural } from "utils/formatters";
14+
import { formatIsAre, formatPlural } from "utils/formatters";
1515

1616
/**
1717
* Displays messages about the number of selected periods and selection controls.
@@ -37,11 +37,13 @@ const PeriodsSelectionMessage = ({ className }) => {
3737
{isSelectedVisible && totalCount > pageSize && (
3838
<span className={styles.message}>
3939
{isSelectedAll
40-
? `All ${formatPlural(totalCount, "record")} are selected. `
40+
? `All ${formatPlural(totalCount, "record")} ${formatIsAre(
41+
totalCount
42+
)} selected. `
4143
: `${selectedCount < pageSize ? "" : "All"} ${formatPlural(
4244
selectedCount,
4345
"record"
44-
)} on this page are selected. `}
46+
)} on this page ${formatIsAre(selectedCount)} selected. `}
4547
<span
4648
className={styles.button}
4749
onClick={onBtnClick}

src/utils/formatters.js

+10
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ export function formatPlural(count, baseWord) {
8383
return `${count} ${baseWord}${count > 1 ? "s" : ""}`;
8484
}
8585

86+
/**
87+
* Returns "is" or "are" for singular/plural phrases.
88+
*
89+
* @param {number} count
90+
* @returns {string} "is" or "are"
91+
*/
92+
export function formatIsAre(count) {
93+
return count > 1 ? "are" : "is";
94+
}
95+
8696
/**
8797
* Formats user handle link.
8898
*

0 commit comments

Comments
 (0)