Home Manual Reference Source Test Repository


Runtime Release License Downloads Dependencies Coverage Build

Gulp.js tasks dedicated to the synchronization of translations with the Smartling service, based on the File API v1.

Getting started

If you haven't used Gulp.js before, be sure to check out the related documentation, as it explains how to create a gulpfile.js as well as install and use plugins. Once you're familiar with that process, you may install the provided Gulp tasks with this command:

$ npm install --save-dev @cedx/gulp-smartling

Once the build tasks have been installed, they may be enabled inside your gulpfile.js.


All file-based tasks require at least three properties:

Download the message translations from the Smartling service

The download task takes a file pattern and a list of locales as inputs, indicating the path of the downloaded files and their target language. The {{locale}} placeholder will be replaced by the locale of each file.

const gulp = require('gulp');
const {download} = require('@cedx/gulp-smartling');

gulp.task('i18n:download', download('path/to/i18n/{{locale}}.json', ['es-ES', 'fr-FR', 'ja-JP', 'zh-CN'], {
  apiKey: 'MyApiKey',  // The Smartling API key.
  fileURI: '/Gulp-Smartling/messages.json', // The file URL.
  includeOriginalStrings: false, // Whether to return the original string when no translation is available.
  projectId: 'FooBar', // The project identifier.
  retrievalType: smartling.RetrievalType.PUBLISHED // The retrieval type.

Upload the message source to the Smartling service

The upload task takes a file path as input, specifying the message source to be uploaded.

const gulp = require('gulp');
const {upload} = require('@cedx/gulp-smartling');

gulp.task('i18n:upload', upload('path/to/i18n/en-US.json', {
  apiKey: 'MyApiKey', // The Smartling API key.
  authorize: false, // Whether to authorize the file content in all locales.
  callbackURL: null, // URL of the callback called when the file is 100% published for a locale.
  fileType: smartling.FileType.JSON, // The file type.
  fileURI: '/Gulp-Smartling/messages.json', // The file URL.
  projectId: 'FooBar' // The project identifier.

See also


Gulp-Smartling is distributed under the Apache License, version 2.0.