You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you provide additional options to createI18NReport?
I don't want to see the console for the missingKey list. Could you please add the corresponding console exposure option?
like this
export asyncfunctioncreateI18NReport(options: ReportOptions): Promise<I18NReport>{const{vueFiles: vueFilesGlob,languageFiles: languageFilesGlob,
output,
add,
remove,
exclude =[],
ci,
separator,
noEmptyTranslation ='',
missingTranslationString ='',// get show console option
showMissingKeys =true,
showUnusedKeys =true,
detect =[DetectionType.Missing,DetectionType.Unused,DetectionType.Dynamic]}=options;if(!vueFilesGlob)thrownewError('Required configuration vueFiles is missing.');if(!languageFilesGlob)thrownewError('Required configuration languageFiles is missing.');letissuesToDetect=Array.isArray(detect) ? detect : [detect];constinvalidDetectOptions=issuesToDetect.filter(item=>!Object.values(DetectionType).includes(item));if(invalidDetectOptions.length){thrownewError(`Invalid 'detect' value(s): ${invalidDetectOptions}`);}constdot=typeofseparator==='string' ? newDot(separator) : Dot;constvueFiles=readVueFiles(path.resolve(process.cwd(),vueFilesGlob));constlanguageFiles=readLanguageFiles(path.resolve(process.cwd(),languageFilesGlob));constI18NItems=extractI18NItemsFromVueFiles(vueFiles);constI18NLanguage=extractI18NLanguageFromLanguageFiles(languageFiles,dot);constreport=extractI18NReport(I18NItems,I18NLanguage,issuesToDetect);report.unusedKeys=report.unusedKeys.filter(key=>!exclude.filter(excluded=>key.path.startsWith(excluded)).length)// use show console optionif(showMissingKeys&&report.missingKeys.length)console.info('\nMissing Keys'),console.table(report.missingKeys);if(showUnusedKeys&&report.unusedKeys.length)console.info('\nUnused Keys'),console.table(report.unusedKeys);if(report.maybeDynamicKeys.length)console.warn('\nSuspected Dynamic Keys Found\nvue-i18n-extract does not compile Vue templates and therefore can not infer the correct key for the following keys.'),console.table(report.maybeDynamicKeys);if(output){awaitwriteReportToFile(report,path.resolve(process.cwd(),output));console.info(`\nThe report has been has been saved to ${output}`);}if(remove&&report.unusedKeys.length){removeUnusedFromLanguageFiles(languageFiles,report.unusedKeys,dot);console.info('\nThe unused keys have been removed from your language files.');}if(add&&report.missingKeys.length){writeMissingToLanguageFiles(languageFiles,report.missingKeys,dot,noEmptyTranslation,missingTranslationString);console.info('\nThe missing keys have been added to your language files.');}if(ci&&report.missingKeys.length){thrownewError(`${report.missingKeys.length} missing keys found.`);}if(ci&&report.unusedKeys.length){thrownewError(`${report.unusedKeys.length} unused keys found.`);}returnreport;}
The text was updated successfully, but these errors were encountered:
joojaewoo
changed the title
Can you provide additional options to createI18NReport?
Can you provide additional show console options to createI18NReport?
Jan 11, 2024
Can you provide additional options to createI18NReport?
I don't want to see the console for the missingKey list. Could you please add the corresponding console exposure option?
like this
The text was updated successfully, but these errors were encountered: