承接 arteq/xliff 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arteq/xliff

Composer 安装命令:

composer require arteq/xliff

包简介

Read and write XLIFF files, simple element manipulation

README 文档

README

Description

Helper library for quick read/write memoQ generated XLIFF files. It provides easy access to plain text source/target translation unit segments, with flatten <mrk> post-edit marks (insert and delete) and replaces memoQ internal tags (<bpt>, <ept>, <sub>, <it>, <ph>, <ut>, <hi>) with one char UTF-8 symbols (black circled number 1-10, white circled number 1-20 or circled letter A-F) for simple edit in 3rd application. The tags placeholders are replaced back to oryginal XML tag elements uppon file save.

Installation

Run composer to fetch project from bitbucket repository:

$ composer require arteq/xliff

Optionally you can run tests (phpUnit, CS-Fixer, PHPStan):

$ make

Note: code quality tests require PHP 7.x. If you run PHP 5.6 you can use simplified composer_php56.json file instead and only run phpUnit tests:

$ env COMPOSER=composer_php56.json composer install
$ make phpunit

The library itself will run just fine on both PHP 5.x and 7.x.

Usage

Read file and show all content

<?php
require __DIR__ . '/vendor/autoload.php';

use ArteQ\CSX\Xliff\Xliff;

try
{
	$xliff = new Xliff();
	$xliff->readFile('sample.mqxliff');

	$fileHeader = $xliff->getFileHeader();
	$transUnits = $xliff->getTransUnits();

	// show top level <file> attributes
	var_dump($fileHeader->getAttributes());

	// show <file/header> elements with attributes
	// note: some elements are ignored during read, see: src/FileHeader.php $ignoredHeaderElements
	var_dump($fileHeader->getElements());

	// show translation units with attributes, tags and plain-text source/target
	foreach ($transUnits as $transUnit)
	{
		var_dump($transUnit->getSegment());
	}
}
catch (\Exception $e)
{
	$error = $e->getMessage();
}

Create new segment and write to file

$tu = new TransUnit();
$tu->setSegment(['source' => 'Source segment.', 'target' => 'Translated segment.', 'attributes' => ['id' => 1]]);

$this->xliff->addTransUnit($tu);
$xliff->saveFile('file.mqxliff');

Examples

For more code examples see tests directory.

For simple online parser tool see: https://test.asd123.pl/cs/xliff_debug/

arteq/xliff 适用场景与选型建议

arteq/xliff 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 121 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「translation」 「xliff」 「memoq」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 arteq/xliff 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 arteq/xliff 我们能提供哪些服务?
定制开发 / 二次开发

基于 arteq/xliff 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 121
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-13