Gulp tasks dedicated to the synchronization of translations with the Smartling service.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
lib
test
var
www Updated the project icons Sep 10, 2017
.editorconfig
.esdoc.json
.eslintrc.yaml
.gitattributes
.gitignore
.npmignore
.nycrc
.travis.yml
AUTHORS.txt
CHANGELOG.md
LICENSE.md
README.md
gulpfile.js
package.json

README.md

Gulp-Smartling

Runtime Release License Downloads Dependencies Coverage Build

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

Getting started

If you haven't used Gulp 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.

Usage

All file-based tasks require at least four properties:

  • fileUri: string : A value that uniquely identifies the remote file.
  • projectId: string : The project identifier.
  • userId: string : The identifier used to identify the API user.
  • userSecret: string : The secret used to authenticate the API user.

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 {download} = require('@cedx/gulp-smartling');
const gulp = require('gulp');

gulp.task('i18n:download', download('path/to/i18n/{{locale}}.json', ['es-ES', 'fr-FR', 'ja-JP'], {
  fileUri: '/Gulp-Smartling/messages.json',
  projectId: 'FooBar',
  userId: 'john.doe',
  userSecret: 'MyPassword'
}));

The supported options are:

  • includeOriginalStrings: boolean = false : A value indicating whether to return the original string when no translation is available.
  • retrievalType: string = "published" : The desired format for the download.

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 {upload} = require('@cedx/gulp-smartling');
const gulp = require('gulp');

gulp.task('i18n:upload', upload('path/to/i18n/en-US.json', {
  fileUri: '/Gulp-Smartling/messages.json',
  projectId: 'FooBar',
  userId: 'john.doe',
  userSecret: 'MyPassword'
}));

The supported options are:

  • authorize: boolean = false : A value indicating whether content in the file is authorized in all locales.
  • callbackUrl: string = "" : The URL of the callback called when the file is 100% published for a locale.
  • fileType: string = "" : The file type. If empty, will be guessed from the extension of the input file.

See also

License

Gulp-Smartling is distributed under the MIT License.