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(next-international): plurals with count 0 works with #zero #217

Merged
merged 4 commits into from
Oct 5, 2023

Conversation

lindesvard
Copy link
Contributor

@lindesvard lindesvard commented Oct 4, 2023

Closes #199

@vercel
Copy link

vercel bot commented Oct 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-international ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 4, 2023 5:52pm

Copy link
Owner

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! After thinking more about this, I agree to land this change as it makes more sense - and it's not really a breaking change either.

I would like to include this as part of the 1.1.0 release: #205

function getPluralKey(count: number) {
if (count === 0) return 'zero';
return pluralRules.select(count);
}
const pluralRules = new Intl.PluralRules(context.locale);
Copy link
Owner

Choose a reason for hiding this comment

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

Could you move this pluralRules variable before the new getPluralKey function? We try to keep things declared before they are used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

@QuiiBz QuiiBz changed the title Improve plurals feat(next-international): plurals with count 0 works with #zero Oct 4, 2023
@QuiiBz QuiiBz added the enhancement New feature or request label Oct 4, 2023
@QuiiBz QuiiBz changed the base branch from main to feat/1.1.0 October 4, 2023 16:21
Copy link
Owner

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

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

Could we also update the documentation for both the App & Pages Router with #zero and { count: 0 }? We'll be ready to merge after that

Screenshot 2023-10-04 at 18 20 39

Copy link
Owner

@QuiiBz QuiiBz left a comment

Choose a reason for hiding this comment

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

Thanks a lot!

@QuiiBz QuiiBz merged commit 33e7a7b into QuiiBz:feat/1.1.0 Oct 5, 2023
6 checks passed
QuiiBz added a commit that referenced this pull request Oct 6, 2023
* feat(next-international): redirect default with `rewriteDefault` (#204)

* feat(next-international): Static Rendering with loading for Client Components (#202)

* feat(next-international): preserve search params (#207)

* refactor: update client provider

* feat: cache locale loading

* feat: avoid triggering suspense with useParams

* feat(next-international): plurals with count 0 works with `#zero` (#217)

* make sure zero, one, two works

* add plural key for only "zero"

* move pluralRules

* update docs

* chore: bump version

---------

Co-authored-by: Carl-Gerhard Lindesvärd <lindesvard@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve plural keys
2 participants