import { Framework } from './base' ; import { LanguageId } from '~/utils' ; class ReactFramework extends Framework { id = 'react' ; display = 'React' ; detection = { packageJSON : [ 'react-i18next' , 'react-intl' , 'next-i18next' , ] , } ; languageIds : LanguageId [ ] = [ 'javascript' , 'typescript' , 'javascriptreact' , 'typescriptreact' , 'ejs' , ] ; usageMatchRegex = [ '[^\\w\\d](?:i18nKey=|FormattedMessage[ (]\\s*id=|t\\(\\s*)[\'"`]({key})[\'"`]' , '[^\\w\\d](?:formatPlural|formatNumber|formatDate|formatTime|formatHTMLMessage|formatMessage|formatRelativeTime)\\(.*?[\'"`]?id[\'"`]?:\\s*[\'"`]({key})[\'"`]' , '<Trans>({key})<\\/Trans>' , ] ; refactorTemplates ( keypath ) { return [ `{t('${ keypath }')}` , `t('${ keypath }')` , keypath , ] ; } } export default ReactFramework ;