承接 opencat/project 相关项目开发

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

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

opencat/project

Composer 安装命令:

composer require opencat/project

包简介

Project manifest and catpack archive format for the OpenCAT Framework

README 文档

README

Project manifest and catpack archive format for the OpenCAT Framework.

Defines catproject.json (the project configuration file) and .catpack (a portable ZIP archive that bundles source files, TM databases, glossaries, and XLIFF). Also provides pluggable stores for persisting segments and skeletons during long-running translation sessions.

Installation

composer require opencat/project

Requires ext-zip. For PostgreSQL stores, install ext-pdo_pgsql.

Project manifest

A catproject.json file describes a translation project:

{
    "name": "Annual Report 2024",
    "sourceLang": "en-US",
    "targetLangs": ["fr-FR", "de-DE"],
    "tm": [
        { "path": "tm/main.db", "readOnly": false }
    ],
    "glossaries": [
        { "path": "glossaries/legal.db", "readOnly": true }
    ],
    "mt": {
        "adapter": "deepl",
        "apiKey": "your-key-here",
        "fillThreshold": 0.75
    },
    "qa": {
        "checks": ["TagConsistencyCheck", "EmptyTranslationCheck", "NumberConsistencyCheck"],
        "failOnSeverity": "error"
    },
    "filters": {
        "docx": {},
        "xlsx": {}
    }
}

Load it with ProjectLoader:

use CatFramework\Project\ProjectLoader;

$manifest = ProjectLoader::load('/path/to/catproject.json');
echo $manifest->name;          // "Annual Report 2024"
echo $manifest->sourceLang;    // "en-US"

Catpack archive

A .catpack file is a ZIP containing:

catproject.json       — project manifest
source/               — original source files
tm/                   — SQLite TM databases (stored uncompressed)
glossaries/           — SQLite glossary databases (stored uncompressed)
xliff/                — generated XLIFF files

Creating a catpack

use CatFramework\Project\CatpackArchive;

$archive = CatpackArchive::create('project.catpack', $manifest);
$archive->addSourceFile('report.docx');
$archive->addTm('tm/main.db', 'main.db');
$archive->addGlossary('glossaries/legal.db', 'legal.db');
$archive->addXliff('report.docx.xlf', 'report.docx.xlf');
$archive->save();

Opening a catpack

$archive = CatpackArchive::open('project.catpack');
$manifest = $archive->getManifest();

$archive->extractTo('/tmp/working-dir');

Segment stores

Segment stores persist SegmentPair objects during processing, so a long-running workflow can be resumed after interruption.

Class Backend Use case
InMemorySegmentStore PHP array Tests and single-request processing
SqliteSegmentStore SQLite file Single-user, no server required
PostgresSegmentStore PostgreSQL Multi-user deployments
use CatFramework\Project\Store\SqliteSegmentStore;

$store = new SqliteSegmentStore('session.db');
$store->persistSegment($pair, $index, $fileId);

$storedPairs = $store->loadSegments($fileId);

All three implement SegmentStoreInterface.

Skeleton stores

Skeleton stores persist the filter skeleton (needed to rebuild the translated file) separately from segments.

Class Backend
FilesystemSkeletonStore Files on disk
DatabaseSkeletonStore SQLite or PostgreSQL

Both implement SkeletonStoreInterface.

MT fill threshold

MtConfig::$fillThreshold controls when MT kicks in. When WorkflowRunner finds a TM match below this score (or no match at all) it calls the MT adapter. Set to 0.0 to disable MT entirely; 0.75 means "use MT when the best TM match is below 75%".

Related packages

  • opencat/coreBilingualDocument, SegmentPair
  • opencat/workflowProjectWorkflowBuilder takes a ProjectManifest and constructs a fully wired WorkflowRunner

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固