nowo-tech/translation-yaml-tools-bundle
Composer 安装命令:
composer require nowo-tech/translation-yaml-tools-bundle
包简介
Symfony console tools for YAML translations: nested tree conversion, key sorting, and machine translation for missing keys (Google, DeepL, LibreTranslate; pluggable).
README 文档
README
⭐ Found this useful? Install from Packagist and consider starring the repository.
Symfony developer tools for YAML translation files: discover configured translation directories, convert flat dot-keys to a nested tree (with structural validation), flatten nested maps back to dot-keys at the file root, sort keys alphabetically, and fill missing keys in a target locale using Google Cloud Translation, DeepL, or LibreTranslate (pluggable MachineTranslatorInterface). The default source locale follows Symfony’s translator / kernel default locale (see docs/CONFIGURATION.md) unless you set nowo_translation_yaml_tools.default_locale.
Features
- Resolves translation paths from
translator.default_pathand fromconfig/packages/**/translation.yaml(framework.translator.default_pathandpaths). - Interactive console flow (arrow keys) to pick domain; for
tree,flatten, andsort,--localeis optional (omit to process every locale for that domain). Non-interactive:--domainalone runs all locales;--localelimits to one file. Other commands (e.g.fill-missing) keep their own locale / target options. nowo:translation-yaml:tree— validates that dot-keys can be represented as a nested tree; on failure prints the conflicting prefix. Optional--fix-leaf-prefixrenames blocking leaves (suffix configurable viayaml_tree_leaf_prefix_suffix, defaultindex).nowo:translation-yaml:flatten— writes a one-level map with dot-separated keys (inverse of the tree layout).nowo:translation-yaml:sort— recursive alphabetical sort of associative keys.nowo:translation-yaml:fill-missing— merges missing keys into a target locale using the configured machine translator (Google, DeepL, or LibreTranslate); optional--treeoutput with the same validation as the tree command.nowo:translation-yaml:audit— read-only report: tree-safe YAML, alphabetical key order, missing keys vs source locale; compact OK line per domain when everything passes.- Configurable YAML indent (
yaml_tree_indent) and leaf-prefix suffix (yaml_tree_leaf_prefix_suffixfortree --fix-leaf-prefix) for dumps / renames.
Requirements
- PHP
>=8.2 <8.6(Symfony 8.x apps need PHP 8.4+) - Symfony
^7.0 || ^8.0(FrameworkBundle, Console, HttpClient, Yaml, …) - For fill-missing: enable
framework.http_client: true, choosemachine_translatorin config, and setGOOGLE_TRANSLATE_API_KEY(Google) orDEEPL_AUTH_KEY(DeepL) when using those backends; LibreTranslate needs no paid key for open instances (seedocs/CONFIGURATION.md).
Quick install
composer require --dev nowo-tech/translation-yaml-tools-bundle
Register the bundle in config/bundles.php for dev (Flex recipe does this). See Installation.
Demos (Symfony 7 & 8)
FrankenPHP sample apps live under demo/: Web Profiler, Twig Inspector (nowo-tech/twig-inspector-bundle), explicit framework.enabled_locales / translator configuration, two translation directories (translations/ + translations_extra/), and a web page at / that summarizes default locale, enabled locales, YAML paths, missing files per domain, and missing keys vs the default locale. In dev, the demos also enable missing_translation_log (SQLite, event_dispatcher flush strategy, optional Web UI) — see demo/README.md.
make -C demo up-symfony7 # default PORT 8037 — see demo/symfony7/.env.example make -C demo up-symfony8 # default PORT 8038
FrankenPHP worker mode: Supported in production Caddyfile; development uses Caddyfile.dev without worker (see docs/DEMO-FRANKENPHP.md).
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
Tests and coverage
- PHP: run
make test-coverageand read the finalGlobal PHP coverage (Lines): …line in the output (1.0.0+ maintains 100% line coverage onsrc/and PHPStan level 8 onsrc/+tests/; seedocs/CHANGELOG.md). - TS/JS: N/A
- Python: N/A
Version information
1.1.2 is the current stable 1.x release (PHP 8.2+, Symfony 7+ / 8.x). See UPGRADING when moving from 1.1.1, 1.1.0, 1.0.x, or earlier.
See SECURITY POLICY for supported versions.
License
This bundle is released under the MIT License. See LICENSE.
nowo-tech/translation-yaml-tools-bundle 适用场景与选型建议
nowo-tech/translation-yaml-tools-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 956 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「yaml」 「i18n」 「translation」 「bundle」 「Devtools」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nowo-tech/translation-yaml-tools-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nowo-tech/translation-yaml-tools-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nowo-tech/translation-yaml-tools-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use i18n translation PHP class for multi-language websites
A custom URL rule class for Yii 2 which allows to create translated URL rules
The bundle for easy using json-rpc api on your project
Bureaux A Partager Edit - Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Nette Framework adapter for I18n package
Yii2 integration for AirBnB Polyglot.js
统计信息
- 总下载量: 956
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 41
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-09