import { Framework } from './base' ; import { LanguageId } from '~/utils' ; class NextTranslateFramework extends Framework { id = 'next-translate' ; display = 'Next Translate' ; detection = { packageJSON : [ 'next-translate' , ] , } ; languageIds : LanguageId [ ] = [ 'javascript' , 'typescript' , 'javascriptreact' , 'typescriptreact' , 'ejs' , ] ; usageMatchRegex = [ '[^\\w\\d]t\\([\'"`]({key})[\'"`]' , '[^\\w\\d]t`({key})`' , 'Trans\\s+i18nKey=[\'"`]({key})[\'"`]' , ] ; refactorTemplates ( keypath ) { return [ `{t('${ keypath }')}` , `t('${ keypath }')` , keypath , ] ; } rewriteKeys ( key ) { return key . replace ( /:/g , '.' ) ; } pathMatcher ( ) { return '{locale}/{namespace}.json' ; } perferredKeystyle = 'nested' as const ; enableFeatures = { namespace : true , } ; } export default NextTranslateFramework ;