1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-02 12:47:41 +02:00

All: Fixes #10581: English: Use the plural form of a localization for negative and zero items (#10582)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
Henry Heino 2024-06-14 11:37:26 -07:00 committed by GitHub
parent 4751b4dd74
commit d095ab2be7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -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', () => {

View File

@ -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_);