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

Update to support pluralizable objects for default string #901

Open
wants to merge 5 commits into
base: canary
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
safer pluralization rules
  • Loading branch information
guscost-opensea committed Aug 24, 2022
commit c552052a79197e6005c7f763f312d020f52bcfaf
3 changes: 2 additions & 1 deletion src/transCore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ export default function transCore({
// Use the default value if necessary
value =
typeof options.default === 'string' ||
typeof options.default?.other !== 'string' ||
Object.keys(options.default).some((x) => !PLURAL_KEY_REGEX.test(x))
? options.default
: getDicValue(
options.default || {},
pluralRules.select(query?.count || 0),
config,
options
)
) || options.default.other
} else if (empty) {
// no need to try interpolation
return k
Expand Down