Entity XLIFF FTP is a Drupal extension that introduces a localization workflow whereby editors or administrators can push XLIFF files to a remote server via SFTP, then pull down processed XLIFF files when they're ready (either manually, or automatically on cron).
This extension was designed specifically to work with SDL WorldServer, but can theoretically be used with any FTP server or FTP-enabled translation management system.
- Install this module and its dependency, Composer Manager, via drush:
drush dl entity_xliff_ftp composer_manager
- Enable Composer Manager:
drush en composer_manager
- Then enable this module:
drush en entity_xliff_ftp
- Composer Manager may automatically download and enable requisite PHP
libraries, but if not, run
drush composer-manager install
ordrush composer-manager update
.
More information on installing and using Composer Manager is available on GitHub.
- To access configuration pages, grant the "administer entity xliff" permission to all roles appropriate for your site and use-case.
- Configure FTP credentials at
/admin/config/services/entity-xliff-ftp
. - On the same page, configure the "target root path" and the "source root path"
- The target root path is the path on the remote FTP server where files
will be pushed from Drupal. Within this folder, XLIFF files will be pushed
into sub-folders whose naming convention is like so:
en_to_de
, whereen
is the source language andde
is the target language. Both are the language codes associated with the language in Drupal. - The source root path is the path on the remote FTP server where this
module will assume processed or translated XLIFFs are placed. On cron, or
when manually triggered through the UI, this module will search this root
within sub-folders whose naming convention is like so:
de
, wherede
is the target language, also the language code associated with the language in Drupal.
- The target root path is the path on the remote FTP server where files
will be pushed from Drupal. Within this folder, XLIFF files will be pushed
into sub-folders whose naming convention is like so:
A remote server set up with a folder structure above would yield the following configurations:
- Target root path:
Clients/Marketing/Drupal/target
- Source root path:
Clients/Marketing/Drupal/source
Entity XLIFF, a dependency of this module, creates an "XLIFF" local task on all
entities that are known to be translatable (for example at /node/1/xliff
). By
default, XLIFF files can be downloaded or uploaded individually for each
language.
This module adds a fieldset to this page called "Remote file sync integration," which shows a select list of target languages. Choose the languages you would like this entity translated into, then press "push to remote server" to upload XLIFF files to your configured remote server.
In the future, this module may introduce Actions and/or Rules integration along with Views Bulk Operations integration to perform the same task on a large number of entities simultaneously.
This module exposes a simple admin UI that exposes "pending" and "processed"
XLIFFs, located at /admin/config/regional/translate/entity-xliff-ftp
.
Pending projects are sets of XLIFFs representing an entity that are ready on the remote server, but have not yet been pulled into Drupal (meaning, the translated XLIFFs are sitting in the "source root path" on the remote server.
Processed projects are XLIFFs that have recently been pulled into Drupal. This module knows which XLIFFs have already been imported because it moves imported files on the remote server from the configured "source root path" to a sub-directory called "processed."
If you're actively working on a project or need to import a project immediately, you can select pending projects in the aforementioned admin UI and click the "process selected projects" button to run a manual import.
This module also provides two methods to automate syncing/importing processed XLIFF files from the remote server to Drupal.
On cron: By default, this module will attempt to pull all available XLIFFs from the remote server on cron. If you wish to control how often this task is run, independent of how often you run your Drupal cron task, use a module like Elysia Cron.
Web service call: For more advanced workflows, this module opens up a web service endpoint that can be hit remotely in order to trigger, on an ad-hoc basis, the same process that's triggered on cron. For example, in your translation management system, you could add a workflow action to the end of a process that pings this web service endpoint, immediately pulling in content to Drupal. Endpoint details follow:
POST /sync-xliffs-from-remote?key=[cron_key]
A request body can be sent conditionally to process only a subset of entities and languages that are available on the remote server. It takes the following form:
[{
"entityType": "node",
"entityId": 123,
"languages": [
"zh-cn",
"de",
"ja"
]
}, {
"entityType": "taxonomy_term",
"entityId": 456,
"languages": [
"es"
]
}]
Responses:
200 OK
: Processing occurred without issue.400 Bad Request
: A request body was provided but formatted incorrectly.403 Forbidden
: Either nokey
was provided, or the key provided is invalid.405 Method Not Allowed
: The request used an unsupported method. Use POST.500 Internal Server Error
: An error occurred while processing XLIFFs.
This module and its underlying dependencies are still under active development. Use at your own risk with the intention of finding and filing bugs.