Skip to content

Commit 7917079

Browse files
committed
fallback for unescape function
1 parent 2282982 commit 7917079

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/TransWithoutContext.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,12 @@ const renderNodes = (
397397
}
398398
} else if (node.type === 'text') {
399399
const wrapTextNodes = i18nOptions.transWrapTextNodes;
400+
const unescapeFn =
401+
typeof i18nOptions.unescape === 'function'
402+
? i18nOptions.unescape
403+
: getDefaults().unescape;
400404
const content = shouldUnescape
401-
? i18nOptions.unescape(
402-
i18n.services.interpolator.interpolate(node.content, opts, i18n.language),
403-
)
405+
? unescapeFn(i18n.services.interpolator.interpolate(node.content, opts, i18n.language))
404406
: i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
405407
if (wrapTextNodes) {
406408
mem.push(createElement(wrapTextNodes, { key: `${node.name}-${i}` }, content));

0 commit comments

Comments
 (0)