Skip to main content
Participant
September 9, 2025
Question

Is there any API for converting .book and .fm files to .xlf and vice versa?

  • September 9, 2025
  • 4 replies
  • 164 views

Currently, I convert .book and .fm to .xlf manually using Adobe FrameMaker (File → Translation → Export to XLIFF 1.2 → select export location).

Can this process be automated via an API so it run without requiring Adobe FrameMaker to be installed? Is there any official API available for this?

    4 replies

    Markus Wiedenmaier
    Inspiring
    September 9, 2025

    @frameexpert sorry, didn't read this "without requiring FM installed". 
    no there's not solution without FM being installed. If you need fully automated scenarios you need FM Publishing server as license for desktop version of FM always requires user interaction.

     

    There are only external data services like ours to integrateMIF (and other formats) in automated translation workflows without the requirement of installed FM.

    frameexpert
    Community Expert
    Community Expert
    September 9, 2025

    Markus's ExtendScript script is a great solution, but you will need to have FrameMaker installed and running in order to run it. There is no way to do this without FrameMaker being installed.

    Markus Wiedenmaier
    Inspiring
    September 9, 2025

    Hi,

    pls try out following script.

    Comment out the penultimate line and uncomment the last line if you want to automate the import. Of course, you can skip all the dialogs if you know which files you want to process.

     

    Hope this helps
    Markus

    //Syntax  XLIFF Export Syntax
    //action=xliffexport;src=SOURCEFILENAME;xts=XTSFILENAME;lang=SOURCELANG;out=OUTFILENAME
    //lang in ISO code (i.e. en-US)
    
    //Syntax  XLIFF Export Syntax
    //action=xliffimport;src=XLIFFZIPPATH;out=OUTDIRECTORY
    
    var XLIFFCLIENTNAME="XLIFF-Client";
    
    
    ExportXliff = function()
    {
        var inFile = new File().openDlg ("select input file",  "All files:*.*", false);
        if (inFile == null)
            return ;
        var outFile = new File(inFile.fsName + ".zip").saveDlg("select output file", "ZIP Files:*.zip");
        if (outFile == null)
            return ;
        var xtsFile = new File(app.HomeDir + "\\Translation\\XLIFF\\config\\default.xts").openDlg("select XTS file", "XTS file:*.xts", false);
        if (xtsFile == null)
            return ;
        var sourceLang = "en-US";
        var cmd = "action=xliffexport;";
        cmd += "src=" + inFile.fsName+ ";";
        cmd += "xts=" + xtsFile.fsName + ";";
        cmd += "lang=" + sourceLang + ";";
        cmd += "out=" + outFile.fsName + ";";
        var result = CallClient (XLIFFCLIENTNAME, cmd);
        if (result == 0)
        {
            $.writeln("Success");
        }
        else if (result < 0 && result > -10)
        {
            $.writeln("parameter errors. process cancelled");
        }
        else if (result <= -10)
        {
            $.writeln("conversion errors occurs. Check log file");
        }
    }
    
    ImportXliff = function()
    {
        //Select source file (.book; .fm; .dita; .ditamap; .xml)
        var inFile = new File().openDlg ("select XLIFF ZIP file", "ZIP Files:*.zip", false);
        if (inFile == null)
            return ;
        //!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!
        //!!!!!select empty directory, otherwise FILES may be overwritten!!!!!
        var ouDirectory = new Folder(inFile.parent).selectDlg("select output directory");
        if (ouDirectory == null)
            return ;
        var cmd = "action=xliffimport;";
        cmd += "src=" + inFile.fsName+ ";";
        cmd += "out=" + ouDirectory.fsName + ";";
        var result = CallClient (XLIFFCLIENTNAME, cmd);
        if (result == 0)
        {
            $.writeln("Success");
        }
        else if (result < 0 && result > -10)
        {
            $.writeln("parameter errors. process cancelled");
        }
        else if (result <= -10)
        {
            $.writeln("conversion errors occurs. Check log file");
        }
    }
    
    ExportXliff();
    //ImportXliff();

     

    Jeff_Coatsworth
    Community Expert
    Community Expert
    September 9, 2025

    Highly doubtful, but could probably be scripted. Check with @frameexpert or other scripters on the forum.