-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
🐛 Bug Report
When I used Trans instead of t, the missingKeyHandler will have field defaultValue set in opts objects. Which makes hunting the real missing keys much harder.
To Reproduce
https://codesandbox.io/p/sandbox/i18next-react-problem-cgm87w
and please look at the warning logs.
The t call doesn't have defaultValue set in opts, but Trans` components fills this field.
missingKeyHandler: (_lngs, _ns, key, fallback, _, opts) => {
console.warn(
'Missing translation key:',
key,
'Fallback value:',
fallback,
opts,
);
} <Trans i18nKey={'missing-key-TRANS'}/>
<Trans i18nKey={'missing-key-default-TRANS'} defaults={'Default_Value-TRANS'}/>
<p>{t('missing-key')}</p>
<p>{t('missing-key-default', {defalutValue: 'Default_Value'})}</p>
Expected behavior
The field defaultValue will have the same value as calling t
Your Environment
- runtime version:nodejs 22, Firefox, Vite, React
- i18next version: i.e. 19.5.3
- os: Linux
- Problematic code: https://github.com/i18next/react-i18next/blob/master/src/TransWithoutContext.js#L427-L431
Metadata
Metadata
Assignees
Labels
No labels