Skip to content

Commit

Permalink
make sure parseMissingKeyHandler is called when defaultValue is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Aug 6, 2021
1 parent d0dc508 commit da47faa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### 20.x.x

- change to return false when a nullable argument is passed [1635](https://github.com/i18next/i18next/pull/1635)
- make sure parseMissingKeyHandler is called when defaultValue is provided [1354](https://github.com/i18next/react-i18next/issues/1354)

### 20.3.5

- change init warning to only trigger if not using useSSR on react-i18next
Expand Down
2 changes: 1 addition & 1 deletion src/Translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class Translator extends EventEmitter {
res = `${namespace}:${key}`;

// parseMissingKeyHandler
if (usedKey && this.options.parseMissingKeyHandler)
if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler)
res = this.options.parseMissingKeyHandler(res);
}

Expand Down

0 comments on commit da47faa

Please sign in to comment.