I have some c++ source files, which contains comments in Italian language, is there any tool which can translate only comments to English language. I have tried Google translate, it will translate the whole file, and the // will be translated too. So, paste from the translation result from Google does not give a valid c++ source file.
Any ideas?
Thanks.
If Google translate translates well enough, here is a method that will work for C++ comments (// ...
), crude but effective:
Isolate the comments:
sed -e 's|.*//|//|' -e '/\/\//!s|.*||' sourcefile > comments
Remove the comments from the source:
sed 's|//.*||' sourcefile > barecode
Use Google translate on comments.
paste -d '\0' barecode comments > sourcefile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With