aquafadas/phing-smartling

Phing tasks dedicated to the synchronization of translations with the Smartling service.

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.1.0 2016-10-27 17:04 UTC

This package is not auto-updated.

Last update: 2024-01-20 15:50:55 UTC


README

Release License Downloads Code quality Build

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

Getting Started

If you haven't used Phing before, be sure to check out the related documentation, as it explains how to create a build.xml as well as install and use user tasks. Once you're familiar with that process, you may install the provided classes.

Installing via Composer

From a command prompt, run:

$ composer require --dev aquafadas/phing-smartling

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

Usage

All file-based tasks require at least four attributes:

  • fileURI: string : A value that uniquely identifies the remote file.
  • projectId: string : The project identifier.
  • userId: string : The user identifier.
  • userSecret: string : The user secret.

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.

<taskdef classname="phing\smartling\tasks\DownloadTask" name="smartlingDownload"/>

<target name="i18n:download">
  <smartlingDownload filePattern="path/to/i18n/{{locale}}.json"
    fileURI="/Phing-Smartling/messages.json"
    locales="es-ES,fr-FR,ja-JP,zh-CN"
    projectId="FooBar"
    userId="MyUserIdentifier"
    userSecret="MyTokenSecret"
  />
</target>

The supported attributes are:

  • filePattern: string (required) : The pattern indicating the target path of the downloaded files.
  • locales: array (required) : The locales to be downloaded, as a comma-separated list.
  • includeOriginalStrings: boolean = false : 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

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

<taskdef classname="phing\smartling\tasks\UploadTask" name="smartlingUpload"/>

<target name="i18n:upload">
  <smartlingUpload file="path/to/i18n/en-US.json"
    fileURI="/Phing-Smartling/messages.json"
    projectId="FooBar"
    userId="MyUserIdentifier"
    userSecret="MyTokenSecret"
  />
</target>

The supported attributes are:

  • file: string (required) : The path to the message source.
  • authorize: boolean = false : 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 file URI.

See Also

A full sample is located in the example folder:
Sample Phing Tasks

License

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