Symfony Translation
Symfony's internationalization engine — message catalogues, pluralization, and translation-file loaders/dumpers for multiple formats
Repository Health
Technical Analysis
The Symfony Translation component provides everything needed to internationalize an application’s user-facing strings: a Translator that resolves message IDs against locale-specific catalogues, ICU-compliant pluralization rules, locale fallback chains, and loader/dumper pairs for a wide range of file formats (YAML, XLIFF, PO/MO, JSON, CSV, PHP arrays, and more). Catalogues can be built from static files or generated dynamically, and the component ships an Extractor that scans templates/code for translatable strings to keep catalogues in sync as an application grows.
Beyond the core translator, it includes developer-facing tooling — a DataCollector for the Symfony profiler showing which messages were and weren’t translated per request, a LocaleSwitcher for temporarily changing locale within a request, and a Provider abstraction for syncing catalogues with external translation management platforms (Loco, Lokalise, Crowdin).
What You Get
- A
Translatorimplementing locale resolution, fallback chains, and ICU MessageFormat pluralization - Loaders and dumpers for YAML, XLIFF, PO/MO (gettext), JSON, CSV, INI, and PHP-array catalogue formats
- An
Extractorthat scans PHP/Twig templates for translatable strings to keep catalogues complete Providerintegrations for syncing translations with external TMS platforms like Loco, Lokalise, and Crowdin- A profiler
DataCollectorand console commands for auditing missing or unused translation keys
Common Use Cases
- Serving a multi-language web application with locale-specific message catalogues and automatic fallback (e.g.
fr_CAfalling back tofr) - Extracting and syncing translatable strings with professional translators via a TMS provider integration instead of manual file editing
- Handling pluralization correctly across languages with different plural rules using ICU MessageFormat syntax
- Auditing a codebase for missing translations or orphaned catalogue keys before a release via the
translation:lint/debugconsole commands
Under The Hood
Architecture Translator.php implements TranslatorInterface, holding a set of MessageCatalogueInterface instances (one per locale, under Catalogue/) populated by format-specific Loader/ classes; Formatter/ applies ICU MessageFormat rules for pluralization, Extractor/ statically scans source files to discover translatable strings, and Provider/ implementations handle bidirectional sync with external translation-management APIs.
Tech Stack PHP 8.4+ core requiring only symfony/polyfill-mbstring and symfony/translation-contracts; optional dev/runtime integrations include symfony/console (for CLI commands), symfony/http-client-contracts (for provider sync), nikic/php-parser (for accurate PHP string extraction), and symfony/config/dependency-injection for framework wiring.
Code Quality A comprehensive Tests/ tree covers each loader/dumper format, the ICU pluralization formatter, and provider integrations individually; the component’s very active maintenance (82/100 health, ~9.7 commits/month) and 100+ tagged releases reflect long-term investment from the Symfony core team given translation is a foundational cross-cutting concern.
API Design The basic trans() API is simple and well-documented with a quick-start example in the README, but the full surface — catalogues, extractors, providers, pluralization rule syntax — takes longer to master than a narrowly scoped component, a fair trade-off for the breadth of formats and workflows it supports.
Used by 4 apps in this directory
FreeScout
Customer Support
Run your own help desk and shared inbox — a fully self-hosted, open-source alternative to Zendesk and Help Scout with no per-agent fees.
Kimai
Invoicing Finance · Project Management
Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.
Mautic
Automation · Marketing · Ecommerce
The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.
opencloud
File Storage
Open source file management and collaboration platform that keeps your data under your control, no database required.