rboarman
rboarman

Reputation: 8214

Translating comments and region names in source code

Does anyone know of a batch processor or a VS 2010 plugin/script that would let me translate comments and region names from Chinese into English?

The only ones I've found either process all strings or only one string at a time.

I have two large C# projects that I am trying to read through.

Thanks.

Upvotes: 9

Views: 1931

Answers (3)

Sylver
Sylver

Reputation: 8967

Use PrepTags to prepare your file for translation. It will allow you to select the text to be translated based on regex.

www.preptags.com

You can work file by file for free, or process the files as batch using the pro version (€39)

In your case, it's pretty simple to prepare. You just mark everything as protected, then unprotect the content of the comments & region names.

Disclosure: I develop PrepTags.

Upvotes: 1

Tanner Watson
Tanner Watson

Reputation: 270

I'm not too sure if this is possible. What you can do to help would be the following: 1) Make sure that both C# projects have the Properties > Build > Xml document file check box checked. 2.1) Write an application that reads in the generated xml file. 2.2) Parse the file, and for each value make a call to Google Translate to get the translated value. 2.3) Place the translated value within another xml file that has the same structure as the one created from building the project.

This wouldn't solve the your desire to translate the region names, but its a start. At least you would have intelligence when using the two projects.

This is actually a good idea for a small open source project. I may decide to pick it up. If I do, I'll let you know.

Upvotes: 0

Primary Key
Primary Key

Reputation: 1237

As was noted, you can use Google Translate API or alternatively Bing Translator API. You can detect comments and regions in your files using System.CodeDom.

Upvotes: 0

Related Questions