Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
block: PropTypes.bool,
tag: PropTypes.string || PropTypes.func,
...Trans.propTypes,
i18nKey: PropTypes.string.isRequired,
translate: PropTypes.bool,
}),
defaultProps({
block: false,
tag: 'span',
translate: true,
}),
mapProps(({ block, parent, tag, ...rest }) => ({
parent: block ? 'div' : (parent || tag),
...rest,
})),
getContext(Trans.contextTypes)
)((props) => {
const { i18nKey, children, translate, } = props
if (!translate) {
return children
}
if (!(/^[\w.:]+$/).test(i18nKey)) {
console.error(`Invalid i18nKey '${i18nKey}' provided to T for: ${children}`)
return null
}
return ()
})