Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discover c-3po functions by require #44

Closed
AlexMost opened this issue Apr 7, 2017 · 5 comments
Closed

discover c-3po functions by require #44

AlexMost opened this issue Apr 7, 2017 · 5 comments
Assignees

Comments

@AlexMost
Copy link
Member

AlexMost commented Apr 7, 2017

for now c-3po functions are discovered only by imports, but it is also necessary to discover them by require to make everything work on the backend side.

babel-plugin-c-3po should be able to discover this:

const { t } = require('c-3po');
@oleksandr-kuzmenko
Copy link
Member

it works now!

const { t } = require('c-3po');
console.log(t`test text`);  // test text

@AlexMost
Copy link
Member Author

AlexMost commented Apr 20, 2017

@Alxpy This works in a library because it's a valid javascript. But it will not be extracted and resolved by babel plugin.

@snowwm
Copy link

snowwm commented Jul 19, 2018

Any updates on it? Or at least workarounds? It looks like one can use discover: [ 't' ] in babel-plugin-ttag options, but not from ttag-cli, unfortunately. Plugin options from .babelrc don't get automatically merged. It can be done manually with babel-merge, though.

@AlexMost
Copy link
Member Author

@snowwm hey, thanks for using our tool. Going to implement this feature on this week.
Also created a separate issue for merging options from .babelrc - ttag-org/ttag-cli#38

@AlexMost
Copy link
Member Author

Preminor versions with this functionality are available:

babel-plugin-ttag@1.1.0-0
ttag-cli@1.1.0-0

Feel free to report any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants