yurijbogdanov/remote-translations-bundle
Composer 安装命令:
composer require yurijbogdanov/remote-translations-bundle
包简介
YBRemoteTranslationsBundle - Symfony bundle for using translations stored remotely (API, AWS S3, Google Sheets, PDO).
README 文档
README
Installation
The YBRemoteTranslationsBundle can be installed:
- via Terminal by executing command:
composer require yurijbogdanov/remote-translations-bundle
- via Composer by requiring the
yurijbogdanov/remote-translations-bundlepackage in your project'scomposer.json:
{
"require": {
"yurijbogdanov/remote-translations-bundle": "~1.0"
}
}
and adding an instance of YB\Bundle\RemoteTranslationsBundle\YBRemoteTranslationsBundle to your application's kernel:
class AppKernel extends Kernel { public function registerBundles() { return [ ... new YB\Bundle\RemoteTranslationsBundle\YBRemoteTranslationsBundle(), ]; } ... }
Configuration
Minimum configurations config.yml with only required options:
yb_remote_translations: api: client: endpoint: 'http://example.com/no-auth/translations/{domain}/{locale}/' awss3: client: region: 'my-region' bucket: 'my-translations-bucket' credentials: key: 'my-aws-s3-key' secret: 'my-aws-s3-secret' googlesheets: client: spreadsheet_id: 'my-google-spreadsheet-id' credentials: '%kernel.root_dir%/../var/credentials/google/my-google-project-credentials.json' pdo: ~
Full configurations config.yml:
yb_remote_translations: api: loader: class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\ApiLoader client: endpoint: 'http://example.com/basic-auth/translations/{domain}/{locale}/' class: GuzzleHttp\Client method: 'GET' auth: ['my-username', 'my-password'] headers: My-Custom-Header-Key: 'My-Custom-Header-Value' logger: logger awss3: loader: class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\AwsS3Loader client: region: 'my-region' bucket: 'my-translations-bucket' credentials: key: 'my-aws-s3-key' secret: 'my-aws-s3-secret' class: Aws\S3\S3Client version: 'latest' file_name_format: '{domain}.{locale}.csv' logger: logger googlesheets: loader: class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\GoogleSheetsLoader client: spreadsheet_id: 'my-google-spreadsheet-id' credentials: '%kernel.root_dir%/../var/credentials/google/my-google-project-credentials.json' class: Google_Service_Sheets sheet_name_format: '{domain}.{locale}' sheet_range: 'A1:B' logger: logger pdo: loader: class: YB\Bundle\RemoteTranslationsBundle\Translation\Loader\PdoLoader client: dsn: 'mysql:host=%database_host%;port=%database_port%;dbname=%database_name%' user: '%database_user%' password: '%database_password%' class: PDO table: 'translations' locale_col: 'locale' domain_col: 'domain' key_col: 'key' value_col: 'value' logger: logger
Usage
Create empty files in your Resources/translations/ folder using format %domain%.%locale%.%loader%:
- for using API create new file with extension
.api(e.g. messages.en.api) - for using AWS S3 create new file with extension
.awss3(e.g. messages.en.awss3) - for using Google Sheets create new file with extension
.googlesheets(e.g. messages.en.googlesheets) - for using PDO create new file with extension
.pdo(e.g. messages.en.pdo)
ApiLoader
Dependencies:
AwsS3Loader
Dependencies:
GoogleSheetsLoader
Dependencies:
PdoLoader
Dependencies:
MySQL
CREATE TABLE translations ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, locale VARCHAR(128) NOT NULL, domain VARCHAR(128) NOT NULL, key VARCHAR(128) NOT NULL, value TEXT NOT NULL );
PostgreSQL
CREATE TABLE translations ( id SERIAL NOT NULL, locale VARCHAR(128) NOT NULL, domain VARCHAR(128) NOT NULL, key VARCHAR(128) NOT NULL, value TEXT NOT NULL );
yurijbogdanov/remote-translations-bundle 适用场景与选型建议
yurijbogdanov/remote-translations-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 06 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「php」 「symfony-bundle」 「symfony-translation」 「symfony-translations」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yurijbogdanov/remote-translations-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yurijbogdanov/remote-translations-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yurijbogdanov/remote-translations-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
Symfony bundle for the Rekapager library
Symfony bundle for Cloudflare integration: trusted proxies, real client IP detection, forwarded headers.
Bundle Symfony DaplosBundle
A very minimal Mailchimp integration for Symfony
Alfabank REST API integration
统计信息
- 总下载量: 58
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-01