I am looking for how to translate text in Rust source code. I have found the gettext-crate, but is there a way to programmatically extract all translatable texts from source code?
I want to do something like this:
rust_i18n extract -outdir=out.json -format=json MySampleProject
Which would then give me a list of all translatable texts that were used in the project and store them in out.json. (Similar to goi18n for golang.)
Alternatively, is there an easy way to get the AST for a project, so I could wrap all texts in a custom struct and extract usage of that struct from the source files associated with a project? Is there a better solution?