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:
parent
4751b4dd74
commit
d095ab2be7
@ -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', () => {
|
||||
|
@ -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_);
|
||||
|
Loading…
Reference in New Issue
Block a user