creative/symfony-db-i18n-bundle
Composer 安装命令:
composer require creative/symfony-db-i18n-bundle
包简介
Allow store i18n-messages in database
关键字:
README 文档
README
Sometimes You have to give the visual interface of i18n message CRUD for a customer. To do this, You need to have storage, which is not under version control and allowed from a form.
I18n messages stored in database
With this bundle i18n messages stored in a database instead of files, then, you can implement web-interface to manage it.
Installation
composer require creative/symfony-db-i18n-bundle
Bundle has not (yet) a flex auto-configurator. Add
Creative\DbI18nBundle\DbI18nBundle::class => ['all' => true],
to you config/bundles.php file, and (optional) place the db_i18n.yaml with configuration (see below) file to your config directory.
Some rules:
- you application service container must have aa array
localesparameter with possible application locales. For example:# config/services.yaml parameters: locales: [ 'ru', 'en', 'de' ]
- implementation of
Symfony\Contracts\Translation\TranslatorInterfacemust have agetCataloguemethod (usually, it have) for import messages from translation files to database. - You must define the default messages domain as
db_messagesin you views to use messages from database. For example:# templates/main.html.twig {% trans_default_domain 'db_messages' %}
- update you database schema after install this bundle — use
bin/console doctrine:schema:updatecommand or make migration for this.
So, now you can load messages from old translation files to the database. Command
bin/console creative:db-i18n:migrate translations/messages.en.yaml
will import all messages from [project root]/translations/messages.en.yaml. You can set absolute path instead, nevermind, but file name must be compatible with Symfony localization files agreement — <domain>.<locale>.<format>.
After (or instead of) that, make your forms/interfaces and add, change and so on with your messages.
Defaults
Default config is
# src/Resources/config/db_i18n.yaml db_i18n: entity: Creative\DbI18nBundle\Entity\Translation domain: db_messages
Copy this wherever you want and modify.
As you can see, the default messages domain is db_messages. If you want to override this and store default Symfony domain messages in a database, don't forget to remove (or rename) you translations/messages.<locale>.[yaml|csv|xlf] file.
creative/symfony-db-i18n-bundle 适用场景与选型建议
creative/symfony-db-i18n-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.81k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2019 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「i18n」 「translations」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 creative/symfony-db-i18n-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 creative/symfony-db-i18n-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 creative/symfony-db-i18n-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
Deepl Automated translations for Laravel lang files
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
统计信息
- 总下载量: 12.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-04-22