diff --git a/packages/lib/locale.test.ts b/packages/lib/locale.test.ts index 4c0fe92d4..f6f152998 100644 --- a/packages/lib/locale.test.ts +++ b/packages/lib/locale.test.ts @@ -19,6 +19,8 @@ describe('locale', () => { setLocale('en_GB'); expect(_n('Copy Shareable Link', 'Copy Shareable Links', 1)).toBe('Copy Shareable Link'); expect(_n('Copy Shareable Link', 'Copy Shareable Links', 2)).toBe('Copy Shareable Links'); + expect(_n('Copy Shareable Link', 'Copy Shareable Links', -2)).toBe('Copy Shareable Links'); + expect(_n('Copy Shareable Link', 'Copy Shareable Links', 0)).toBe('Copy Shareable Links'); }); it('should translate plurals - fr_FR', () => { diff --git a/packages/lib/locale.ts b/packages/lib/locale.ts index a37308404..11083dd9e 100644 --- a/packages/lib/locale.ts +++ b/packages/lib/locale.ts @@ -691,7 +691,7 @@ function _(s: string, ...args: any[]): string { // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied function _n(singular: string, plural: string, n: number, ...args: any[]) { if (['en_GB', 'en_US'].includes(currentLocale_)) { - if (n > 1) return _(plural, ...args); + if (n !== 1) return _(plural, ...args); return _(singular, ...args); } else { const pluralFn = getPluralFunction(currentLocale_);