承接 symfony/phrase-translation-provider 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

symfony/phrase-translation-provider

Composer 安装命令:

composer require symfony/phrase-translation-provider

包简介

Symfony Phrase Translation Provider Bridge

README 文档

README

Provides Phrase integration for Symfony Translation.

DSN example

// .env file
PHRASE_DSN=phrase://PROJECT_ID:API_TOKEN@default?userAgent=myProject

DSN elements

  • PROJECT_ID: can be retrieved in Phrase from project settings > API > Project ID
  • API_TOKEN: can be created in your Phrase profile settings
  • default: endpoint, defaults to api.phrase.com

Required DSN query parameters

  • userAgent: please read this for some examples.

See fine tuning your Phrase api calls for additional DSN options.

Phrase locale names

Translations being imported using the Symfony XLIFF format in Phrase, locales are matched on locale name in Phrase. Therefore it's necessary the locale names should be as defined in RFC4646 (e.g. pt-BR rather than pt_BR). Not doing so will result in Phrase creating a new locale for the imported keys.

Locale creation

If you define a locale in your translation.yaml which is not configured in your Phrase project, it will be automatically created. Deletion of locales however, is (currently) not managed by this provider.

Domains as tags

Translations will be tagged in Phrase with the Symfony translation domain they belong to. Check the wickedone/phrase-translation-bundle if you need help managing your tags in Phrase.

Cache

The read responses from Phrase are cached to speed up the read and delete methods of this provider and also to contribute to the rate limit as little as possible. Therefore the factory should be initialised with a PSR-6 compatible cache adapter.

Fine tuning your Phrase api calls

You can fine tune the read and write methods of this provider by adding query parameters to your dsn configuration. General usage is read|write[option_name]=value

**example: ** phrase://PROJECT_ID:API_TOKEN@default?read[encoding]=UTF-8&write[update_descriptions]=0

Read

In order to read translations from Phrase the download locale call is made to the Phrase API, supported parameters can be found in their documentation.

One additional read parameter is fallback_locale_enabled (defaults to 0). When set to 1, this provider will use the fallback locales as they are configured in Phrase.

❗enabling the fallback locale will disable the caching of the conditional get requests

Write

In order to write translations to Phrase the upload call is made to the Phrase API, supported parameters can be found in their documentation.

Default values This provider uses the following default values for read and write requests. All but file_format and tags can be overridden by configuring your DSN query parameters.

method(s) name type default value
read & write file_format string symfony_xliff
read & write tags string dynamically set to symfony translation domain
read include_empty_translations bool 1
read format_options array enclose_in_cdata
read fallback_locale_enabled bool 0
write update_translations bool 1

Sponsor

This package is looking for a backer.

Help Symfony by sponsoring its development!

Resources

symfony/phrase-translation-provider 适用场景与选型建议

symfony/phrase-translation-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44.82k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2023 年 08 月 12 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「translation」 「provider」 「phrase」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 symfony/phrase-translation-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 symfony/phrase-translation-provider 我们能提供哪些服务?
定制开发 / 二次开发

基于 symfony/phrase-translation-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 44.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-12