-
Notifications
You must be signed in to change notification settings - Fork 382
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
Extract messages from TypeScript files #48
Comments
Sounds good. What babel plugins are required to parse typescript files? |
Hmm... A little bit of googling seems to indicate the PR for typescript plugins for babel hasn't landed yet. babel/babel#5899 |
Messages from The intermediate dictionaries have a this format: {
"message id": {
"defaults": "",
"origin": [
[
"fileName",
62 # line number
]
]
},
"another message": {
}
} Where Once we have these build files, we can merge then using API from Are you willing to write the typescript part? I would update |
I took a quick stab at it. What I have is here, with both ts and js versions. All the fancy file handling is missing. Currently the |
Awesome, thank you! I'll integrate it most probably tomorrow. |
Sorry, I was busy with my job and didn't get any chance to work on this issue. I'll continue after 13th August as I'm going on a vacation now. |
Hi! I finally refactored cli to support other preprocessors than babel. I created package However, I'm not able to compile it. Could you please send me configuration which you used to compile this file? |
You need to add Then you also need to set the target to es6 to get
|
@tricoder42 looks like /api/extractors/typescript.js doesn't do anything yet. It shouldn't be difficult to link it to typescript-lingui-extract-messages by @johansigfrids I guess? |
You're right, Are you willing to help me with this? If you don't have time for full PR I would appreciate at least an example typescript files which I can use for testing. |
I might be able to help. But I am wondering why it is necessary to have plugin also as a |
It's not necessary, but @johansigfrids wrote it in Typescript and I don't mind. It's not a problem at all either way. |
@tricoder42 I will try to compile it and do a PR. I might have some questions here and there. If there any better ways to reach you other than here, let me know. |
We were able to compile TS file as https://gist.github.com/papoola/fc0e73c732f7541b2f5891a141b7798f but apparently this is wrong file format and cannot be imported by require @tricoder42 I have used this for extractor https://gist.github.com/papoola/f9ccc6b9f431b0dd81510b9defcc412a not sure I have got the syntax right? We need this for Typescript in React. |
Have you used the command provided by @johansigfrids?
I'll take a look this weekend, I promise! I'm just finishing one project and I'm already few days behind... I'll ping you once I have it running and ready for tests. Meanwhile, could you please copy-paste a snippet of a component written in TS which uses jsLingui? I'll use it for initial testing. Thanks a lot! |
@tricoder42 yes, I used same line I just created above PR with my code + a test react project with jsLingui so you can test it. Hope you can get typescript extraction working :-) Let me know if you need anything else. |
Unfortunately, this is more complex than I expected. I'm closing this in favor of #151. It needs somebody with typescript experience to get the full test suit going. |
It would be really nice if the cli could extract messages from
.tsx?
files as well.The text was updated successfully, but these errors were encountered: