Skip to content
New issue

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

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

Already on GitHub? # to your account

Add entry value as a parameter to defaultValue function #676

Merged
merged 6 commits into from
Nov 10, 2022
Merged

Add entry value as a parameter to defaultValue function #676

merged 6 commits into from
Nov 10, 2022

Conversation

JonathanSun
Copy link
Contributor

@JonathanSun JonathanSun commented Nov 8, 2022

Why am I submitting this PR

This replaces the skipDefaultValues and useKeysAsDefaultValues with a more powerful option to use value itself as a function param.

Example:

defaultValue: (locale, namespace, key, value) => value ? value : key

Does it fix an existing ticket?

Yes #677

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • tests are included and pass: yarn test (see details here)
  • documentation is changed or added

Copy link
Member

@karellm karellm 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, the PR looks great! I've added two small comments.

test/parser.test.js Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@JonathanSun JonathanSun requested a review from karellm November 9, 2022 05:48
@karellm karellm merged commit 48bd9bb into i18next:master Nov 10, 2022
@karellm
Copy link
Member

karellm commented Nov 11, 2022

Published as 7.0.0

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants