i18next-scanner
i18next-scanner copied to clipboard
Parse text error if text has point number in tsx.
🐛 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