tailrdigital/sulu-translations-bundle
最新稳定版本:0.4.0
Composer 安装命令:
composer require tailrdigital/sulu-translations-bundle
包简介
关键字:
README 文档
README
Repository abandoned 2025-11-19
This repository has moved to phpro/sulu-translations-bundle. You can follow a migration guide to upgrade your project.
Sulu Translations Bundle
This package provides a Sulu admin panel for managing your website translations.
The package includes a custom Symfony translation provider which stores your translations in a database.
Demo
sulu-translations-bundle-demo.mov
Installation
composer require tailrdigital/sulu-translations-bundle
Register the bundle
Make sure the bundle is activated in config/bundles.php:
Tailr\SuluTranslationsBundle\SuluTranslationsBundle::class => ['all' => true]
Register new admin routes
You need to manually register the failed queue admin controller routes in the file config/routes_admin.yaml.
# config/routes_admin.yaml tailr_translations: resource: '@SuluTranslationsBundle/Presentation/Controller/Admin' type: attribute prefix: /admin/api
Add node dependency
Register an additional module in your admin's node dependencies via assets/admin/package.json:
{
"dependencies": {
"sulu-translations-bundle": "file:../../vendor/tailrdigital/sulu-translations-bundle/assets/admin"
}
}
Make sure to load the additional node module in your admin's assets/admin/index.js or assets/admin/app.js file:
import 'sulu-translations-bundle';
Recompile your admin assets
cd /app/assets/admin
npm install
npm run watch
Configuration
Configuring the provider
You have to add the database provider to the Symfony translator configuration. This is an example configuration for the config/packages/translation.yaml file.
# config/packages/translation.yaml framework: translator: providers: tailr_database: dsn: 'database://default' domains: [ 'messages' ] locales: [ 'en', 'fr', 'nl' ]
Doctrine DBAL connection
The hostname in the DSN is actually your Doctrine DBAL connection name: database://<dbal_connection_name>.
If you want to store your translations in a separate database (preferred), you could configure a new DBAL connection and use the connection name in the DSN of the database translation provider.
If you are using your default DBAL connection you probably want to configure doctrine.dbal.schema_filter so your migrations doesn't try to drop the tailr_translations table.
doctrine: dbal: url: '%env(DATABASE_URL)%' schema_filter: '/^(?!(other_prefix_|tailr_translations))/'
Export format
If you want to export your translations via the administrator panel, you should define the format or extension which is used for your translation files.
# config/packages/sulu_translations.yaml sulu_translations: export_format: 'csv'
Permissions
Make sure you've set the correct permissions in the Sulu admin for this package. Go to Settings > User Roles and enable the permissions (tailr_translations) you need. Afterwards you could find the translations view/panel via Settings > Manage translations.
Usage
First make sure the database table tailr_translations is created by running the command below.
bin/console tailr:sulu-translations:setup
If you don't have local translations files (e.g. CSV) you can generate them by using the command below.
bin/console translation:extract --force --domain=messages --format=csv <locale>
Once you have local translation files, you can export them to the database by using command below.
bin/console translation:push tailr_database
Next you can update the translations via the Sulu admin panel.
Once you are done, you can export the translations back to the translations files by using the command below or clicking the Export translations button via the Sulu admin panel.
bin/console translation:pull tailr_database --force --format csv
After pulling the translations, you may need to clear the cache(s).
bin/console cache:clear bin/websiteconsole cache:clear
Sulu AI
Using AI to autocomplete missing translations is a real time-saver and can help you to quickly fill in the gaps in your translations.
If you are using the Sulu AI bundle or platform, you can use the AI translation feature to automatically translate your content. This feature is automatically enabled if you have the Sulu AI bundle installed and configured.
Known limitations
Only tested and used with CSV and YAML format.
tailrdigital/sulu-translations-bundle 适用场景与选型建议
tailrdigital/sulu-translations-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.24k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2024 年 11 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「i18n」 「sulu」 「translatsions」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tailrdigital/sulu-translations-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tailrdigital/sulu-translations-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tailrdigital/sulu-translations-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bundle for creating forms in Sulu.
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 provides command to migrate the Sulu database from phpCr to the SuluContentBundle.
Bureaux A Partager Edit - Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Simple News Bundle for Sulu 2 CMS
统计信息
- 总下载量: 5.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-22