SDL Studio allows the user to merge multiple files into one bilingual document (sdlxliff). This can be done during project creation and it can be useful in situations where you have multiple small files and you might want to translate them in one go without switching between documents. If you don't already know SDL Studio is very extensible via the API's that are made available but sometimes simple things are not so simple to do by code because of software design decision or technical limitations. Merging files using SDL Studio Project Automation API can be done but is not that straight forward as you might expect and this is why I decided to write this article to show how this is done.

Create Merged Project File

Looking at the documentation you can easily find CreateMergedProjectFile method which allows you to specify the files you want to be merged and the name of the bilingual file which must have ".sdlxliff" extension. At this point this seems to be very simple but when you run this method you realize that is not actually doing much, there is no visible result on the project and the status is Not Merged.

What am I missing?

At this point you only get an MergedProjectFile object which is just a representation of the merging structure. In order to actually create the bilingual merged file we need to use Studio File Type Framework to generate the sdlxliff file. Once we have that we can use CopyToTargetLanguages to copy the merged files to all target languages we need. To make this even more clear and concrete I'm going to share a sample code that is doing all the steps I've described until now.

Conclusion

It's not that complicated to merge files using the SDL Studio API but is not obvious and intuitive. I hope this article will clarify this situation.

Please leave a comment if you have any questions or feedback.