lukasgeiter / gettext-extractor

A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML.
MIT License
98 stars 21 forks source link

[Bug?|Question] Function name inside calleeName using callExpression #35

Open mhaamann opened 5 years ago

mhaamann commented 5 years ago

When configuring the extractor to look for the following:

JsExtractors.callExpression('context.getGt().gettext')

It fails to find code defined as:

new Error(context.getGt().gettext('Hello'));

Is this supported? Or is there something I need to write to escape the parenthesis.

lukasgeiter commented 5 years ago

Having a function call in the calleeName is currently not supported. You might be able to work around this using a getter instead of a function call since property access is supported:

JsExtractors.callExpression('context.gt.gettext')

I'm going to leave this issue open as a feature request. I'm a bit hesitant to implement this though, because I feel like the next request would be to support function arguments as well (e.g. context.get('gt').gettext) and so on...