Progress Messages

By default progress messages generated by are sent to the console / stdout by the Python wrapper. To change this behaviour and incorporate the messages into your own progress display, create a progress callback function.


Your progress function should take a single argument which will be a JSON structure describing the progress.
Install your callback by setting the member variable in your trans_pdf object:

trans_pdf.progress_display_fn = progress_fn

An example progress function:

def progress_fn(data):
    if data['timeLeft']:
        print("%s: %d%%, %s remaining" % (data['msg'], data['value'], data['timeLeft']))
        print("%s" % data['msg'])

The JSON structure in the data parameter will contain the following fields:


A brief description of the current phase of the overall task.


A measure of the amount the current task that has been done expressed as an integer percentage in the range 0 - 100


An estimate of the time remaining until the process is complete. This is in human readable form e.g. "5h 3m 22s"
This value is not always included in the JSON data.


True when a process is on-going. False once a process has finished.


An optional text description. For example upload_xliff2() returns the number of new and updated translations once complete.

After 1st May 2018, if the user doesn't have enough credit to download the XLIFF file, this text will be a description of the problem and should be returned to the user.