Monday, 2 May 2011

Beginning with OpenExchange and Microsoft Visual C# 2010 Express

OpenExchange is a quite nice way to improve SDL translation tools without having to reinvent them from the begining. SDL proposes a whole API to use the functionality of Studio and Multiterm 2009, so that private companies can insert these tools more deeply in their own project management system. Programming small applications can help win a lot of time in project management and quality insurance for example.

I made my first step to learn about the content of this API. Here are listed some steps and difficulties I met, working with Microsoft Visual C# 2010 Express.

1. Contact SDL to get a link to the API documentation: link at the bottom of this page http://www.sdl.com/en/language-technology/partners/sdl-openexchange/start-developing/.

2. Install the SDK package by clicking on "SDL SDK 2.0 Installer (sample code, project templates)" (see screenshot OpenExchange Website below)


3. In Windows "Start menu", there are now sample projects available. I made my first steps with the project automation API/batch analyser tool. The sample codes are written for Visual Studio 2008, so that the first message I got in Visual C# 2010 Express is a note about this. A conversion wizard can be launched.


A large description of this example is to be found following the link "Project Automation API 1.0 (allows automation of the project creation, project tasks, etc.)" (see screenshot OpenExchange Website above)...


4. After converting the project, I had to make three corrections to make the program work:

     A. In the "project properties", tab "application", change the "target framework" to ".NET Framework 3.5"


     B. In the project properties, tab debug, enter the argument you need, for instance "c:\temp\test c:\temp\tm\tm.sdltm /y /y /y /y"



     C. In "ProjectCreator.cs", in Region "CreateReports", the line
project.SaveTaskReportAs(reportId, path + "/AnalyzeTaskReport.xls", ReportFormat.Excel);
generated an error on my computer "Could not find report format". (Is this function not working with Excel 2007?)

I changed it with

project.SaveTaskReportAs(reportId, path + "/AnalyzeTaskReport.htm", ReportFormat.Html);
(The report will be saved in the folder you entered at the beginning)

     D. In "Program.cs", in Region "SetVariables", I corrected "args.Length == 3" (and ==4 and ==5 as well) with "args.Length >= 3".


I could run the application through the debug tool and I got these console screenshots.

I got information about the log4net error: it's only a warning. More information at log4net

The project files and folders can be found in "My Documents\SDL Trados Studio\Projects\BatchAnalyzer_DD_MM_YYYYTHH_MM_SS"

I will enjoy contact with other developpers...

6 comments:

  1. Thank you Sébastien, I was stuck with the SDK and changing it to .NET 3.5 fixed the problem.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hello, Sebastien

    I'm Ryota from Japan and I have encountered your blog when trying to figure out how to make this program work.

    First of all, thank you for all the information. Thanks to you, I have successfully made it work but I have noticed one thing. The program always seems to make an analysis without a SDLTM. In other words, it seems like it cannot correctly add a specified SDLTM to a project. So I always get only repetitions and new segments in an analysis report even when I specify a SDLTM containing some TUs that are supposed to be contained in a target file as well.

    Did this happen in your environment or did you get a correct result when you specified a non-empty SDLTM?

    This is a blog entry you put up more than a year ago but I hope you'll see my reply. Thanks. (Sorry for multiple deleted replies, I made a bunch of typos)

    ReplyDelete
  5. Hi Ryota,
    We haven't wrote any program in which we have to select a certain TM, neither server-based nor file-based. The one application that we wrote to create a project uses templates, where the TM have to be set. And everything goes on the right way: the analysis consider the TM of the templates and offer the same result as Studio does. Sorry that I can't help more...
    Sébastien

    ReplyDelete
  6. Hello, Sebastien

    Thank you for your reply which I didn't notice for a while so I've just posted the same question at the SDL community (they finally let me in today!).

    Based on your comment, this tool also might be intended to create a (empty) new TM using the specified TM as a template as well and it would be very dissapointing if so..

    Anyway, thanks again for all the information you have been providing here at this blog.

    Ryota

    ReplyDelete