Xml Comments Localization

Go To StackoverFlow.com


I'm going to use XML comments to document an extensibility API of an application, but I didn't find any reference to use multiple languages or any way to localize these files. I would like to use sandcastle or any other tool (ABD...?), but I don't know where to put the translated XML comments, I don't know if I should use the same XML schema,etc....

Do you have any experience about this?

2009-06-16 13:41
by QbProg


Create an XML file (are you using a schema?) that contains the comments as elements with xml:lang attributes identifying each one.

You can then use XSLT or XQuery to create versions in specific languages on-demand, or at least enable the reader to do so.

That's harder to do if you use , but if you use the above, your XSLT or XQuery could actually generate another file with the comments in the target language.

Hope this helps.

2009-06-16 13:45
by lavinio
ok, this helps! But I have an original "xml documentation file" from the API, suppose it's in english. If I copy the file and translate it it will go out of sync quickly - QbProg 2009-06-16 14:04
That's why you want to keep all of the translations in the same place. But translations getting out of sync is going to be a problem, unless everyone who maintains the file knows all of the languages - or is very disciplined or has to adhere to specific processes - lavinio 2009-06-16 14:35


This sounds like a good case for you to write an editor extension with Visual Studio 2010. The new editor makes this actually practical, and they're posting a lot of examples of doing this.

However, as the other answers have stated, first you'll need to figure out what it is you need to accomplish. You may need to extract changed comments to a file, then notify someone to start your localization process on the changes. You're probably not going to do automatic localization, but you can probably automate the process as far as gathering together the changed comments, sending them off to be localized, then incorporating the translated documents into your documentation once they return from being translated.

2009-06-16 14:39
by John Saunders