Skip to content
CAI
Software that uses CAICheck a score

symfony/translation

50.5

Adequate · 17 November 2026

9.7k

lines of production code

PHP

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add global \`t()\` helper for creating translatable messages

A new global \t()\ function has been added to the \Symfony\\Component\\Translation\ namespace, allowing users to create \TranslatableMessage\ instances directly without instantiating the class. This helper accepts a message string, an optional array of parameters, and an optional domain, providing a more concise syntax for defining translatable content in applications.

Resources · high confidence

Added XLIFF 1.2 subset schema and XLIFF 2.0/2.2 schemas for validation

The translation system now includes a new, faster XLIFF 1.2 subset schema (xliff-core-1.2-subset.xsd) to accelerate validation of common files, alongside newly added XLIFF 2.0 and 2.2 schema definitions. The XLIFF 2.2 schema specifically supports the PGS module by allowing additional attributes on segments. Additionally, the existing XLIFF 1.2 transitional schema has been updated to include support for property groups (prop-group/prop) and has been reorganized within the Resources/schemas directory.

Resources/schemas · high confidence

Extract translation messages from Symfony Validator constraints

The translation extractor now supports extracting message strings from Symfony Validator constraints. A new ConstraintVisitor class has been added to the extraction pipeline, which scans PHP code for constraint attributes and instantiations to identify and catalog translation keys defined in the 'validators' domain.

symfony/translation · high confidence

Introduce Translation Provider infrastructure

Adds the foundational classes for the Translation Provider system, including the \Dsn\ class for parsing and validating provider connection strings (with URL-decoded credentials), the \ProviderInterface\ and \ProviderFactoryInterface\ contracts, and the \AbstractProviderFactory\ base class. It also introduces the \FilteringProvider\ to restrict translation reads/writes to configured locales and domains, a \NullProvider\ for no-op operations, and the \TranslationProviderCollection\ and \TranslationProviderCollectionFactory\ to manage and instantiate these providers based on configuration.

Provider · high confidence

Introduce TranslationWriter and its interface

Added the TranslationWriter class and the TranslationWriterInterface to the Translation component. The interface defines the contract for writing translation messages, while the implementation manages a registry of dumpers by format, validates that a dumper exists for the requested format, ensures the output directory is created if specified, and delegates the actual file writing to the appropriate dumper instance.

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 parse PHP source code into an Abstract Syntax Tree (AST). This allows the extractor to find translation messages in more complex contexts, such as variables, method return values, and interpolated strings, rather than relying solely on static pattern matching. The component also introduces an ExtractorInterface and ChainExtractor to standardize how extractors are registered and executed, and an AbstractFileExtractor base class to simplify file handling. Users can now extract translations from individual files or arrays of files, in addition to directories, and the system requires the nikic/php-parser and symfony/finder packages to be installed.

Extractor · high confidence

New ICU message formatting support via IntlFormatter

The Translation component now includes a new IntlFormatter and IntlFormatterInterface to handle ICU MessageFormat patterns, allowing users to format localized messages using the standard ICU syntax. The existing MessageFormatter has been updated to implement IntlFormatterInterface and delegates ICU-specific formatting to the new IntlFormatter, ensuring seamless integration for applications requiring advanced pluralization and message formatting rules.

Formatter · high confidence

New PhpAstExtractor for translation message extraction

The translation extractor now uses a new PhpAstExtractor (located in Extractor/Visitor) to parse PHP source code and extract translation messages. This new component introduces visitors (TransMethodVisitor, TranslatableMessageVisitor) that handle extraction from t()/trans() function calls, TranslatableMessage instantiations, and method calls with named parameters. It also supports extracting messages from complex expressions including ternary operators, null-coalescing expressions, match expressions, interpolated strings, variables, and method return values, providing more robust extraction capabilities compared to the previous implementation.

Extractor/Visitor · high confidence

New Translation Data Collector for Profiler

A new TranslationDataCollector has been added to capture and display translation usage statistics in the web profiler. This collector gathers the current locale, fallback locales, and global parameters during request collection, and tracks the count of defined, missing, and fallback translation messages. It also stores sanitized translation messages with their usage counts and parameters, allowing developers to inspect translation performance and issues directly in the profiler UI.

DataCollector · high confidence

New TranslationReader component for loading translation files

A new TranslationReader class and its corresponding interface have been introduced in the Translation component. This component is responsible for reading translation messages from files within a specified directory and loading them into a MessageCatalogue using registered loaders, providing a dedicated mechanism for importing translations based on file format and locale.

Reader · high confidence

New catalogue operations for merging and targeting translations

The Translation component introduces \MergeOperation\ and \TargetOperation\ classes, along with their shared \AbstractOperation\ base and \OperationInterface\. These allow users to programmatically combine message catalogues: \MergeOperation\ unions messages from source and target catalogues (preserving new messages), while \TargetOperation\ intersects them (marking source-only messages as obsolete and target-only as new). Both operations correctly handle metadata and international (ICU) domain suffixes, enabling more granular control over translation updates and synchronization workflows.

Catalogue · high confidence

New translation file dumpers for CSV, ICU, INI, 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. This release adds CsvFileDumper, IcuResFileDumper, IniFileDumper, JsonFileDumper, MoFileDumper, PhpFileDumper, QtFileDumper, and PoFileDumper. It also introduces XliffFileDumper support for XLIFF 2.0 (in addition to the existing 1.2) and enhances YamlFileDumper with 'as\_tree' and 'inline' options. These dumpers implement the new DumperInterface and FileDumper base class, enabling users to save translations in these specific file formats.

Dumper · high confidence

New translation management commands and unified linting

This change introduces a suite of new console commands for managing translations: \translation:debug\ to identify missing or unused messages, \translation:extract\ to pull new keys from code into translation files, \translation:pull\ and \translation:push\ to synchronize translations with external providers, and \translation:update-xliff-sources\ to update XLIFF source tags. It also adds \lint:translations\ for validating translation catalogs and enhances \lint:xliff\ with GitHub Actions annotations and support for multiple files or directories. These commands replace legacy STDIN handling with \php://stdin\ and use the \\#\[AsCommand\]\ attribute for configuration.

Command · 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 English sources to identify missing translations and mismatches between trans-unit IDs and source text. Users can run it to get a summary of all locales, filter for incomplete languages, or view detailed reports 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 specific schema versions (1.2, 2.0, 2.1, 2.2) and handling XML error reporting. These utilities support more robust parsing and dumping of translation catalogs, particularly for YAML and XLIFF formats.

Util · high confidence

Translation component introduces a structured exception hierarchy

The Translation component now provides a dedicated set of exception classes (e.g., \InvalidArgumentException\, \LogicException\, \RuntimeException\, \ProviderException\) that implement the new \ExceptionInterface\ and extend standard PHP exceptions. This change ensures all component exceptions are typed as \Throwable\, allowing developers to catch translation-specific errors more precisely. Additionally, \UnsupportedSchemeException\ now includes helpful \composer require\ suggestions in its error message when a provider package is missing, and \ProviderException\ exposes HTTP response debug information for easier troubleshooting.

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 via ICU parent data, a LocaleSwitcher for managing locale context across services, and a PseudoLocalizationTranslator for development-time UI testing. Support for XLIFF 2.1 and 2.2 is added, along with a new LocaleFallbackProvider. Developer experience is improved with a DataCollectorTranslator for profiling translations, a LoggingTranslator for debugging, and a StaticMessage class for non-translatable strings. The legacy PluralizationRules class is removed in favor of modern pluralization handling.

(repo-wide) · high confidence

Translation loaders now support CSV, JSON, INI, Qt, ICU, and MO formats

The Translation component's Loader area now includes new loaders for CSV (CsvFileLoader), JSON (JsonFileLoader), INI (IniFileLoader), Qt XML (QtFileLoader), ICU resource bundles (IcuResFileLoader, IcuDatFileLoader), and GNU MO files (MoFileLoader). These new classes extend the newly introduced FileLoader base class, which enforces that resources are local files and registers file dependencies, or implement LoaderInterface directly (QtFileLoader). The existing ArrayLoader and PhpFileLoader have been updated to use modern PHP type hints and, in the case of PhpFileLoader, added OPcache-aware caching for loaded translation arrays.

Loader · high confidence

Removals

Removal of ResourceInterface and FileResource classes

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 interface and implementation, which may break existing code relying on these specific classes for resource management.

Resource · high confidence

Architecture

Translation compiler passes moved to Translation component

The translation-related dependency injection compiler passes (such as DataCollectorTranslatorPass, LoggingTranslatorPass, TranslatorPass, and TranslatorPathsPass) have been moved from the FrameworkBundle into the Translation component. This change decouples the translation service wiring logic from the framework bundle, allowing the Translation component to manage its own container configuration and reducing coupling between the framework and translation features.

DependencyInjection · high confidence

Behavioural changes

1 commit (0 fixes) modifying CacheWarmer, DependencyInjection

A change to existing behaviour in CacheWarmer, DependencyInjection — 1 commit, 2 files: “\[Cache\]\[FrameworkBundle\]\[Routing\]\[Serializer\]\[Translation\]\[TwigBundle\]\[Validator\] Preserve legacy types of moved services”. Also in this area: Translation cache warming moved to the Translation component.

CacheWarmer · low confidence · unverified

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 service wiring moved to dedicated configuration files

The dependency-injection configuration for the Translation component has been reorganized into dedicated files (console.php, identity\_translator.php, translation.php, translation\_debug.php, and translation\_providers.php). This change registers the translation console commands, loaders, dumpers, extractors, and provider factories (Crowdin, Loco, Lokalise, Phrase, PoEditor) as distinct service definitions, replacing the previous monolithic wiring. Users benefit from a clearer separation of concerns in the service container, where translation providers and debug collectors are now explicitly configured with their own tags and dependencies, ensuring that features like the web profiler collector are only loaded when the profiler is present.

Resources/config · high confidence

Test coverage

Added test fixture for TranslatableMessage extraction in other namespaces; Added test fixtures for PHP AST translation extractor; Added test fixtures for translation extraction and resource bundle formats; Added test fixtures for translation message extraction from variables and method returns; Added tests for PhpAstExtractor; Added tests for Translation Util components; Added tests for Translation dependency injection compiler passes; Added tests for TranslationDataCollector; Added tests for translation command suite; 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 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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 43.7 → 50.5 (+6.8)
  • Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 56.9 → 56.3 (-0.6)
  • Architecture 85.1 → 88.7 (+3.6)
  • Maturity 40.0 → 40.1 (+0.1)
  • Readiness 29.6 → 46.6 (+17.0)
  • Security 100.0 → 100.0 (0.0)

Resolved (8)

  • Duplicated block (18 lines × 2) (Loader/IcuDatFileLoader.php)
  • Duplicated block (7 lines × 2) (Dumper/XliffFileDumper.php)
  • Hotspot: Resources/bin/translation-status.php (Resources/bin/translation-status.php)
  • Leaked secret: hardcoded-credential (Resources/data/parents.json)
  • Leaked secret: hardcoded-credential (Resources/data/parents.php)
  • Off-boarding risk: anonymized user #1
  • Off-boarding risk: anonymized user #2
  • Projects may be oversized for their cohesion

New (20)

  • Circular dependency (TranslatorBag.php)
  • Duplicated block (21 lines × 2) (Loader/IcuDatFileLoader.php)
  • Duplicated block (9 lines × 2) (Loader/FileLoader.php)
  • Edited copies of one member (3 members, 9+ corresponding lines) (Catalogue/AbstractOperation.php)
  • Edited copies of one member (3 members, 9+ corresponding lines) (DependencyInjection/DataCollectorTranslatorPass.php)
  • Edited copy of a member (21 corresponding lines) (TranslatorBag.php)
  • Edited copy of a member (27 corresponding lines) (Extractor/Visitor/TransMethodVisitor.php)
  • Edited copy of a member (31 corresponding lines) (Loader/IcuDatFileLoader.php)
  • Edited copy of a member (39 corresponding lines) (Catalogue/MergeOperation.php)
  • Edited copy of a member (4 corresponding lines) (DataCollectorTranslator.php)
  • Edited copy of a member (8 corresponding lines) (Command/TranslationExtractCommand.php)
  • Off the main sequence: CacheWarmer
  • Off the main sequence: Exception
  • Off the main sequence: Util
  • Off-boarding risk: anonymized user #1
  • Orphaned file (Command/TranslationPullCommand.php)
  • Skipped (documented): testLintFileWithInvalidUtf8NameWithJsonFormat (Tests/Command/XliffLintCommandTest.php)
  • Skipped (documented): testLintFilesWithMarkupInTheirName (Tests/Command/XliffLintCommandTest.php)
  • Unstable project Command
  • Unstable project Resources

Changes since last survey

  • 12 commits — 11 feature/other, 1 fixes

By area

  • (repo) — 6 commits
  • (root) — 1 commit
  • CacheWarmer/TranslationsCacheWarmer.php — 1 commit
  • Command/TranslationLintCommand.php — 1 commit
  • Command/XliffLintCommand.php — 1 commit
  • DependencyInjection/Translator.php — 1 commit
  • Resources/schemas — 1 commit

Notable commits

  • fix: bug #68188 [Console][Translation][TwigBridge][Yaml] Escape file names and messages in the output of the lint commands (nicolas-grekas)
  • change: Declare bundle options that resolve at compile time
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: [AssetMapper][Messenger][Translation][TwigBridge] Escape values in text output and write JSON raw in commands
  • change: [Cache][FrameworkBundle][Routing][Serializer][Translation][TwigBundle][Validator] Preserve legacy types of moved services
  • change: [Console][Translation][TwigBridge][Yaml] Escape file names and messages in the output of the lint commands
  • change: [DependencyInjection][Routing][Translation] Track loaded files before reading them
  • change: [Translation] Add the license terms of the XML schemas

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.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 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit a77754eb5ce670374615de2acbbc6641ad6f88b5 — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.84+preprod-d645ca9bbedd.