Skip to content

Commit

Permalink
feat(i18next): respect alternative default handling (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytelife26 committed Feb 3, 2021
1 parent fe51322 commit 5b12ba8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/i18next/src/lib/I18nextHandler.ts
Expand Up @@ -126,11 +126,15 @@ export class I18nextHandler {
const language = this.languages.get(locale);
if (!language) throw new ReferenceError('Invalid language provided');

const missingHandlers = this.options?.defaultMissingKey
? { defaultValue: language(this.options?.defaultMissingKey, { replace: { key } }) }
: {};

return language(
key,
mergeDefault(
{
defaultValue: language(this.options?.defaultMissingKey ?? 'default:default', { replace: { key } }),
...missingHandlers,
replace
},
options
Expand Down

0 comments on commit 5b12ba8

Please sign in to comment.