Open sdlxliff files

I’m creating a .NET application that requires to open/read sdlxliff files created in SDL Trados Studio and then

retrieve all the translated strings.

I already downloaded and installed SDL Trados Studio 2011 SDK but cannot find any function there to read sdlxliff files.

I’ve been browsing the information available in SDK OpenExchange but couldn’t find any clue.

Can somebody provide advice on how to implement it on C#?

 

Regards,

Marco

 

Parents
  • Hi Marco,

    I'm not a developer but one of the OX developers I know suggested this:

    To implement an SDLXLIFF reader using the SDL SDK API the developer needs to get hold of the ‘ProcessParagraphUnit’ by implementing the IBilingualContentProcessor interface from the BilingualApi and then use one of the conversion methods to access that implementation like IMultiFileConverter etc… for Studio 2011 for example.

    There are plenty of examples from the File type Support Framework API; the developer just needs to …search for ProcessParagraphUnit and read/study.

    File type Support Framework 2.0 (governing custom verifiers, previews and filters)

    At the very minimum the developer will need to make reference to the following assemblies:

    • Sdl.FileTypeSupport.Framework.Core
    • Sdl.FileTypeSupport.Framework.Core.Utilities
    • Sdl.FileTypeSupport.Framework.Implementation

    Good luck!

    Paul

    Paul Filkin | RWS

    Design your own training!
    You've done the courses and still need to go a little further, or still not clear? 
    Tell us what you need in our Community Solutions Hub

  • Hi Paul,
    Can you be more specific how to use this or add link to thread which describes this in the best way from start to end, please?
    Thanks
    Petr
  • You can create and SDLXLIFF file type extension that is going to be called when the SDLXLIFF file is generated from your source file or when the target file is generated. This is possible using the Filter Component Builder. You can find more details here:

     

    Also you can have a look at this plugin wich is extending the XLIFF file type:

     

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • Hi Romulus,

    I am sorry I read your reply and code you shared several times but it is not clear. I got application working to read SDLXLIFF using

                      var mgr = DefaultFileTypeManager.CreateInstance(true);
    
                       var bilingualFilePath = file.FullName;
    
                       var conv = mgr.GetConverterToDefaultBilingual(bilingualFilePath, null, null);
    
                       var test = new AnalyseSdlxliff();
    
                       conv.AddBilingualProcessor(test);
    
                       conv.Parse();

     

    But I found that there are two issue when I would like to do Search and Replace.

    1. Is it output file needed? Is there any way how to update the input file directly? This way is slowing down whole performance of small and easy to way use application.

    2. If the output file is written the header of file is not same as in input file.

    a)

    input file: cmt-def id="536440a5-9af2-41be

    output file: cmt-def id="a6a9e4f8-3e4c

    b)

    Input: </internal-file></reference><sdl:ref-files><sdl:ref-file uid="0" id="http://www.sdl.com/Sdl.FileTypeSupport.Bilingual.Itd/OriginalFile" name="GUID-05758A9C-015D-4649-97F3-91F9625D70EE-en-us-ja-2-20150509-0400_xml.itd"

    Output: </internal-file></reference><sdl:ref-files><sdl:ref-file uid="0" id="http://www.sdl.com/Sdl.FileTypeSupport.Bilingual.Itd/OriginalFile" name="lrrznyq5.y0u.itd"

    I am not sure if these changes impact the file for processing in TMS.

    Thanks

    Petr

  • I just found that same change of SDLXLIFF header is being done by SDL Trados Studio 2015 when using "Translate Single Document".
  • 1. Studio API doesn't offer any capability to update the input file directly. To clarify this a bit more it's important to know that every Studio file type is in fact a Studio plugin (including the ones which are part of the core product). Each plugin has his own particular implementation on how it reads that particular file  which means you don't have a unique API for reading all the file types. In your case the input file is xml basically so you can write your own processing using standard .net xml processing.

    2. I'm afraid that this is not related to the API's rather is how Studio is working and you can't change that default behavior from your plugin. If you need more information about this you can raise a Studio support ticket.

    Regarding TMS I can't say much since I haven't worked it. 

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

  • I am a little bit confused.
    Add 1. Based on my understanding it is prohibited to edit SDLXLIFF files in other way then using API. Is it true or can we create our own editor using standard .net xml processin which will be much more faster then using API?

    Add 2. I will test this using SDLXLIFF files created by TMS and edited by my tool as well as Trados Studio to see if both ways are working fine.
Reply Children