Skip to content
CAI
Software that uses CAICheck a score

symfony/translation

54.6

Adequate · 19 September 2026

9k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a comprehensive internationalization component that manages translation workflows, including extracting messages from code, loading and merging catalogues from various file formats, and syncing with external translation providers. It provides infrastructure for formatting localized content using ICU standards, debugging translation usage via profiler collectors, and validating translation integrity through linting commands. The system supports a wide range of serialization formats and offers tools for managing locale fallbacks and provider integrations.

How it got here

2010–2012 — Translation component modernization and expansion

11 changes.

The Translation component underwent a major structural overhaul, introducing a new bundle, provider system, and AST-based extraction to support a wide variety of file formats and external services. This period focused on enhancing developer tools, security, and robustness through comprehensive refactoring, new exception hierarchies, and extensive test coverage.

2013–2017 — Translation component expansion and decoupling

13 changes.

This period focused on significantly expanding the Translation component by introducing new features for catalogue management, ICU message formatting, and comprehensive CLI commands for translation workflows. The work also involved decoupling the component from the FrameworkBundle by moving dependency injection logic and adding robust test coverage for all new utilities, collectors, and formatters.

2018–2022 — Translation infrastructure modernization

10 changes.

This period focused on modernizing the translation component by introducing a provider infrastructure for external services and a new global t() helper for message creation. The work also included upgrading XLIFF schema support, switching locale data to PHP format, and implementing a PhpAst-based extractor for more accurate message extraction. Comprehensive test coverage was added for the new providers, extractors, and command suite to ensure stability.

2023–2026 — Translation component decoupling and test expansion

6 changes.

This period focused on decoupling the Translation component from the FrameworkBundle by moving cache warming logic and introducing comprehensive service configuration files for providers and debug tools. Significant effort was also dedicated to expanding test coverage, adding extensive fixtures for translation extraction, AST parsing, and support for XLIFF 2.2 features to ensure robust handling of edge cases.

Features

Add ICU MessageFormat support via IntlFormatter

The Translation component now supports the ICU MessageFormat standard for localized messages. This change introduces the IntlFormatter class and its interface, which leverage PHP's MessageFormatter to parse and format messages according to ICU rules. The existing MessageFormatter class has been updated to implement both the standard MessageFormatterInterface and the new IntlFormatterInterface, allowing it to delegate ICU-specific formatting tasks to the new IntlFormatter while maintaining backward compatibility for standard message formatting.

Formatter · high confidence

Add global t() helper for creating translatable messages

A new global helper function \t()\ is now available in the \Symfony\\Component\\Translation\ namespace. This function accepts a message string, an optional array of parameters, and an optional domain, and returns a \TranslatableMessage\ instance. The function is defined in a new \Resources/functions.php\ file and is wrapped in a \function\_exists\ check to prevent conflicts if a function with the same name is already defined.

Resources · high confidence

Introduce Translation Provider infrastructure

This change adds the core Provider component for the Translation system, introducing a new \Dsn\ class to parse and validate provider connection strings (including URL-decoded credentials), a \ProviderInterface\ defining read/write/delete operations, and a factory system (\AbstractProviderFactory\, \ProviderFactoryInterface\) to instantiate providers from DSNs. It also includes a \FilteringProvider\ to restrict translations by configured locales and domains, a \NullProvider\ for testing or disabling providers, and a \TranslationProviderCollection\ to manage multiple provider instances.

Provider · high confidence

Introduction of TranslationWriter interface and implementation

The Translation component now exposes a \TranslationWriterInterface\ and a concrete \TranslationWriter\ class. This allows users to programmatically write translation messages from a \MessageCatalogue\ to files using registered dumpers, supporting automatic directory creation and format-specific dumping logic.

Writer · high confidence

New AST-based PHP translation extractor and updated extraction interfaces

The Translation Extractor component now includes a new PhpAstExtractor that uses the nikic/php-parser library to analyze PHP code via an Abstract Syntax Tree, offering a more robust way to extract translation messages from PHP files compared to previous methods. This new extractor is built upon a refactored base class (AbstractFileExtractor) and an updated ExtractorInterface that now accepts a string or iterable of files as input, allowing users to extract messages from specific files or directories more flexibly. The ChainExtractor has also been updated to work with these new interfaces, enabling the chaining of multiple extractors for different file formats.

Extractor · high confidence

New PhpAst-based translation extractors for t(), trans(), and TranslatableMessage

The translation extractor now uses a new PhpAst-based visitor architecture (AbstractVisitor, TransMethodVisitor, TranslatableMessageVisitor, ConstraintVisitor) to parse PHP code via nikic/php-parser. This enables more accurate extraction of translation messages from t() and trans() function calls, TranslatableMessage instantiations, and validation constraints, including support for mixed named/unnamed arguments, ternary/null-coalescing expressions, and qualified function calls.

Extractor/Visitor · high confidence

New Translation Data Collector for Profiler

A new TranslationDataCollector has been added to capture translation usage statistics and locale details during request processing. This collector gathers the current locale, fallback locales, global parameters, and detailed message counts (defined, missing, and fallback matches) from the DataCollectorTranslator. The collected data is sanitized and cloned for safe storage, enabling the Web Profiler to display comprehensive translation metrics and usage counts for debugging and performance analysis.

DataCollector · high confidence

New TranslationReader interface and implementation

A new TranslationReaderInterface and its concrete TranslationReader implementation have been added to the Translation component. The reader loads translation messages from a specified directory into a MessageCatalogue by iterating over registered loaders (identified by format) and using Finder to locate matching files. This change introduces a dedicated interface for reading translations, separating the reading logic from loading, and includes type hints for parameters and return values.

Reader · high confidence

New catalogue operations for merging and targeting translations

The Translation component introduces \AbstractOperation\, \MergeOperation\, and \TargetOperation\ classes to manage how message catalogues are combined. \MergeOperation\ unions source and target catalogues, keeping all messages, while \TargetOperation\ intersects them, marking messages present in the source but missing in the target as obsolete. Both operations correctly handle metadata and international (ICU) domain suffixes, ensuring that catalogue metadata is preserved and that messages are correctly categorized as new, obsolete, or all based on their presence in the source and target locales.

Catalogue · high confidence

New translation file dumpers for CSV, INI, ICU Resource, JSON, MO, PHP, Qt, and XLIFF 2.0

The Translation component now includes a comprehensive set of new file dumpers, allowing message catalogues to be exported to additional formats. CsvFileDumper, IniFileDumper, IcuResFileDumper, JsonFileDumper, MoFileDumper, PhpFileDumper, QtFileDumper, and PoFileDumper are added to support CSV, INI, ICU Resource Bundle, JSON, Gettext MO, PHP arrays, Qt TS, and Gettext PO files respectively. Additionally, XliffFileDumper has been updated to support XLIFF 2.0 alongside the existing 1.2 format, and YamlFileDumper now supports dumping messages as a tree structure or with configurable inline depth.

Dumper · high confidence

New translation management commands and unified linting

This update introduces a suite of new console commands to streamline translation workflows. A new \lint:translations\ command validates translation messages against the configured locales and domains, reporting invalid keys. The existing \lint:xliff\ command is enhanced to support GitHub Actions annotations for CI integration and allows multiple files or directories as input. Additionally, new commands \translation:debug\ (to find unused or missing messages), \translation:extract\ (to extract keys from code), \translation:pull\ (to fetch translations from providers), and \translation:push\ (to send translations to providers) are added, along with \translation:update-xliff-sources\ to sync XLIFF source tags. These commands leverage the new \\#\[AsCommand\]\ attribute and provide autocompletion support.

Command · high confidence

New translation service configuration files for console commands, providers, and debug tools

This change introduces several new dependency-injection configuration files in Resources/config to support the Translation component's expanded capabilities. Specifically, it registers console commands for translation management (debug, extract, pull, push, lint, and XLIFF source updates), defines the core translation infrastructure (loaders, dumpers, extractors, and the locale switcher), sets up the identity translator for fallback scenarios, and configures the provider collection for external translation services (Crowdin, Loco, Lokalise, Phrase, PoEditor). It also adds configuration for the translation data collector, enabling integration with the web profiler for debugging translation usage.

Resources/config · high confidence

New translation status reporting script

A new CLI script, Resources/bin/translation-status.php, has been added to help users monitor the health of translation files. It compares translation files against reference sources (validators and security) to report missing translations and mismatches between trans-unit IDs and source text. Users can run it to view the status of all locales, filter for incomplete languages, or get verbose details for specific locales.

Resources/bin · high confidence

New translation utility classes for array conversion and XLIFF validation

Added two new utility classes to the Translation component: ArrayConverter, which converts linear message arrays into nested tree structures (e.g., 'foo.bar' to \['foo' =\> \['bar' =\> ...\]\]), and XliffUtils, which provides methods for validating XLIFF files against their XSD schemas (supporting versions 1.2, 2.0, 2.1, and 2.2) and handling schema resource loading, including fixes for phar environments and XML entity loader deprecations.

Util · high confidence

Translation Loader component restructured with new file format support

The Translation Loader component has been significantly refactored to support a wider variety of translation file formats and improve security. A new base FileLoader class now enforces that resources are local files, preventing remote file inclusion vulnerabilities. New loaders have been added for CSV, INI, JSON, MO (gettext), PO (gettext), Qt XML, and YAML formats, alongside updated loaders for ICU resource bundles and XLIFF (supporting versions 1.2, 2.0, 2.1, and 2.2). The ArrayLoader now supports nested array structures which are automatically flattened into dot-notation keys. These changes allow applications to load translations from more diverse sources while ensuring stricter validation of input resources.

Loader · high confidence

Translation component introduces a dedicated exception hierarchy

The Translation component now provides a structured set of exception classes under the \Symfony\\Component\\Translation\\Exception\ namespace, replacing or supplementing generic PHP exceptions. This includes a base \ExceptionInterface\ extending \\\Throwable\, specific exceptions for common errors (\InvalidArgumentException\, \LogicException\, \RuntimeException\), and provider-specific errors (\ProviderException\, \UnsupportedSchemeException\). Notably, \UnsupportedSchemeException\ now automatically suggests the required Composer package when a translation provider is missing, improving developer experience by guiding users to install the necessary bridge.

Exception · high confidence

Translation component restructured with new bundle, providers, and developer tools

The Translation component has been significantly reorganized and expanded. A new TranslationBundle is introduced to centralize configuration and service wiring previously handled by FrameworkBundle. The component now includes a LocaleFallbackProvider for deriving fallback locales based on ICU parent locale information, and a LocaleSwitcher service to manage locale changes across multiple services. New developer tools include a PseudoLocalizationTranslator for testing UI layouts, a DataCollectorTranslator for profiling translations in debug mode, and a LoggingTranslator for tracking missing or fallback translations. The component also adds support for translation providers (such as Phrase and PoEditor) via a new provider system, and introduces TranslatableMessage and StaticMessage objects to represent translatable content. Additionally, the CHANGELOG indicates the addition of commands like translation:update-xliff-sources and lint:translations, and support for XLIFF 2.1/2.2 and ternary/null-coalescing expression extraction.

(repo-wide) · high confidence

Updated XLIFF schema support with XLIFF 2.0/2.2 and 1.2 transitional improvements

The translation system now includes official XLIFF 2.0 and 2.2 XML schemas, enabling validation and processing of these modern file formats. The XLIFF 2.2 schema specifically adds support for the PGS module attributes. Additionally, the XLIFF 1.2 transitional schema has been updated to support the \prop-group\ and \prop\ elements, added optional \ts\ attributes to various elements, and relaxed attribute validation to allow more flexible XML structures.

Resources/schemas · high confidence

Removals

Removal of Resource interface and FileResource class from Translation component

The \ResourceInterface\ and \FileResource\ classes, previously located in the \Symfony\\Component\\Translation\\Resource\ namespace, have been removed from the codebase. This deletion eliminates the ability to track filesystem-based translation resources using the legacy \FileResource\ implementation and its associated interface, which may break existing code relying on these specific classes for resource management.

Resource · high confidence

Architecture

Translation compiler passes moved to Translation component

Compiler passes that previously lived in the FrameworkBundle's DependencyInjection directory (such as TranslatorPass, LoggingTranslatorPass, and TranslationExtractorPass) have been relocated to the Translation component. This change decouples the translation infrastructure from the FrameworkBundle, allowing the Translation component to manage its own service wiring and configuration logic independently.

DependencyInjection · high confidence

Behavioural changes

Locale fallback data format switched from JSON to PHP

The parent locale mapping data in Resources/data has been converted from a JSON file (parents.json) to a PHP array file (parents.php). This change updates the internal storage format for locale hierarchy information, which determines how the system falls back to parent locales when specific translations are missing, while maintaining the same logical mappings for languages such as English, Spanish, and Portuguese.

Resources/data · high confidence

Translation cache warming moved to the Translation component

The TranslationsCacheWarmer class has been moved from the FrameworkBundle into the Translation component. This change decouples the translation catalogue generation logic from the core framework, allowing the Translation component to manage its own cache warming behavior independently.

CacheWarmer · high confidence

Test coverage

Added test fixture for TranslatableMessage extraction in other namespaces; Added test fixtures for AST-based translation message extraction; Added test fixtures for translation extraction and resource bundle formats; Added tests for Translation Util components; Added tests for TranslationDataCollector; Added tests for the PhpAstExtractor; Added tests for translation command suite; Added tests for translation dependency injection compiler passes; Added tests for translation exception classes; Added unit tests for IntlFormatter and MessageFormatter; Added unit tests for Translation Catalogue operations; Added unit tests for Translation component services and classes; Added unit tests for TranslationWriter; Added unit tests for translation file dumpers; Added unit tests for translation file loaders; Expanded translation fixture coverage for edge cases and XLIFF 2.2 features; New test infrastructure for Translation providers and factories.

Dependencies

Symfony Translation component requires PHP 8.4+ and Symfony 8.x

The \symfony/translation\ package now mandates a minimum PHP version of 8.4.1 and is aligned with the Symfony 8 ecosystem, requiring specific Symfony components (such as \config\, \dependency-injection\, \framework-bundle\, \http-kernel\, \intl\, \routing\, and \yaml\) at versions ^7.4\|^8.0 or ^8.2. It also updates its dependency on \symfony/translation-contracts\ to ^3.6.1 and restricts \nikic/php-parser\ to version 5.0 or higher, dropping support for earlier major versions.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 55.

Lenses

  • Code Health 87
  • Architecture 95
  • Maturity 41
  • Readiness 42
  • Security 100

Changes since last survey

  • 300 commits — 263 feature/other, 37 fixes

By area

  • (repo) — 156 commits
  • (root) — 61 commits
  • Tests/Command — 14 commits
  • Tests/Fixtures — 7 commits
  • Extractor/Visitor — 6 commits
  • Command/XliffLintCommand.php — 5 commits
  • Dumper/PoFileDumper.php — 4 commits
  • Resources/bin — 4 commits
  • Loader/CsvFileLoader.php — 3 commits
  • Resources/data — 3 commits
  • Tests/Loader — 3 commits
  • Command/TranslationLintCommand.php — 2 commits
  • Command/TranslationPullCommand.php — 2 commits
  • Command/TranslationPushCommand.php — 2 commits
  • Resources/config — 2 commits
  • Tests/Catalogue — 2 commits
  • Tests/DataCollector — 2 commits
  • Tests/Provider — 2 commits
  • Tests/TranslatorCacheTest.php — 2 commits
  • Tests/Util — 2 commits

Notable commits

  • fix: PHP CS Fixer: fix minor detected issues
  • fix: Backport some CS fixes from 7.4
  • fix: CS fixes
  • fix: CS fixes
  • fix: CS fixes - native_function_invocation & static_lambda
  • fix: Fix command option mode (InputOption::VALUE_REQUIRED)
  • fix: Fix extracting of message from ->trans() method with named params
  • fix: Fix merge
  • fix: Fix multiple CS errors
  • fix: Fixes XliffFileDumperTest for 6.4
  • fix: More CS fixes
  • fix: Revert "minor #54653 Auto-close PRs on subtree-splits (nicolas-grekas)"
  • fix: Various CS fix for consistency
  • fix: Various CS fixes
  • fix: [ErrorHandler][HttpClient][Translation] Fix edge case spotted by the CI
  • fix: [FrameworkBundle][Translation] Fix translator tests colliding on a shared cache dir
  • fix: [PHPDoc] Fix various PHPDoc syntax errors
  • fix: [Translation] Fix CSV escape char in CsvFileLoader on PHP >= 7.4
  • fix: [Translation] Fix XLIFF 2 catalog metadata
  • fix: [Translation] Fix TranslationPushCommand::getDomainsFromTranslatorBag
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

symfony/translation was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit ae9e8a51bc29780d63c7f9efd6005d7c875e100b — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.