aquafadas/phing-smartling

针对与Smartling服务同步翻译的Phing任务。

此包的规范存储库似乎已消失,因此该包已被冻结。

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任务,专注于与Smartling服务的翻译同步,基于文件API v2

入门指南

如果您以前没有使用过Phing,请确保查看相关文档,因为它解释了如何创建build.xml以及安装和使用用户任务。熟悉这个过程后,您可以安装提供的类。

通过Composer安装

从命令提示符运行

$ composer require --dev aquafadas/phing-smartling

一旦安装了构建任务,它们就可以在您的build.xml中启用。

用法

所有基于文件的任务至少需要四个属性

  • fileURI: string : 一个唯一标识远程文件的值。
  • projectId: string : 项目标识符。
  • userId: string : 用户标识符。
  • userSecret: string : 用户密钥。

从Smartling服务下载消息翻译

此任务以文件模式作为输入,指示下载文件的目标路径。将使用{{locale}}占位符替换每个文件的区域设置。

<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>

支持的属性包括

  • filePattern: string (必需) : 指示下载文件目标路径的模式。
  • locales: array (必需) : 要下载的区域设置,以逗号分隔的列表。
  • includeOriginalStrings: boolean = false : 值表示在没有翻译时是否返回原始字符串。
  • retrievalType: string = "published" : 下载所需的格式。

将消息源上传到Smartling服务

此任务以文件路径作为输入,指定要上传的消息源。

<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>

支持的属性包括

  • file: string (必需) : 消息源路径。
  • authorize: boolean = false : 值表示文件中的内容是否在所有区域设置中授权。
  • callbackUrl: string = "" : 当文件在特定区域设置为100%发布时被调用的回调URL。
  • fileType: string = "" : 文件类型。如果为空,将根据文件URI的扩展名猜测。

另请参阅

完整的示例位于example文件夹中
示例Phing任务

许可协议

Phing-Smartling 采用Apache许可证,版本2.0。