{"record":{"id":"5592445f1b1adbdd","repo":"symfony/translation","slug":"operated-catalogues-must-belong-to-the-same-locale","errorCode":null,"errorMessage":"Operated catalogues must belong to the same locale.","messagePattern":"Operated catalogues must belong to the same locale\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"Catalogue/AbstractOperation.php","lineNumber":68,"sourceCode":"     *         ],\n     *         ...\n     *     ]\n     *\n     * @var array The array that stores 'all', 'new' and 'obsolete' messages\n     */\n    protected array $messages;\n\n    private array $domains;\n\n    /**\n     * @throws LogicException\n     */\n    public function __construct(\n        protected MessageCatalogueInterface $source,\n        protected MessageCatalogueInterface $target,\n    ) {\n        if ($source->getLocale() !== $target->getLocale()) {\n            throw new LogicException('Operated catalogues must belong to the same locale.');\n        }\n\n        $this->result = new MessageCatalogue($source->getLocale());\n        $this->messages = [];\n    }\n\n    public function getDomains(): array\n    {\n        if (!isset($this->domains)) {\n            $domains = [];\n            foreach ([$this->source, $this->target] as $catalogue) {\n                foreach ($catalogue->getDomains() as $domain) {\n                    $domains[$domain] = $domain;\n\n                    if ($catalogue->all($domainIcu = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX)) {\n                        $domains[$domainIcu] = $domainIcu;\n                    }\n                }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Catalogue/AbstractOperation.php#L50-L86","documentation":"Thrown by the constructor of AbstractOperation (and thus Operation and TargetOperation) when the two MessageCatalogue instances passed in do not share the same locale. The operation compares source and target messages domain by domain, which is only meaningful if both catalogues are in one locale; a locale mismatch would silently corrupt the diff, so the constructor rejects it up front with a LogicException.","triggerScenarios":"Thrown at Catalogue/AbstractOperation.php:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass catalogues that were loaded for the same locale: check $source->getLocale() === $target->getLocale() before constructing the operation.","Load each catalogue with LoaderInterface::load($resource, $locale) using the identical $locale argument.","If cross-locale comparison is intended, load the source messages and build the target catalogue explicitly for that same locale instead of reusing a catalogue of another locale."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ae9e8a51bc29780d63c7f9efd6005d7c875e100b","analyzedAt":"2026-09-15T22:29:15.305Z","contentChangedAt":"2026-09-15T22:29:15.305Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}