Open SeanHayes opened 2 years ago
In parse.js CallExpression
-> enter
I logged console.log('parent.leadingComments', parent.leadingComments);
and it's always undefined.
If I log blocks instead, it gets the comment param:
block {
msgctxt: '',
msgid: 'flag icon',
msgstr: [ '' ],
comments: { reference: [], extracted: [] },
comment: 'a comment'
}
It gets the comment, but it's still not in the .pot file.
Hi Sean,
Could you create a repo that reproduces this issue?
+1 I'm also running into this issue. Any plans to investigate @alexanderwallin? Not sure if this still waiting on a reproducible repo?
This looks like it's broken in .tsx. Can confirm it works in .ts files
@markkdev Can you check and see if the branch from #101 works for you?
Hi @alexanderwallin ,
I ran a few tests on tsx files to extract comments. Here's what I'm seeing.
export default function GettextParserExample({ text }: Props) {
const { gettext, pgettext } = useContext(AppContext);
// Translators: test123
const withTranslatorComments = pgettext('ignore-me-test', 'gettextparserexample');
return (
<div className={styles.main}>
<p>
{
// Translators: test456
gettext('gettextparserexample')
}
</p>
{/* // Translators: test789 */}
<p>{gettext('gettextparserexample')}</p>
<h2>With Context: {withTranslatorComments}</h2>
</div>
);
}
My output file is only able to extract test456
. The other two tests are not included.
Using react-gettext-parser 1.16.0
Snippet form my gulpfile.js
Snippet of code I'm trying to translate:
Neither "alt img text..." or "a comment" is extracted to my .pot file.