Phing tasks dedicated to the synchronization of translations with the Smartling service. https://github.com/aquafadas-com/phing-smartling
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Cédric Belin 6d91041007 Updated the documentation 2 years ago
doc Added the PHPDoc configuration file 2 years ago
example Changed the naming conventions of some methods 2 years ago
lib Updated the package dependencies 2 years ago
test Fixed the unit tests 2 years ago
var Added the PHPDoc configuration file 2 years ago
web Added a project icon 2 years ago
.editorconfig Initial commit 2 years ago
.gitattributes Initial commit 2 years ago
.gitignore Initial commit 2 years ago
.travis.yml Code formatting 2 years ago
AUTHORS.txt Initial commit 2 years ago
CHANGELOG.md Updated the project URL 2 years ago
LICENSE.txt Updated the author info 2 years ago
README.md Updated the documentation 2 years ago
build.xml Bumped the version number 2 years ago
composer.json Updated the package dependencies 2 years ago
phpunit.xml Removed a useless file 2 years ago

README.md

Phing-Smartling

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.