Gulp.js 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
src
test
var
web
.babelrc
.editorconfig
.eslintrc.json
.gitattributes
.gitignore
.travis.yml
AUTHORS.txt
CHANGELOG.md
LICENSE.txt
README.md
gulpfile.js
package.json

README.md

Gulp-Smartling

Release License Downloads Dependencies Code quality 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 @aquafadas/gulp-smartling

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

Tasks

All file-based tasks require three properties:

  • apiKey: string : The Smartling API key.
  • fileURI: string : A value that uniquely identifies the remote file.
  • projectId: string : The project identifier.

The other properties are optional.

Download the message translations from the Smartling service

This task takes a file pattern as input, indicating the target path of the downloaded files. The {{locale}} placeholder will be replaced by the locale of each file.

const gulp = require('gulp');
const smartling = require('@aquafadas/gulp-smartling');

gulp.task('i18n:download', smartling.download('path/to/i18n/{{locale}}.json', {
  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.
  locales: ['es-ES', 'fr-FR', 'ja-JP', 'zh-CN'], // The locales to be downloaded (required).
  projectId: 'FooBar', // The project identifier.
  retrievalType: smartling.RetrievalType.PUBLISHED // The retrieval type.
}));

Upload the message source to the Smartling service

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

const gulp = require('gulp');
const smartling = require('@aquafadas/gulp-smartling');

gulp.task('i18n:upload', smartling.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

License

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