Skip to content

Commit

Permalink
stringfying only messages.ts file
Browse files Browse the repository at this point in the history
  • Loading branch information
Can-Sahin committed Sep 5, 2020
1 parent f3fb9b9 commit f4d2682
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internals/extractMessages/i18next-scanner.config.js
Expand Up @@ -41,17 +41,21 @@ module.exports = {
const { base, ext } = path.parse(file.path);
if (extensions.includes(ext) && !base.includes('.d.ts')) {
const content = fs.readFileSync(file.path, enc);
parseContent(content, this.parser);
const shouldStringfyObjects = base === 'messages.ts';
parseContent(content, this.parser, shouldStringfyObjects);
}

done();
},
};
function parseContent(content, parser) {
function parseContent(content, parser, shouldStringfyObjects = true) {
const { outputText } = typescript.transpileModule(content, {
compilerOptions: compilerOptions,
});
const cleanedContent = stringfyTranslationObjects(outputText);
let cleanedContent = outputText;
if (shouldStringfyObjects) {
cleanedContent = stringfyTranslationObjects(outputText);
}
parser.parseFuncFromString(cleanedContent);
}

Expand Down

0 comments on commit f4d2682

Please sign in to comment.