定制 move-elevator/composer-translation-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

move-elevator/composer-translation-validator

最新稳定版本:1.3.1

Composer 安装命令:

composer require move-elevator/composer-translation-validator

包简介

A Composer plugin that validates translations files in your project regarding mismatches between language source and target files.

README 文档

README

Composer Translation Validator

Coverage CGL Tests Supported PHP Versions

A Composer plugin that validates translation files in your project. Provides a command validate-translations to check for translations mismatches, duplicates, schema validation and more. Supports XLIFF, YAML, JSON and PHP translation files.

✨ Features

???? Installation

Packagist Packagist Downloads

composer require --dev move-elevator/composer-translation-validator

???? Usage

Validate your translation files by running the command:

composer validate-translations ./translations

console.png

The command validate-translations can be used to validate translation files in your project. It will automatically detect the translation files based on the supported formats and run the configured validators. See the console command documentation for more details.

???? Documentation

Supported File Formats

Translations will be detected and grouped by the following file formats (regarding the associated frameworks):

Format Frameworks Example files
XLIFF TYPO3 CMS locallang.xlf, de.locallang.xlf
YAML Symfony messages.en.yaml, messages.de.yaml
JSON Laravel, Symfony messages.en.json, messages.de.json
PHP Laravel, Symfony en/messages.php, messages.en.php

See detailed file format and file detection documentation with examples.

Translation Validators

The following translation validators are available (and enabled by default):

Validator Description
DuplicateKeysValidator Catches duplicate keys within files
DuplicateValuesValidator Finds identical translation values
EmptyValuesValidator Detects empty or whitespace-only values
EncodingValidator Validates UTF-8 encoding and Unicode issues
HtmlTagValidator Ensures HTML tag consistency across languages
KeyCountValidator Warns when files exceed a configurable key count threshold
KeyDepthValidator Warns when translation keys have excessive nesting depth
KeyNamingConventionValidator Enforces key naming patterns (requires config)
MismatchValidator Finds missing translations between files
PlaceholderConsistencyValidator Validates placeholder patterns
XliffSchemaValidator Validates XLIFF against XML schemas

View detailed validator documentation with examples.

????‍???? Contributing

Please have a look at CONTRIBUTING.md.

⭐ License

This project is licensed under GNU General Public License 3.0 (or later).

统计信息

  • 总下载量: 13.74k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 7
  • 依赖项目数: 12
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 未知