setono/sylius-fragment-translation-plugin
Composer 安装命令:
composer require setono/sylius-fragment-translation-plugin
包简介
Will translate fragments of text automatically
README 文档
README
Will translate fragments of text automatically.
Installation
Step 1: Install dependencies
This plugin uses the Doctrine ORM Batcher bundle. Install that first.
Step 2: Download the plugin
Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:
$ composer require setono/sylius-fragment-translation-plugin
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 3: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in config/bundles.php file of your project before (!) SyliusGridBundle:
<?php $bundles = [ Setono\SyliusFragmentTranslationPlugin\SetonoSyliusFragmentTranslationPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], ];
Step 4: Configure plugin
First import the general configuration:
# config/packages/_sylius.yaml imports: # ... - { resource: "@SetonoSyliusFragmentTranslationPlugin/Resources/config/app/config.yaml" } # ...
Then configure what resources you want to 'fragment translate':
# config/packages/setono_sylius_fragment_translation.yaml setono_sylius_fragment_translation: resource_translations: - name: sylius.product properties: - name
Step 5: Import routing
# config/routes/setono_sylius_fragment_translation.yaml setono_sylius_fragment_translation: resource: "@SetonoSyliusFragmentTranslationPlugin/Resources/config/routing.yaml"
Step 6: Update your database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Step 7: Using asynchronous transport (optional, but recommended)
All commands in this plugin will extend the CommandInterface. Therefore you can route all commands easily by adding this to your Messenger config:
# config/packages/messenger.yaml framework: messenger: routing: # Route all command messages to the async transport # This presumes that you have already set up an 'async' transport # See docs on how to setup a transport like that: https://symfony.com/doc/current/messenger.html#transports-async-queued-messages 'Setono\SyliusFragmentTranslationPlugin\Message\Command\CommandInterface': async
Usage
Step 1: Create a fragment translation
Go to /admin/fragment-translations/new and try to input:
| Field | Value |
|---|---|
| Locale | da_DK (or any other secondary locale you have created) |
| Search string | Sticker |
| Replace string | Klistermærke |
Step 2: Run CLI command
$ php bin/console setono:sylius-fragment-translation:translate
If you look in your database you should now have Danish translations for the products with names containing Sticker and the names should have been translated into Klistermærke.
Step 3: Using asynchronous transport (recommended)
# config/packages/messenger.yaml framework: messenger: routing: # Route all command messages to the async transport # This presumes that you have already set up an 'async' transport 'Setono\SyliusFragmentTranslationPlugin\Message\Command\CommandInterface': async
setono/sylius-fragment-translation-plugin 适用场景与选型建议
setono/sylius-fragment-translation-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 16.6k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 05 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「translation」 「sylius」 「sylius-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 setono/sylius-fragment-translation-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 setono/sylius-fragment-translation-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 setono/sylius-fragment-translation-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Implementation of the Omnibus Directive for Sylius application.
Bulk export of sylius resources
A custom URL rule class for Yii 2 which allows to create translated URL rules
Sylius plugin that integrates Addwish
Setono example plugin for Sylius.
A Laravel Eloquent model trait for translatable resource
统计信息
- 总下载量: 16.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-05-28