i18next-scanner icon indicating copy to clipboard operation
i18next-scanner copied to clipboard

Parse text error if text has point number in tsx.

Open shenghou opened this issue 3 years ago • 0 comments

🐛 Bug Report

Use scanner parser API to get words and words contains point number, such as t('version 1.23.9'), the result of parse is version 1, the 23.9 has been truncated.

To Reproduce

A codesandbox example or similar or at least steps to reproduce the behavior:

 // parse 
 const parser = new scanner.Parser();
  const filePath = getFile(`${process.cwd()}/src`, []);
  const words = [];
  filePath.forEach((path) => {
    const content = fs.readFileSync(path, 'utf-8');
    parser.parseFuncFromString(content, {
      list: ['t'],
      extensions: ['.ts', '.tsx'],
    });
    const tsxValue = parser.get();   // 1   
    const lang = Object.keys(tsxValue)[0];
    const value = tsxValue[lang]['translation'];
    words.push(...Object.keys(value));
  });

  // 

	
 // file 
 const VERSION = t('vsersion 1.2.1');


Expected behavior

A clear and concise description of what you expected to happen.

// Paste the expected results here

Your Environment

  • runtime version: i.e. node v12.18.2
  • i18next version: i.e. 19.8.4
  • i18next-scanner version: i.e. 3.0.0
  • os: Mac
  • any other relevant information

shenghou avatar Jul 06 '21 03:07 shenghou