transi-store/symfony-translation-provider
Composer 安装命令:
composer require transi-store/symfony-translation-provider
包简介
Transi-Store Translation Provider Bridge for Symfony
README 文档
README
Provides Transi-Store integration for Symfony Translation.
Installation
composer require transi-store/translation-provider
DSN example
# .env
TRANSI_STORE_DSN=transi-store://API_KEY@default/ORG_SLUG/PROJECT_SLUG
where:
API_KEYis the API key generated from your Transi-Store organization settingsORG_SLUGis your Transi-Store organization slugPROJECT_SLUGis your Transi-Store project slug
The default host resolves to transi-store.com. You may replace it with a
custom host if you run Transi-Store behind your own domain.
How it works
Each Transi-Store file maps to a Symfony translation domain. The provider
fetches the project metadata (GET /api/orgs/{org}/projects/{project}) to
build this mapping from the filePath declared for each file (e.g.
translations/messages.<lang>.yaml ↔ domain messages).
Translations are exchanged using the XLIFF format.
Supported operations
- read: downloads XLIFF translations per locale and domain.
- write: uploads the catalogue as XLIFF per locale and domain.
- delete: not supported — calling it raises a
RuntimeException.
Configuration (Symfony)
1. Enable the bundle
If you use Symfony Flex, the bundle is enabled automatically. Otherwise,
register it manually in config/bundles.php:
// config/bundles.php return [ // ... TransiStore\TranslationProvider\TransiStoreTranslationProviderBundle::class => ['all' => true], ];
The bundle registers TransiStoreProviderFactory as a service tagged with
translation.provider_factory, so nothing else is needed in services.yaml.
2. Declare the provider
# config/packages/translation.yaml framework: translator: providers: transi_store: dsn: "%env(TRANSI_STORE_DSN)%" locales: ["en", "fr"] domains: ["messages"]
ICU Support
To use ICU message format, make sure your file paths include the +intl-icu, but before the <lang> placeholder, e.g. translations/messages+intl-icu.<lang>.yaml.
But in your domain, you should omit the +intl-icu part, e.g. messages AND you should add the --intl-icu --force option to the command.
If you don't, then Symfony will not suffix the file with +intl-icu.
Resources
统计信息
- 总下载量: 665
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-21