Blog

Unofficial Memsource CLI Client: An Open Source Community Project

What is the Unofficial Memsource CLI?

The Unofficial Memsource Command Line Interface or CLI is a framework and command line application to help automate tasks in Memsource. It enables command-line savvy localization experts to write simple scripts to automate repetitive tasks, such as project and job creation and running analyses. The ideal use case is when you need to process large numbers of source texts, or for security reasons you need to operate behind a firewall. The tool is also a perfect server solution, which means it enables you to automate complex localization tasks in Memsource. It is still in the early stages of development, backed by a small team, and is being maintained by an open source community.

How does it work?

The framework is able to talk to the Memsource API using a REST client and show the results of the execution on the screen or export them in json or csv formats. Implementation of the CLI application has been made much simpler thanks to the fact that Memsource’s API follows the OpenAPI standard.

How is the Unofficial Memsource CLI already being used?

A localization team in a large enterprise software company is already using it. The 3 localization project managers there process 2 million words per year so they were looking for a new way to streamline and automate their processes.

Their usual workflow for translating technical documentation is made up of 5 steps:

  1. Fetching the content from their internal Git repository using git command.
  2. Processing the files by converting them to a translatable format.
  3. Pushing the files to Memsource and assigning the jobs to translators
  4. Once jobs are completed, downloading the translated files from Memsource to their local git repository.
  5. Pushing the files up to git which triggers build in their publication system for publishing.

Using the CLI tool, they are able to automate this process with bash scripts, which is very useful, especially with large projects. They have written a simple script that uses the CLI tool together with Memsource templates to prepare all projects in Memsource.

Example:

Create a project, job, upload file to Memsource and calculate the net rate:

export NAME="Memsource Project 1"
export TEMPLATE=159165
export LANG_CODE="ja"
export FILE="test.md"

PROJECT=$(memsource project template create --name "${NAME}" --template-id 
${TEMPLATE} -c uid -f value)
memsource project show --project-id $PROJECT
JOB=$(memsource job create --filenames ${FILE} --target-langs ${LANG_CODE}
--project-id ${PROJECT} -c id -f value)
memsource job show --project-id $PROJECT --job-id $JOB
ANALYSE=$(memsource analyse language create --use-project-analysis-settings --jobs
$JOB -c analyse_id -f value)
sleep 3 # Give some time to Memsource to calculate the Net rate
memsource analyse show --analyse-id $ANALYSE

All the available commands examples can be found here.

Can I get involved?

Absolutely! As this is an open source project, the full source code is available on GitHub and you are free (and encouraged!) to submit your own enhancements to the project if you find something missing. This project can only get better with a strong community forming around it. We at Memsource are very supportive of this initiative and would love to see the project grow.

Dalibor Frivaldsky
Dalibor Frivaldsky

Memsource CTO