Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make other form optional #49

Merged
merged 2 commits into from
May 4, 2024
Merged

feat: make other form optional #49

merged 2 commits into from
May 4, 2024

Conversation

vladimirfilosof
Copy link
Contributor

No description provided.

@@ -15,7 +15,7 @@ export function getPluralViaIntl(key: string, value: PluralValue, count: number,
}

const pluralRules = new Intl.PluralRules(lang);
return value[pluralRules.select(count)] || value.other;
return value[pluralRules.select(count)] || value.other || value.many || value.few;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do this only for other form?

const form = pluralRules.select(count);

if (form === 'other' && typeof value.other === 'undefined') {
   return value.many || value.few;
}

return value[form];

@dgaponov dgaponov changed the title Make other form optional feat: make other form optional May 4, 2024
@dgaponov dgaponov merged commit cec6a95 into main May 4, 2024
2 checks passed
@dgaponov dgaponov deleted the make-other-optional branch May 4, 2024 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants